mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 08:17:01 +00:00
d3d12: Fix resource allocation on old Windows version
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED flag was introduced as of Windows 10 May 2020 Update, and older versions don't understand the heap flag. Checks the feature support and enables the D3D12_HEAP_FLAG_CREATE_NOT_ZEROED only if it's supported by OS Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7573>
This commit is contained in:
parent
df23724b96
commit
2d91521dfc
10 changed files with 103 additions and 46 deletions
|
@ -897,6 +897,10 @@ gst_d3d12_converter_setup_resource (GstD3D12Converter * self,
|
|||
D3D12_RESOURCE_DESC resource_desc;
|
||||
CD3DX12_RANGE range (0, 0);
|
||||
guint8 *data;
|
||||
D3D12_HEAP_FLAGS heap_flags = D3D12_HEAP_FLAG_NONE;
|
||||
if (gst_d3d12_device_non_zeroed_supported (self->device))
|
||||
heap_flags = D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
|
||||
|
||||
{
|
||||
guint vertex_index_size = g_vertex_buf_size + g_index_buf_size;
|
||||
vertex_index_size = GST_ROUND_UP_N (vertex_index_size,
|
||||
|
@ -907,8 +911,7 @@ gst_d3d12_converter_setup_resource (GstD3D12Converter * self,
|
|||
heap_prop = CD3DX12_HEAP_PROPERTIES (D3D12_HEAP_TYPE_DEFAULT);
|
||||
resource_desc =
|
||||
CD3DX12_RESOURCE_DESC::Buffer (vertex_index_size + const_size);
|
||||
hr = device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
hr = device->CreateCommittedResource (&heap_prop, heap_flags,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_COMMON, nullptr,
|
||||
IID_PPV_ARGS (&priv->shader_buf));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
@ -928,8 +931,7 @@ gst_d3d12_converter_setup_resource (GstD3D12Converter * self,
|
|||
|
||||
heap_prop = CD3DX12_HEAP_PROPERTIES (D3D12_HEAP_TYPE_UPLOAD);
|
||||
hr = device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr,
|
||||
heap_flags, &resource_desc, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr,
|
||||
IID_PPV_ARGS (&upload_buf));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't create vertex buffer upload");
|
||||
|
@ -954,8 +956,7 @@ gst_d3d12_converter_setup_resource (GstD3D12Converter * self,
|
|||
GAMMA_LUT_SIZE, 1, 1);
|
||||
|
||||
hr = device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_COPY_DEST, nullptr,
|
||||
heap_flags, &resource_desc, D3D12_RESOURCE_STATE_COPY_DEST, nullptr,
|
||||
IID_PPV_ARGS (&priv->gamma_dec_lut));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't create gamma decoding LUT");
|
||||
|
@ -963,8 +964,7 @@ gst_d3d12_converter_setup_resource (GstD3D12Converter * self,
|
|||
}
|
||||
|
||||
hr = device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_COPY_DEST, nullptr,
|
||||
heap_flags, &resource_desc, D3D12_RESOURCE_STATE_COPY_DEST, nullptr,
|
||||
IID_PPV_ARGS (&priv->gamma_enc_lut));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't create gamma encoding LUT");
|
||||
|
@ -979,8 +979,7 @@ gst_d3d12_converter_setup_resource (GstD3D12Converter * self,
|
|||
resource_desc = CD3DX12_RESOURCE_DESC::Buffer (gamma_lut_size);
|
||||
|
||||
hr = device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr,
|
||||
heap_flags, &resource_desc, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr,
|
||||
IID_PPV_ARGS (&gamma_dec_lut_upload));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't create gamma decoding LUT upload");
|
||||
|
@ -988,8 +987,7 @@ gst_d3d12_converter_setup_resource (GstD3D12Converter * self,
|
|||
}
|
||||
|
||||
hr = device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr,
|
||||
heap_flags, &resource_desc, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr,
|
||||
IID_PPV_ARGS (&gamma_enc_lut_upload));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't create gamma encoding LUT upload");
|
||||
|
|
|
@ -97,5 +97,8 @@ HRESULT gst_d3d12_device_get_sampler_state (GstD3D12Device * device,
|
|||
D3D12_FILTER filter,
|
||||
ID3D12DescriptorHeap ** heap);
|
||||
|
||||
GST_D3D12_API
|
||||
gboolean gst_d3d12_device_non_zeroed_supported (GstD3D12Device * device);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -271,6 +271,7 @@ struct DeviceInner
|
|||
guint vendor_id = 0;
|
||||
std::string description;
|
||||
gint64 adapter_luid = 0;
|
||||
gboolean non_zeroed_supported = FALSE;
|
||||
|
||||
HANDLE dev_removed_monitor_handle = nullptr;
|
||||
HANDLE dev_removed_event;
|
||||
|
@ -1407,6 +1408,16 @@ gst_d3d12_device_new_internal (const GstD3D12DeviceConstructData * data)
|
|||
priv->dev_removed_event, on_device_removed, priv.get (), INFINITE,
|
||||
WT_EXECUTEONLYONCE);
|
||||
|
||||
/* D3D12_HEAP_FLAG_CREATE_NOT_ZEROED was introduced as of Windows 10 May 2020
|
||||
* update, and supported if D3D12_FEATURE_D3D12_OPTIONS7 check is succeeded */
|
||||
{
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS7 options7 = { };
|
||||
hr = device->CheckFeatureSupport (D3D12_FEATURE_D3D12_OPTIONS7, &options7,
|
||||
sizeof (options7));
|
||||
if (SUCCEEDED (hr))
|
||||
priv->non_zeroed_supported = TRUE;
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
error:
|
||||
|
@ -2229,3 +2240,11 @@ gst_d3d12_device_get_sampler_state (GstD3D12Device * device,
|
|||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_d3d12_device_non_zeroed_supported (GstD3D12Device * device)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_DEVICE (device), FALSE);
|
||||
|
||||
return device->priv->inner->non_zeroed_supported;
|
||||
}
|
||||
|
|
|
@ -413,9 +413,12 @@ gst_d3d12_memory_ensure_staging_resource (GstD3D12Memory * dmem)
|
|||
CD3DX12_HEAP_PROPERTIES (D3D12_CPU_PAGE_PROPERTY_WRITE_BACK,
|
||||
D3D12_MEMORY_POOL_L0);
|
||||
D3D12_RESOURCE_DESC desc = CD3DX12_RESOURCE_DESC::Buffer (priv->size);
|
||||
D3D12_HEAP_FLAGS heap_flags = D3D12_HEAP_FLAG_NONE;
|
||||
if (gst_d3d12_device_non_zeroed_supported (dmem->device))
|
||||
heap_flags = D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
|
||||
|
||||
ComPtr < ID3D12Resource > staging;
|
||||
hr = device->CreateCommittedResource (&prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
hr = device->CreateCommittedResource (&prop, heap_flags,
|
||||
&desc, D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS (&staging));
|
||||
if (!gst_d3d12_result (hr, dmem->device)) {
|
||||
GST_ERROR_OBJECT (dmem->device, "Couldn't create staging resource");
|
||||
|
|
|
@ -447,10 +447,12 @@ struct BackgroundRender
|
|||
D3D12_RESOURCE_DESC buffer_desc =
|
||||
CD3DX12_RESOURCE_DESC::Buffer (sizeof (VertexData) * 4 +
|
||||
sizeof (indices));
|
||||
D3D12_HEAP_FLAGS heap_flags = D3D12_HEAP_FLAG_NONE;
|
||||
if (gst_d3d12_device_non_zeroed_supported (device))
|
||||
heap_flags = D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
|
||||
|
||||
hr = device_handle->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED, &buffer_desc,
|
||||
D3D12_RESOURCE_STATE_GENERIC_READ,
|
||||
heap_flags, &buffer_desc, D3D12_RESOURCE_STATE_GENERIC_READ,
|
||||
nullptr, IID_PPV_ARGS (&vertex_index_upload));
|
||||
if (!gst_d3d12_result (hr, device)) {
|
||||
GST_ERROR_OBJECT (device, "Couldn't create vertex upload buf");
|
||||
|
@ -471,7 +473,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,
|
||||
heap_flags, &buffer_desc,
|
||||
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");
|
||||
|
|
|
@ -741,7 +741,10 @@ gst_d3d12_decoder_configure (GstD3D12Decoder * decoder,
|
|||
align.padding_right = session->aligned_width - info->width;
|
||||
align.padding_bottom = session->aligned_height - info->height;
|
||||
|
||||
D3D12_HEAP_FLAGS heap_flags = D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
|
||||
D3D12_HEAP_FLAGS heap_flags = D3D12_HEAP_FLAG_NONE;
|
||||
if (gst_d3d12_device_non_zeroed_supported (decoder->device))
|
||||
heap_flags = D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
|
||||
|
||||
if (!session->reference_only)
|
||||
heap_flags |= D3D12_HEAP_FLAG_SHARED;
|
||||
|
||||
|
@ -775,11 +778,15 @@ gst_d3d12_decoder_configure (GstD3D12Decoder * decoder,
|
|||
session->output_pool = gst_d3d12_buffer_pool_new (decoder->device);
|
||||
config = gst_buffer_pool_get_config (session->output_pool);
|
||||
|
||||
heap_flags = D3D12_HEAP_FLAG_NONE;
|
||||
if (gst_d3d12_device_non_zeroed_supported (decoder->device))
|
||||
heap_flags = D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
|
||||
|
||||
params = gst_d3d12_allocation_params_new (decoder->device, info,
|
||||
GST_D3D12_ALLOCATION_FLAG_DEFAULT,
|
||||
D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS |
|
||||
D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED | D3D12_HEAP_FLAG_SHARED);
|
||||
heap_flags | D3D12_HEAP_FLAG_SHARED);
|
||||
gst_d3d12_allocation_params_alignment (params, &align);
|
||||
gst_buffer_pool_config_set_d3d12_allocation_params (config, params);
|
||||
gst_d3d12_allocation_params_free (params);
|
||||
|
@ -1285,9 +1292,11 @@ gst_d3d12_decoder_ensure_staging_texture (GstD3D12Decoder * self)
|
|||
D3D12_HEAP_PROPERTIES heap_prop = CD3DX12_HEAP_PROPERTIES
|
||||
(D3D12_HEAP_TYPE_READBACK);
|
||||
D3D12_RESOURCE_DESC desc = CD3DX12_RESOURCE_DESC::Buffer (size);
|
||||
D3D12_HEAP_FLAGS heap_flags = D3D12_HEAP_FLAG_NONE;
|
||||
if (gst_d3d12_device_non_zeroed_supported (self->device))
|
||||
heap_flags = D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
|
||||
|
||||
hr = device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
hr = device->CreateCommittedResource (&heap_prop, heap_flags,
|
||||
&desc, D3D12_RESOURCE_STATE_COPY_DEST, nullptr, IID_PPV_ARGS (&staging));
|
||||
if (!gst_d3d12_result (hr, self->device))
|
||||
return FALSE;
|
||||
|
|
|
@ -138,6 +138,7 @@ struct GstD3D12DecoderCpbPoolPrivate
|
|||
UINT64 buffer_id = 0;
|
||||
UINT64 max_alloc_size = 0;
|
||||
guint allocated_ca_size = 0;
|
||||
bool supports_non_zeroed = false;
|
||||
|
||||
std::mutex lock;
|
||||
};
|
||||
|
@ -145,7 +146,6 @@ struct GstD3D12DecoderCpbPoolPrivate
|
|||
struct _GstD3D12DecoderCpbPool
|
||||
{
|
||||
GstObject parent;
|
||||
GstD3D12Device *device;
|
||||
GstD3D12DecoderCpbPoolPrivate *priv;
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
@ -181,7 +181,6 @@ gst_d3d12_decoder_cpb_pool_finalize (GObject * object)
|
|||
auto self = GST_D3D12_DECODER_CPB_POOL (object);
|
||||
|
||||
delete self->priv;
|
||||
gst_clear_object (&self->device);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -198,6 +197,13 @@ gst_d3d12_decoder_cpb_pool_new (ID3D12Device * device)
|
|||
auto priv = self->priv;
|
||||
priv->device = device;
|
||||
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS7 options7 = { };
|
||||
auto hr =
|
||||
device->CheckFeatureSupport (D3D12_FEATURE_D3D12_OPTIONS7, &options7,
|
||||
sizeof (options7));
|
||||
if (SUCCEEDED (hr))
|
||||
priv->supports_non_zeroed = true;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -286,13 +292,17 @@ gst_d3d12_decoder_cpb_pool_acquire (GstD3D12DecoderCpbPool * pool,
|
|||
D3D12_HEAP_PROPERTIES heap_prop =
|
||||
CD3DX12_HEAP_PROPERTIES (D3D12_HEAP_TYPE_UPLOAD);
|
||||
D3D12_RESOURCE_DESC desc = CD3DX12_RESOURCE_DESC::Buffer (alloc_size);
|
||||
D3D12_HEAP_FLAGS heap_flags = D3D12_HEAP_FLAG_NONE;
|
||||
if (priv->supports_non_zeroed)
|
||||
heap_flags = D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
|
||||
|
||||
ComPtr < ID3D12Resource > resource;
|
||||
|
||||
GST_DEBUG_OBJECT (pool, "Allocating new buffer, size %" G_GUINT64_FORMAT,
|
||||
alloc_size);
|
||||
|
||||
auto hr = priv->device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED, &desc,
|
||||
heap_flags, &desc,
|
||||
D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, IID_PPV_ARGS (&resource));
|
||||
if (FAILED (hr)) {
|
||||
GST_ERROR_OBJECT (pool, "Couldn't allocate upload resource");
|
||||
|
|
|
@ -37,7 +37,7 @@ GstD3D12DecoderCpbPool * gst_d3d12_decoder_cpb_pool_new (ID3D12Device * device);
|
|||
HRESULT gst_d3d12_decoder_cpb_pool_acquire (GstD3D12DecoderCpbPool * pool,
|
||||
gpointer data,
|
||||
gsize size,
|
||||
GstD3D12DecoderCpb ** cpb);
|
||||
GstD3D12DecoderCpb ** cpb);
|
||||
|
||||
GstD3D12DecoderCpb * gst_d3d12_decoder_cpb_ref (GstD3D12DecoderCpb * cpb);
|
||||
|
||||
|
|
|
@ -215,6 +215,10 @@ gst_d3d12_overlay_rect_new (GstD3D12OverlayCompositor * self,
|
|||
|
||||
ComPtr < ID3D12Resource > staging;
|
||||
D3D12_PLACED_SUBRESOURCE_FOOTPRINT layout;
|
||||
D3D12_HEAP_FLAGS heap_flags = D3D12_HEAP_FLAG_NONE;
|
||||
if (gst_d3d12_device_non_zeroed_supported (self->device))
|
||||
heap_flags = D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
|
||||
|
||||
if (!is_d3d12) {
|
||||
auto vmeta = gst_buffer_get_video_meta (buf);
|
||||
|
||||
|
@ -229,8 +233,7 @@ gst_d3d12_overlay_rect_new (GstD3D12OverlayCompositor * self,
|
|||
CD3DX12_RESOURCE_DESC::Tex2D (DXGI_FORMAT_B8G8R8A8_UNORM, vmeta->width,
|
||||
vmeta->height, 1, 1);
|
||||
|
||||
auto hr = device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
auto hr = device->CreateCommittedResource (&heap_prop, heap_flags,
|
||||
&desc, D3D12_RESOURCE_STATE_COPY_DEST, nullptr,
|
||||
IID_PPV_ARGS (&texture));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
@ -244,8 +247,7 @@ gst_d3d12_overlay_rect_new (GstD3D12OverlayCompositor * self,
|
|||
|
||||
heap_prop = CD3DX12_HEAP_PROPERTIES (D3D12_HEAP_TYPE_UPLOAD);
|
||||
desc = CD3DX12_RESOURCE_DESC::Buffer (size);
|
||||
hr = device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
hr = device->CreateCommittedResource (&heap_prop, heap_flags,
|
||||
&desc, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr,
|
||||
IID_PPV_ARGS (&staging));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
@ -333,8 +335,7 @@ gst_d3d12_overlay_rect_new (GstD3D12OverlayCompositor * self,
|
|||
CD3DX12_HEAP_PROPERTIES (D3D12_HEAP_TYPE_UPLOAD);
|
||||
D3D12_RESOURCE_DESC desc =
|
||||
CD3DX12_RESOURCE_DESC::Buffer (sizeof (VertexData) * 4);
|
||||
auto hr = device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
auto hr = device->CreateCommittedResource (&heap_prop, heap_flags,
|
||||
&desc, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr,
|
||||
IID_PPV_ARGS (&vertex_buf));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
@ -547,9 +548,12 @@ gst_d3d12_overlay_compositor_setup_shader (GstD3D12OverlayCompositor * self)
|
|||
CD3DX12_HEAP_PROPERTIES (D3D12_HEAP_TYPE_UPLOAD);
|
||||
D3D12_RESOURCE_DESC buffer_desc =
|
||||
CD3DX12_RESOURCE_DESC::Buffer (sizeof (indices));
|
||||
D3D12_HEAP_FLAGS heap_flags = D3D12_HEAP_FLAG_NONE;
|
||||
if (gst_d3d12_device_non_zeroed_supported (self->device))
|
||||
heap_flags = D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
|
||||
|
||||
ComPtr < ID3D12Resource > index_buf;
|
||||
hr = device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
hr = device->CreateCommittedResource (&heap_prop, heap_flags,
|
||||
&buffer_desc, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr,
|
||||
IID_PPV_ARGS (&index_buf));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
|
|
@ -547,9 +547,12 @@ setup_snow_render (GstD3D12TestSrc * self, RenderContext * ctx,
|
|||
D3D12_RESOURCE_DESC buffer_desc =
|
||||
CD3DX12_RESOURCE_DESC::Buffer (sizeof (UvVertexData) * 4
|
||||
+ sizeof (indices));
|
||||
D3D12_HEAP_FLAGS heap_flags = D3D12_HEAP_FLAG_NONE;
|
||||
if (gst_d3d12_device_non_zeroed_supported (self->device))
|
||||
heap_flags = D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
|
||||
|
||||
ComPtr < ID3D12Resource > vertex_index_upload;
|
||||
hr = device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
hr = device->CreateCommittedResource (&heap_prop, heap_flags,
|
||||
&buffer_desc, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr,
|
||||
IID_PPV_ARGS (&vertex_index_upload));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
@ -571,8 +574,7 @@ setup_snow_render (GstD3D12TestSrc * self, RenderContext * ctx,
|
|||
|
||||
heap_prop = CD3DX12_HEAP_PROPERTIES (D3D12_HEAP_TYPE_DEFAULT);
|
||||
ComPtr < ID3D12Resource > vertex_index_buf;
|
||||
hr = device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
hr = device->CreateCommittedResource (&heap_prop, heap_flags,
|
||||
&buffer_desc, D3D12_RESOURCE_STATE_COMMON, nullptr,
|
||||
IID_PPV_ARGS (&vertex_index_buf));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
@ -938,9 +940,12 @@ setup_smpte_render (GstD3D12TestSrc * self, RenderContext * ctx)
|
|||
D3D12_RESOURCE_DESC buffer_desc =
|
||||
CD3DX12_RESOURCE_DESC::Buffer (sizeof (ColorVertexData) * 4 * 20
|
||||
+ sizeof (WORD) * 6 * 20);
|
||||
D3D12_HEAP_FLAGS heap_flags = D3D12_HEAP_FLAG_NONE;
|
||||
if (gst_d3d12_device_non_zeroed_supported (self->device))
|
||||
heap_flags = D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
|
||||
|
||||
ComPtr < ID3D12Resource > vertex_index_upload;
|
||||
hr = device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
hr = device->CreateCommittedResource (&heap_prop, heap_flags,
|
||||
&buffer_desc, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr,
|
||||
IID_PPV_ARGS (&vertex_index_upload));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
@ -963,8 +968,7 @@ setup_smpte_render (GstD3D12TestSrc * self, RenderContext * ctx)
|
|||
|
||||
heap_prop = CD3DX12_HEAP_PROPERTIES (D3D12_HEAP_TYPE_DEFAULT);
|
||||
ComPtr < ID3D12Resource > vertex_index_buf;
|
||||
hr = device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
hr = device->CreateCommittedResource (&heap_prop, heap_flags,
|
||||
&buffer_desc, D3D12_RESOURCE_STATE_COMMON, nullptr,
|
||||
IID_PPV_ARGS (&vertex_index_buf));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
@ -1119,9 +1123,12 @@ setup_checker_render (GstD3D12TestSrc * self, RenderContext * ctx,
|
|||
D3D12_RESOURCE_DESC buffer_desc =
|
||||
CD3DX12_RESOURCE_DESC::Buffer (sizeof (UvVertexData) * 4
|
||||
+ sizeof (indices));
|
||||
D3D12_HEAP_FLAGS heap_flags = D3D12_HEAP_FLAG_NONE;
|
||||
if (gst_d3d12_device_non_zeroed_supported (self->device))
|
||||
heap_flags = D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
|
||||
|
||||
ComPtr < ID3D12Resource > vertex_index_upload;
|
||||
hr = device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
hr = device->CreateCommittedResource (&heap_prop, heap_flags,
|
||||
&buffer_desc, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr,
|
||||
IID_PPV_ARGS (&vertex_index_upload));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
@ -1143,8 +1150,7 @@ setup_checker_render (GstD3D12TestSrc * self, RenderContext * ctx,
|
|||
|
||||
heap_prop = CD3DX12_HEAP_PROPERTIES (D3D12_HEAP_TYPE_DEFAULT);
|
||||
ComPtr < ID3D12Resource > vertex_index_buf;
|
||||
hr = device->CreateCommittedResource (&heap_prop,
|
||||
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED,
|
||||
hr = device->CreateCommittedResource (&heap_prop, heap_flags,
|
||||
&buffer_desc, D3D12_RESOURCE_STATE_COMMON, nullptr,
|
||||
IID_PPV_ARGS (&vertex_index_buf));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
@ -1611,7 +1617,10 @@ gst_d3d12_test_src_setup_context (GstD3D12TestSrc * self, GstCaps * caps)
|
|||
D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET |
|
||||
D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS);
|
||||
D3D12_CLEAR_VALUE clear_value = { };
|
||||
D3D12_HEAP_FLAGS heap_flags = D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
|
||||
D3D12_HEAP_FLAGS heap_flags = D3D12_HEAP_FLAG_NONE;
|
||||
if (gst_d3d12_device_non_zeroed_supported (self->device))
|
||||
heap_flags = D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
|
||||
|
||||
clear_value.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
clear_value.Color[0] = 0.0f;
|
||||
clear_value.Color[1] = 0.0f;
|
||||
|
|
Loading…
Reference in a new issue