microsoft / Windows.UI.Composition-Win32-Samples

Windows.UI.Composition Win32 Samples
MIT License
458 stars 186 forks source link

Cursor may become invisible when recording some fullscreen games using WGC #128

Open Esvandiary opened 6 months ago

Esvandiary commented 6 months ago

There seems to be a software-dependent issue with WGC window capture where the user's cursor may disappear when recording certain fullscreen games. For clarity: this isn't the cursor appearing or not appearing in the recording, this is the actual system cursor becoming invisible within a fullscreen window while WGC is recording it. The same issue does not appear using other recording methods (e.g. DXGI desktop duplication, BitBlt), and enabling/disabling the WGC option to show the cursor in recordings does not seem to change the behaviour.

We've been getting user reports about this for a while (and mercifully one of our QA team can reproduce it), and the OBS project has had reports about the same on their forums for a few years including examples of both window and screen capture suffering from this issue. However, this obviously isn't an across-the-board problem, and myself and several of my colleagues can't reproduce it at all.

So far we've had reports for Minecraft Java Edition and Geometry Dash, which I believe both use OpenGL. We've also had reports on both NVIDIA and AMD GPUs (although we've only seen AMD via user reports so slight grain of salt).

I've built the WPF ScreenCapture sample and sent it to my colleague, and he was able to reproduce the issue. He's on Windows 11 Home 22H2 (22621.3007) with an NVIDIA GPU, but we also have user reports from other Windows 11 versions on builds 22621 and 22631.
Repro steps:

I'm not sure if this is a known issue, but it'd be really great to have one of:

I can ask my colleague for more information or to test other scenarios if it'll help. Thanks!

robmikh commented 6 months ago

Hmmm, interesting. It likely has something to do with the software cursor, as that is forced on with WGC. The good news is that in an upcoming release we've finally removed the transition to the software cursor while capturing. But I'll see what I can find for existing builds.

Esvandiary commented 6 months ago

Thanks very much! I'll read up on software vs hardware cursor differences and see if that can give me any leads on finding anything in common between people who can reproduce the issue.

Even if the issue can't be worked around on existing builds (as I imagine may be quite likely), finding a differentiator would be very beneficial, since it gives us more fine-grained options than the bludgeon of "fullscreen game + hidden cursor = fall back to DXGI/BitBlt."

I'll also try to narrow down whether OpenGL actually is a common factor here or if that's just coincidence based on the games that have been reported.

robmikh commented 6 months ago

Of course! And thanks for digging up more information. If you want to force the software cursor without WGC, you can turn on cursor trails. I think there's also a magnifier API to do so, but I can't remember off the top of my head.

Additionally it would be good to know what builds of Windows this behavior is seen on. Seems like I needed to read your original post closer. Oops!

Esvandiary commented 6 months ago

Yeah, we've definitely seen it on Win11 22621 and 22631; I'll dig through some of the other user reports and see if I can find any other cases (e.g. I imagine a yes/no for Win10 would be useful! Might struggle for that though as we disable WGC by default on 10 since our users mostly aren't fans of the yellow border)

Esvandiary commented 4 months ago

Quick update for you @robmikh : we haven't managed to get any definite confirmations for Win10 or other Win11 builds, but we've made the following observations:

All of my testing above was tested on a mix of Win11 22631.3447 and 22631.3527

robmikh commented 4 months ago

Thanks for the extra info, this will definitely help!

Esvandiary commented 1 month ago

One more quick update: we're getting some scattered reports of this issue with League of Legends too, which AFAIK is a D3D game, not OpenGL... so the GL specificity may be coincidence rather than an actual symptom.

Esvandiary commented 1 month ago

Clarification on the above: it looks like there are two separate situations that can cause this, only one of which I'd say is actually a bug.