WGC capture is at the compositor level, so it's less quirky than the
BitBlt path would be.
Rounded corners in Windows 11 work. LiveSplit shenanigans do not.
Use code() instead of to_abi() on hresult_error structs as the latter
has additional side effects. Cast all values to int32_t to ensure the
hresult int32_t() operator is called so we pass the actual value and not
the full struct (detected by PVS Studio).
Update window, display, and game capture to always bilinear filter in
linear space, even if the source texture is not SRGB typed. This helps
resolve confusion in situations where we were filtering in nonlinear
space vs. linear space, like when toggling an empty crop filter.
A user has reported that toggling the cursor can cause exceptions.
Propagate that information upward, so we can reset the capture.
Display capture never needed to call the function in the first place.
Shuffle around window capture code to make a common reset function.
Builds on PR #4663.
Add display capture support via winrt_capture_init_monitor. Almost all
of the existing window capture code is reused.
Rename winrt_capture_init to winrt_capture_init_window for symmetry.
Functionality is coming in a future Windows update to disable the yellow
border when using WGC. Add code now to opt in. Will require SDK upgrade
later for OBS build.
winrt::apartment_type::multi_threaded is necessary to dodge assert for
calling get() on RequestAccessAsync result. Don't think I will ever
fully understand COM apartments.
We were performing a custom cursor draw for WGC, which we attempted
because we thought we could bring back hardware cursor responsiveness,
but MS says that it won't. Since the custom draw was bugged to cause
black screens anyway, just use the native cursor draw for now.
Illegal CopySubresourceRegion parameters were sometimes computed when
minimizing and restoring WGC window captures, leading to device loss.
Add robust safeties to ensure that doesn't happen.
Starting with Windows 10 2004, we can disable WGC cursor capture, and
provide a user toggle. We swap out WGC support for our own though
because ours does not break hardware cursor support.