elvissteinjr / DesktopPlus

Advanced desktop access for OpenVR
GNU General Public License v3.0
468 stars 29 forks source link

A Universal way to capture games at 120hz #19

Closed zmz125000 closed 3 years ago

zmz125000 commented 3 years ago

Use Desktop Duplication with Disable Fullscreen Optimizations enabled Tested with DX9, DX11, Vulkan games on a 60hz display.

Screenshot (10)

Guide to capture at unconstrained frame-rates 120hz: 1. set Capture Method to Graphics Capture. 2. launch game in exclusive full-screen mode 3. disable VSync. 4. set in game monitor refresh rate to 30hz or 24hz or lower (Important, don't know why but it works, need a supported monitor. tried 50hz or 60hz but 120hz capture didn't work ). 5. enjoy.

Tested with some call of duty games, it always works. Hardware: RTX2080 and 60hz TV and Valve Index

elvissteinjr commented 3 years ago

That's indeed odd. Can't replicate here unfortunately (tried with headless HDMI dongle @ 24 Hz and games that do work unconstrained with Desktop Duplication), but if it works in certain configurations then that's cool. It's worth noting that Graphics Capture doesn't support capturing exclusive fullscreen at all when more than 1 screen is connected and active. To be honest, I was under the impression Graphics Capture wouldn't work with exclusive fullscreen at all, but it did with every other display disconnected... until my second attempt where it stopped working like that. Yeah, a weird one I guess.

Any other games that worked with this? Were you capturing the game window or the desktop?

zmz125000 commented 3 years ago

@elvissteinjr on my side Desktop Duplication always capture at current monitor refresh rate, Graphics Capture captures unconstrainedly when monitor refresh rate set to 30hz or lower, capturing the game window and the desktop both work.

All games I tried (DX9, DX11) that can change refresh rate worked.

may be we can use some driver APIs like NVFBC, it always works (in Nvidia Gamestream and Steam remote play) and have good performance. When playing DOOM Eternal (Vulkan) Desktop Duplication reboots my PC and Graphics Capture shows black screen, NVFBC capture all games at unconstrained frame-rates since it captures the framebuffer.

zmz125000 commented 3 years ago

I tried to port LookingGlass's NVFBC support to DesktopPlus but I found out that you can capture 120hz using Desktop Duplication with Disable Fullscreen Optimizations checked and it works pretty well. https://github.com/gnif/LookingGlass/tree/master/host/platform/Windows/capture/NVFBC

zmz125000 commented 3 years ago

@elvissteinjr I found it. Disable Fullscreen Optimizations make Desktop Duplication captures at unconstrainedly framerate (DesktopPlus's Desktop Duplication Update Rate confirmed that). Tested with DX9, DX11, Vulkan (Vulkan should not be affected but I still tested it) games on a 60hz display.

Time to update the User Guide buddy:)

elvissteinjr commented 3 years ago

That seems to be indeed the missing piece here. Can confirm it works. Funnily enough the first time I notice that particular checkbox in the compatibility tab.

Now that I think about it, this behavior does match what someone from Microsoft had told me when I mentioned that OpenGL and Vulkan games worked unconstrained (that DX games usually end up in an emulated mode instead of true exclusive fullscreen). Wasn't aware it was something that could just be toggled. Oh and regarding OpenGL and Vulkan games running unconstrained without that toggle, it seems that it also depends on the screen setup. I couldn't get it to run like that with only a single display active for example, but my usual dual screen setup had it unconstrained as long as it ran on the primary screen. A tad bit inconsistent. Might've been why you couldn't get it to work like that before (or it's just being stupid).

Also looks like I forgot to respond regarding NVFBC. General stance here is that adding more capture methods adds maintenance burden. Not only that, but NVIDIA deprecated NVFBC for Windows 10 in favor of the OS APIs (the two Desktop+ supports). Of course, the NVIDIA APIs will continue to work for the time being so that's only a formal thing. The NVIDIA headers and the license that come with them is also incompatible with the GPL as far as I can tell. LookingGlass seems to work around it by wrapping the DLL calls directly... fair enough. So it boils down to whether implementing that API is worth the effort or not. I personally have no qualms with the latency in Desktop+ (that'd be the only upside left I think), especially at 120 Hz, so it's a no from me for now.

I'll update the user guide accordingly, thanks for digging that up!

elvissteinjr commented 3 years ago

I've pushed some changes to the user guide, thanks again. Suppose this is resolved for now, so I'm closing the issue.