From aa2a819ad1c5f0cbba9eeea288ac462a11fc9df3 Mon Sep 17 00:00:00 2001 From: jpark37 Date: Mon, 2 May 2022 23:18:55 -0700 Subject: [PATCH] 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. --- libobs-winrt/winrt-capture.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libobs-winrt/winrt-capture.cpp b/libobs-winrt/winrt-capture.cpp index a1fccdc56..7c49fec71 100644 --- a/libobs-winrt/winrt-capture.cpp +++ b/libobs-winrt/winrt-capture.cpp @@ -661,13 +661,15 @@ extern "C" EXPORT void winrt_capture_render(struct winrt_capture *capture) } gs_effect_t *const effect = - obs_get_base_effect(OBS_EFFECT_OPAQUE); + obs_get_base_effect(OBS_EFFECT_DEFAULT); gs_technique_t *tech = gs_effect_get_technique(effect, tech_name); const bool previous = gs_framebuffer_srgb_enabled(); gs_enable_framebuffer_srgb(true); - gs_enable_blending(false); + + gs_blend_state_push(); + gs_blend_function(GS_BLEND_ONE, GS_BLEND_INVSRCALPHA); gs_texture_t *const texture = capture->texture; gs_effect_set_texture_srgb( @@ -686,7 +688,8 @@ extern "C" EXPORT void winrt_capture_render(struct winrt_capture *capture) } gs_technique_end(tech); - gs_enable_blending(true); + gs_blend_state_pop(); + gs_enable_framebuffer_srgb(previous); } }