From 7f2b4b6b09ee17fc490547c09277766b16a74f98 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Tue, 9 Jan 2024 20:27:36 +0900 Subject: [PATCH] d3d12: Fix warnings reported by debug layer Fixing below debug layer report ID3D12Device::CreateCommittedResource: Ignoring InitialState D3D12_RESOURCE_STATE_COPY_DEST. Buffers are effectively created in state D3D12_RESOURCE_STATE_COMMON. Buffer resource will be automatically promoted to D3D12_RESOURCE_STATE_COPY_DEST at the very first COPY operation time. Part-of: --- .../gst-plugins-bad/sys/d3d12/gstd3d12compositor.cpp | 3 +-- subprojects/gst-plugins-bad/sys/d3d12/gstd3d12converter.cpp | 4 ++-- subprojects/gst-plugins-bad/sys/d3d12/gstd3d12testsrc.cpp | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12compositor.cpp b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12compositor.cpp index d42ca06707..f3dd001208 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12compositor.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12compositor.cpp @@ -458,8 +458,7 @@ struct BackgroundRender heap_prop = CD3DX12_HEAP_PROPERTIES (D3D12_HEAP_TYPE_DEFAULT); hr = device_handle->CreateCommittedResource (&heap_prop, D3D12_HEAP_FLAG_CREATE_NOT_ZEROED, &buffer_desc, - D3D12_RESOURCE_STATE_COPY_DEST, - nullptr, IID_PPV_ARGS (&vertex_index_buf)); + D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS (&vertex_index_buf)); if (!gst_d3d12_result (hr, device)) { GST_ERROR_OBJECT (device, "Couldn't create index buffer"); return; diff --git a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12converter.cpp b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12converter.cpp index 85f3036640..f42d996396 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12converter.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12converter.cpp @@ -766,7 +766,7 @@ gst_d3d12_converter_setup_resource (GstD3D12Converter * self, sizeof (g_indices)); hr = device->CreateCommittedResource (&heap_prop, D3D12_HEAP_FLAG_CREATE_NOT_ZEROED, - &resource_desc, D3D12_RESOURCE_STATE_COPY_DEST, nullptr, + &resource_desc, D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS (&priv->vertex_index_buf)); if (!gst_d3d12_result (hr, self->device)) { GST_ERROR_OBJECT (self, "Couldn't create vertex buffer"); @@ -808,7 +808,7 @@ gst_d3d12_converter_setup_resource (GstD3D12Converter * self, resource_desc = CD3DX12_RESOURCE_DESC::Buffer (sizeof (PSConstBuffer)); hr = device->CreateCommittedResource (&heap_prop, D3D12_HEAP_FLAG_CREATE_NOT_ZEROED, - &resource_desc, D3D12_RESOURCE_STATE_COPY_DEST, nullptr, + &resource_desc, D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS (&priv->ps_const_buf)); if (!gst_d3d12_result (hr, self->device)) { GST_ERROR_OBJECT (self, "Couldn't create const buffer"); diff --git a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12testsrc.cpp b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12testsrc.cpp index bcdc438a39..160af27dc7 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12testsrc.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12testsrc.cpp @@ -560,7 +560,7 @@ setup_snow_render (GstD3D12TestSrc * self, RenderContext * ctx, ComPtr < ID3D12Resource > vertex_index_buf; hr = device->CreateCommittedResource (&heap_prop, D3D12_HEAP_FLAG_CREATE_NOT_ZEROED, - &buffer_desc, D3D12_RESOURCE_STATE_COPY_DEST, nullptr, + &buffer_desc, D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS (&vertex_index_buf)); if (!gst_d3d12_result (hr, self->device)) { GST_ERROR_OBJECT (self, "Couldn't create index buffer"); @@ -938,7 +938,7 @@ setup_smpte_render (GstD3D12TestSrc * self, RenderContext * ctx) ComPtr < ID3D12Resource > vertex_index_buf; hr = device->CreateCommittedResource (&heap_prop, D3D12_HEAP_FLAG_CREATE_NOT_ZEROED, - &buffer_desc, D3D12_RESOURCE_STATE_COPY_DEST, nullptr, + &buffer_desc, D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS (&vertex_index_buf)); if (!gst_d3d12_result (hr, self->device)) { GST_ERROR_OBJECT (self, "Couldn't create index buffer"); @@ -1104,7 +1104,7 @@ setup_checker_render (GstD3D12TestSrc * self, RenderContext * ctx, ComPtr < ID3D12Resource > vertex_index_buf; hr = device->CreateCommittedResource (&heap_prop, D3D12_HEAP_FLAG_CREATE_NOT_ZEROED, - &buffer_desc, D3D12_RESOURCE_STATE_COPY_DEST, nullptr, + &buffer_desc, D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS (&vertex_index_buf)); if (!gst_d3d12_result (hr, self->device)) { GST_ERROR_OBJECT (self, "Couldn't create index buffer");