From 3a2a31d18be54c4bb78d3468626c8e6e89ba08d8 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sat, 28 Oct 2023 19:34:55 +0900 Subject: [PATCH] d3d11overlaycompositor: Set rasterizer state Part-of: --- .../sys/d3d11/gstd3d11overlaycompositor.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11overlaycompositor.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11overlaycompositor.cpp index 55dee86306..6e1c4595e9 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11overlaycompositor.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11overlaycompositor.cpp @@ -80,6 +80,7 @@ struct _GstD3D11OverlayCompositorPrivate ComPtr sampler; ComPtr blend; ComPtr index_buffer; + ComPtr rs; std::vector overlays; }; @@ -340,6 +341,7 @@ gst_d3d11_overlay_compositor_setup_shader (GstD3D11OverlayCompositor * self) ComPtr < ID3D11SamplerState > sampler; ComPtr < ID3D11BlendState > blend; ComPtr < ID3D11Buffer > index_buffer; + ComPtr < ID3D11RasterizerState > rs; memset (&buffer_desc, 0, sizeof (buffer_desc)); memset (&blend_desc, 0, sizeof (blend_desc)); @@ -373,6 +375,12 @@ gst_d3d11_overlay_compositor_setup_shader (GstD3D11OverlayCompositor * self) return FALSE; } + hr = gst_d3d11_device_get_rasterizer (device, &rs); + if (!gst_d3d11_result (hr, device)) { + GST_ERROR_OBJECT (self, "Couldn't get rasterizer state"); + return FALSE; + } + blend_desc.AlphaToCoverageEnable = FALSE; blend_desc.IndependentBlendEnable = FALSE; blend_desc.RenderTarget[0].BlendEnable = TRUE; @@ -433,6 +441,7 @@ gst_d3d11_overlay_compositor_setup_shader (GstD3D11OverlayCompositor * self) priv->sampler = sampler; priv->blend = blend; priv->index_buffer = index_buffer; + priv->rs = rs; priv->viewport.TopLeftX = 0; priv->viewport.TopLeftY = 0; @@ -612,6 +621,7 @@ gst_d3d11_overlay_compositor_draw_unlocked (GstD3D11OverlayCompositor * context->PSSetSamplers (0, 1, samplers); context->VSSetShader (priv->vs.Get (), nullptr, 0); context->RSSetViewports (1, &priv->viewport); + context->RSSetState (priv->rs.Get ()); context->OMSetRenderTargets (1, rtv, nullptr); context->OMSetBlendState (priv->blend.Get (), nullptr, 0xffffffff);