d3d11overlaycompositor: Set rasterizer state

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5572>
This commit is contained in:
Seungha Yang 2023-10-28 19:34:55 +09:00
parent 4dfdb6ec68
commit 3a2a31d18b

View file

@ -80,6 +80,7 @@ struct _GstD3D11OverlayCompositorPrivate
ComPtr<ID3D11SamplerState> sampler;
ComPtr<ID3D11BlendState> blend;
ComPtr<ID3D11Buffer> index_buffer;
ComPtr<ID3D11RasterizerState> rs;
std::vector<GstD3D11CompositionOverlayPtr> 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);