d3d12converter: Add support initial pso DXGI_SAMPLE_DESC setting

Add more options for pso, in order to avoid redundant pso
creation when MSAA is used

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7550>
This commit is contained in:
Seungha Yang 2024-09-18 23:53:23 +09:00 committed by GStreamer Marge Bot
parent 965d898deb
commit 7cf27c456b
2 changed files with 34 additions and 3 deletions

View file

@ -738,7 +738,7 @@ static gboolean
gst_d3d12_converter_setup_resource (GstD3D12Converter * self,
const GstVideoInfo * in_info, const GstVideoInfo * out_info,
const GstD3D12Format * in_format, const GstD3D12Format * out_format,
D3D12_FILTER sampler_filter)
D3D12_FILTER sampler_filter, guint sample_count, guint sample_quality)
{
auto priv = self->priv;
HRESULT hr;
@ -842,7 +842,8 @@ gst_d3d12_converter_setup_resource (GstD3D12Converter * self,
pso_desc.RTVFormats[j] = rtv_formats.front ();
rtv_formats.pop ();
}
pso_desc.SampleDesc.Count = 1;
pso_desc.SampleDesc.Count = sample_count;
pso_desc.SampleDesc.Quality = sample_quality;
ComPtr < ID3D12PipelineState > pso;
hr = device->CreateGraphicsPipelineState (&pso_desc, IID_PPV_ARGS (&pso));
@ -1890,6 +1891,8 @@ gst_d3d12_converter_new (GstD3D12Device * device, GstD3D12CommandQueue * queue,
D3D12_FILTER sampler_filter = D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT;
GstVideoInfo matrix_in_info;
GstVideoInfo matrix_out_info;
guint sample_count = 1;
guint sample_quality = 0;
g_return_val_if_fail (GST_IS_D3D12_DEVICE (device), nullptr);
g_return_val_if_fail (in_info != nullptr, nullptr);
@ -1951,6 +1954,14 @@ gst_d3d12_converter_new (GstD3D12Device * device, GstD3D12CommandQueue * queue,
gst_structure_get_enum (config, GST_D3D12_CONVERTER_OPT_DEST_ALPHA_MODE,
GST_TYPE_D3D12_CONVERTER_ALPHA_MODE, (int *) &priv->dst_alpha_mode);
gst_structure_get_uint (config,
GST_D3D12_CONVERTER_OPT_PSO_SAMPLE_DESC_COUNT, &sample_count);
gst_structure_get_uint (config,
GST_D3D12_CONVERTER_OPT_PSO_SAMPLE_DESC_QUALITY, &sample_quality);
priv->sample_desc.Count = sample_count;
priv->sample_desc.Quality = sample_quality;
gst_structure_free (config);
}
@ -2075,7 +2086,7 @@ gst_d3d12_converter_new (GstD3D12Device * device, GstD3D12CommandQueue * queue,
if (!gst_d3d12_converter_setup_resource (self, &priv->in_info,
&priv->out_info, &in_d3d12_format, &out_d3d12_format,
sampler_filter)) {
sampler_filter, sample_count, sample_quality)) {
gst_object_unref (self);
return nullptr;
}

View file

@ -115,6 +115,26 @@ GType gst_d3d12_converter_alpha_mode_get_type (void);
*/
#define GST_D3D12_CONVERTER_OPT_DEST_ALPHA_MODE "GstD3D12Converter.dest-alpha-mode"
/**
* GST_D3D12_CONVERTER_OPT_PSO_SAMPLE_DESC_COUNT:
*
* #G_TYPE_UINT, D3D12_GRAPHICS_PIPELINE_STATE_DESC.SampleDesc.Count value to use.
* Default is 1.
*
* Since: 1.26
*/
#define GST_D3D12_CONVERTER_OPT_PSO_SAMPLE_DESC_COUNT "GstD3D12Converter.pso-sample-desc-count"
/**
* GST_D3D12_CONVERTER_OPT_PSO_SAMPLE_DESC_QUALITY:
*
* #G_TYPE_UINT, D3D12_GRAPHICS_PIPELINE_STATE_DESC.SampleDesc.Quality value to use.
* Default is 0.
*
* Since: 1.26
*/
#define GST_D3D12_CONVERTER_OPT_PSO_SAMPLE_DESC_QUALITY "GstD3D12Converter.pso-sample-desc-quality"
/**
* GstD3D12Converter:
*