Open ConnorBP opened 1 year ago
It won't work in fullscreen, nor will it work in modern windowed games because they're flip model.
Any time DirectX is flipping buffers rather than blitting them, GDI is disabled. Any attempt to use GDI commands on an HWND participating in flip model will have the commands completely dropped by Windows. You can't go back to GDI after engaging flip model, you'd have to destroy the game window and create a new one.
For what it's worth, this also is highly unlikely to work in borderless mode after Windows 11 22H2. Windowed mode optimization is enabled by default, which replaces GDI-based Blt Model games with Flip Model (D3D11). The exceptions are D3D9 and OpenGL games, they will remain GDI-based in windowed mode even after 22H2.
Keep in mind, you lose a whole bunch of modern stuff by using GDI. No support for HDR, no support for G-Sync, massive DWM latency penalties.
If you really want to screw around with this stuff, the modern efficient path to display would involve multiplane overlays. Those work on top of flip model windows, but driver support's lacking and the number of planes available is quite low.
It won't work in fullscreen, nor will it work in modern windowed games because they're flip model.
Any time DirectX is flipping buffers rather than blitting them, GDI is disabled. Any attempt to use GDI commands on an HWND participating in flip model will have the commands completely dropped by Windows. You can't go back to GDI after engaging flip model, you'd have to destroy the game window and create a new one.
For what it's worth, this also is highly unlikely to work in borderless mode after Windows 11 22H2. Windowed mode optimization is enabled by default, which replaces GDI-based Blt Model games with Flip Model (D3D11). The exceptions are D3D9 and OpenGL games, they will remain GDI-based in windowed mode even after 22H2.
Keep in mind, you lose a whole bunch of modern stuff by using GDI. No support for HDR, no support for G-Sync, massive DWM latency penalties.
If you really want to screw around with this stuff, the modern efficient path to display would involve multiplane overlays. Those work on top of flip model windows, but driver support's lacking and the number of planes available is quite low.
Thank you! Very informative. I'll do some reading on this flip model and multipane
I have implemented a new working version of the
NtGdiDdDDISubmitCommand
hook in my driver, and am submitting GDI Commands in it like in this example. However I was disappointed to find out that the rendering only works when I am in borderless windowed mode and not in true full screen.I am wondering, was it like this for you in your original version? I'm not sure if it is something I did, or something with my specific testing game (csgo) or if this hook was only ever for desktop environment rendering. To that end I'm wondering if there is any documentation on this internal side of things or where any of you even learned it.
Additional questions for anyone kind enough to help a noob out:
PS. Thanks for your awesome write ups vmcall, you do some cool shit bro 👍