Commit Graph

37 Commits (master)

Author SHA1 Message Date
jpark37 aa2a819ad1 libobs-winrt: Support window transparency for WGC
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.
2022-05-03 01:03:23 -07:00
jpark37 302862fe33 libobs-winrt: Add winrt_capture_get_color_space
Needed for HDR window/monitor capture using WGC.
2022-04-14 09:36:09 -07:00
jpark37 c9e0d18ce1 libobs-winrt: Add null checks to capture
Try harder to avoid crashing when capture is in a dead state.
2022-04-02 16:28:54 -07:00
PatTheMav 1fd7770548
libobs: Update CMakeLists.txt for libobs and associated libraries
Also updates libobs-opengl, libobs-d3d11, libobs-winrt
2022-03-16 23:11:08 +01:00
jpark37 1a16185977 libobs-winrt: Require Windows 10 SDK 20348
This will prevent compiling without borderless WGC support.
2021-09-11 13:00:28 -07:00
jpark37 94009535cd libobs-winrt: Replace casts with data access 2021-08-19 02:47:55 -07:00
Richard Stanway 30257c9fe3 libobs-winrt: Improve error logging code
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).
2021-08-19 02:16:45 +02:00
jpark37 bf27941f5f libobs-winrt, win-capture: Linear SRGB support
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.
2021-07-11 08:26:30 -07:00
jpark37 4002995b86 libobs-winrt: Use better Windows SDK version check
Latest Windows SDK has a macro for borderless window capture support.
2021-06-30 01:23:03 -07:00
jpark37 366b716f20 libobs-winrt,win-capture: Cursor toggle exceptions
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.
2021-05-07 23:50:13 -07:00
jpark37 744cb97524 libobs-winrt: Make Close() failures non-fatal 2021-02-14 23:11:07 -08:00
jpark37 db35a022cd libobs-winrt,win-capture: Support desktop capture
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.
2021-01-26 15:57:20 -08:00
jpark37 6fe33df708 libobs-winrt: Support linear SRGB
Switch away from GDI-compatible texture for SRGB support. Never needed
GDI compatibility anyway.
2021-01-21 07:42:57 -08:00
jpark37 2e82a6c7e8 libobs-winrt: Disable WGC border on insider SDK
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.
2021-01-15 18:16:23 -08:00
jpark37 71d5451670 libobs-winrt: Fix potential race crash
CreateForWindow can fail if the window is destroyed.
2021-01-15 18:16:23 -08:00
jpark37 b3405d1f28 libobs-winrt: Fix misnamed function 2020-11-13 13:21:10 -08:00
jpark37 c40b98948e libobs-winrt: Fix BOOL/bool mismatch warning 2020-11-04 04:45:07 -08:00
jpark37 d4a607a3c2 libobs-winrt: Use native cursor draw for WGC
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.
2020-10-03 22:41:47 -07:00
jpark37 4d8d05756a libobs-winrt: Device loss crash prevention
Recovery could occur after captured window was closed.
2020-08-20 22:12:39 -07:00
Jim 9563c876ca
Merge pull request #3009 from jpark37/winrt-project-filter
libobs-winrt: Move project to core VS filter
2020-06-21 04:54:45 -07:00
jpark37 0d1f334591 libobs-winrt: Require Windows 10 SDK 19041
This will prevent compiling without WGC cursor toggle support.
2020-06-03 08:00:44 -07:00
jpark37 6d60c5f954 libobs-winrt: Move project to core VS filter
This module houses more WinRT functionality than just window capture.
2020-05-30 21:17:12 -07:00
Jim dedc0c01d5
Merge pull request #2964 from jpark37/winrt-dispatcher
Set up dispatcher queue for WGC stability
2020-05-21 17:31:30 -07:00
Jim c5187aef16
Merge pull request #2908 from jpark37/wgc-minimize
Fix WGC minimize handling
2020-05-21 17:29:04 -07:00
jpark37 49bc89f2b2 libobs-winrt: Add dispatcher queue API
Suspected necessary for WGC stability.
2020-05-21 09:25:50 -07:00
jpark37 a4c9554739 libobs-winrt: Fix WGC minimize handling
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.
2020-05-14 08:28:33 -07:00
jp9000 7993179466 cmake: Add cmake folders 2020-05-13 06:52:37 -07:00
jpark37 097ea77488 libobs-winrt: win-capture: Detect GraphicsCaptureItem closure
Make WGC window capture recover from GraphicsCaptureItem closure, which
can occur when following links in fullscreen Chrome for example.
2020-05-06 21:42:26 -07:00
jpark37 36b7ac432d libobs-winrt: Stronger exception handling
Exceptions were still leaking through somehow.
2020-03-25 08:50:01 -07:00
Richard Stanway 59d72437b4 libobs-winrt: Fix missing parentheses 2020-03-19 15:50:32 +01:00
jpark37 f229d35a05 libobs-winrt: Catch more hresult exceptions
Wrap winrt_capture_supported and winrt_capture_cursor_toggle_supported
with try/catch.
2020-03-18 09:21:40 -07:00
jpark37 e4e96c5cef libobs-winrt: win-capture: Clean up error handling
Use proper check to fix false positive on 1809, and rework error spew to
remove output parameters from winrt_capture_init.
2020-03-18 00:33:12 -07:00
jp9000 327a6f599e win-capture: Fix potential crash due to unhandled exceptions 2020-03-17 12:22:20 -07:00
jpark37 cb4954c279 libobs-winrt: win-capture: HDC cursor capture for WGC
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.
2020-03-07 20:40:39 -08:00
jpark37 2111a3a02f libobs-winrt: win-capture: Support client area toggle for WGC 2020-02-24 21:31:53 -08:00
jpark37 74c7375096 libobs-winrt: Add PCH
Reduces compile time from six seconds to less than a second.
2020-02-22 21:02:33 -08:00
jpark37 d6d27cfab1 libobs-winrt: Add module for WinRT functionality
Currently wraps Windows Graphics Capture API.
2020-02-22 21:02:33 -08:00