d3d11screencapturesrc: Fix mouse cursor blending
authorSeungha Yang <seungha@centricular.com>
Fri, 27 Oct 2023 16:23:36 +0000 (01:23 +0900)
committerTim-Philipp Müller <tim@centricular.com>
Mon, 30 Oct 2023 14:03:49 +0000 (14:03 +0000)
Ignore alpha component of source (mouse cursor texture)
when blending alpha channel, otherwise the background area of source
(which has zeros) will be written to render target. Then it will result
in black rectangle if output texture is converted to premultiplied alpha
texture

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5577>

subprojects/gst-plugins-bad/sys/d3d11/gstd3d11screencapturesrc.cpp

index d1f13d65ee554f5622fc4776e285427c830a25c8..13ba11be246cab14d9847ae54df53ff86818add6 100644 (file)
@@ -890,8 +890,8 @@ gst_d3d11_screen_capture_prepare_shader (GstD3D11ScreenCaptureSrc * self)
   blend_desc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
   blend_desc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
   blend_desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
-  blend_desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
-  blend_desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
+  blend_desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ZERO;
+  blend_desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE;
   blend_desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
   blend_desc.RenderTarget[0].RenderTargetWriteMask =
       D3D11_COLOR_WRITE_ENABLE_ALL;