-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Turns out DirectX's desktop duplication API has a limitation where it cannot run on a discrete GPU on hybrid systems. (For example, laptops with both integrated graphics and a dedicated gpu)
This is an issue when you're making a program in WPF or a game engine.
A workaround is to run the app in integrated graphics mode.
- https://learn.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/error-when-dda-capable-app-is-against-gpu
- https://www.freemancw.com/2020/11/desktop-duplication-on-hybrid-graphics-systems/
- https://stackoverflow.com/questions/40221187/directx11-desktop-duplication-not-working-with-nvidia
Figuring this out was quite painful. In my case, I had the preferred device set to the discrete gpu on my nvidia 3d graphics control panel. (So it forced the discrete gpu on everything)
I then switched it to automatic, and sure enough, screenCapture.RegisterCaptureZone didn't crash. (The second example in the readme was used)
During this whole thing I've also tried the Windows.Graphics.Capture API and it appears to work without issues; But is annoying to get working on something like WPF.
It would be nice if a remark was added to the readme or somewhere else so that other people in the future don't have to go through the same rabbit hole as I did.
DX9 worked fine when I tested it, It's the DX11 provider that is affected by this.