4 ms·
The socket is fine for messages, but not for rendering. Here’s a simplified version of how 3D rendering apps usually work in different environments I have used.
by Const-me 3y ago
The socket is fine for messages, but not for rendering. Here’s a simplified version of how 3D rendering apps usually work in different environments I have used.
Direct3D on Windows: app renders something and calls IDXGISwapChain.Present. The implementation communicates with the desktop compositor running in the dwm.exe process, dwm.exe renders the entire desktop composed of multiple windows, then communicates with physical GPU to wait for next vertical blank event.
Bare metal Linux with DRM: app renders something, calls drmModePageFlip(), then waits for next vertical blank event with poll() and drmHandleEvent() functions. Embedded Linux developers did an amazing job about DRM/KMS, in my experience the API is both reliable and efficient.
X Window systems have multiple different methods, glXSwapIntervalEXT, glXSwapIntervalMESA, glXSwapIntervalSGI, but in practice none of them is reliable, and on some systems none of them is even supported. Unfortunately, this makes rendering tear-free 3D content on X11-based desktops hard-to-impossible.
- GartzenDeHaes 3y agoDidn't realize that this discussion was in the context of games.
- Const-me 3y agoThe originally posted article is about new 3D GPU-based backend in the GTK, which is unrelated to games. Hardware accelerated 3D graphics is the best way to render pretty much everything on modern hardware, games or not games. High-resolution displays are omnipresent. Even cell phones often have FullHD or more pixels, like 2796×1290 or 2556×1179 in the iPhones.
- GartzenDeHaes 3y agoAFAIK, Windows applications typically use GDI instead of DirectX. https://learn.microsoft.com/en-us/windows/win32/direct2d/comparing-direct2d-and-gdi https://learn.microsoft.com/en-us/windows/win32/direct2d/com...
- Const-me 3y agoGDI is only used by legacy apps. It gonna stay there for quite a while for backward compatibility reasons, but modern Windows apps are using better GPU-centric APIs to render their GUI. Specifically, WPF is based on DirectX 9, Direct2D is based on Direct3D 11, UWP and WinUI are based on Direct2D. On my computer, both Chromium and Firefox browsers are using Angle on top of D3D11, Firefox uses Direct2D for canvas only. Also, even legacy apps who render their GUI with GDI are still using 3D GPUs to an extent. Some GDI operations like BitBlt are accelerated internally by the OS. And the OS composes windows on the desktop with D3D11, dwm.exe process does that.
- charcircuit 3y ago>Hardware accelerated 3D graphics is the best way to render pretty much everything on modern hardware, games or not games. A counterexample is video playback. The best way for video is to use the hardware decoder and hardware compositor. You don't want to render the video texture to a quad. Using the hardware compositor requires less computation and less power than using 3D graphics.
- Const-me 3y ago> The best way for video is to use the hardware decoder and hardware compositor. Not according to Microsoft, see that page https://learn.microsoft.com/en-us/windows/win32/medfound/how-to-write-an-evr-presenter https://learn.microsoft.com/en-us/windows/win32/medfound/how... Microsoft strongly recommends that new code use MediaPlayer or the lower level IMFMediaEngine APIs to play video media in Windows instead of the EVR, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible. That lower level IMFMediaEngine API they recommend for Win10+ delivers uncompressed video frames in D3D11 textures.
- charcircuit 3y ago>That lower level IMFMediaEngine API they recommend for Win10+ delivers uncompressed video frames in D3D11 textures. Which in the best case is done via hardware decoding as I said.
- Const-me 3y agoYes, but note no hardware composition is involved. The composition is done by the 3D GPU like I said. Either in your app if you render that video yourself, or if you supply a swap chain’s back buffer to IMFMediaEngine.TransferVideoFrame method, dwm.exe will do it.
- charcircuit 3y agoIt's the compositor's job to composite in the most efficient way possible which in the best case would be using hardware compositing layers, if the hardware does not have enough layers than the compositor will use 3D graphics to combine layers together. Just because a GPU includes a 3D graphics pipeline that doesn't mean that everything has to go through it.