From 6e50aaf11f256242d924c0bff61468f17bac0bbb Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Wed, 13 Jan 2021 16:03:21 +0100 Subject: [PATCH] tests: Modify typed_as_untyped test to test copies. Verifies that copying multiple descriptors works as expected. Signed-off-by: Hans-Kristian Arntzen --- tests/d3d12.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/d3d12.c b/tests/d3d12.c index c172a8b6..08ffb39a 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -47277,6 +47277,7 @@ static void test_undefined_read_typed_buffer_as_untyped(bool use_dxil) D3D12_ROOT_SIGNATURE_DESC root_signature_desc; D3D12_ROOT_PARAMETER root_parameters[1]; D3D12_DESCRIPTOR_RANGE descriptor_ranges[1]; + ID3D12DescriptorHeap *cpu_heap; ID3D12DescriptorHeap *heap; ID3D12Resource *output_buffer; @@ -47429,8 +47430,9 @@ static void test_undefined_read_typed_buffer_as_untyped(bool use_dxil) shader_bytecode(use_dxil ? (const void *)cs_code_dxil : (const void *)cs_code_dxbc, use_dxil ? sizeof(cs_code_dxil) : sizeof(cs_code_dxbc))); + cpu_heap = create_cpu_descriptor_heap(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 64); heap = create_gpu_descriptor_heap(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 64); - cpu_handle = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(heap); + cpu_handle = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(cpu_heap); gpu_handle = ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(heap); descriptor_size = ID3D12Device_GetDescriptorHandleIncrementSize(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); @@ -47451,6 +47453,10 @@ static void test_undefined_read_typed_buffer_as_untyped(bool use_dxil) ID3D12Device_CreateUnorderedAccessView(context.device, output_buffer, NULL, &view, h); } + ID3D12Device_CopyDescriptorsSimple(context.device, 64, + ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(heap), cpu_handle, + D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + ID3D12GraphicsCommandList_SetComputeRootSignature(command_list, context.root_signature); ID3D12GraphicsCommandList_SetPipelineState(command_list, context.pipeline_state); ID3D12GraphicsCommandList_SetDescriptorHeaps(command_list, 1, &heap); @@ -47471,6 +47477,7 @@ static void test_undefined_read_typed_buffer_as_untyped(bool use_dxil) reset_command_list(command_list, context.allocator); ID3D12Resource_Release(output_buffer); + ID3D12DescriptorHeap_Release(cpu_heap); ID3D12DescriptorHeap_Release(heap); destroy_test_context(&context); }