From b73d5b073d9765ae9eeb0d67d7c977edc3a93d02 Mon Sep 17 00:00:00 2001 From: "Liu, Mengyang" Date: Fri, 13 Sep 2024 16:56:20 +0800 Subject: [PATCH] tests: Fix cpu handle of descriptor heap used in ClearUnorderedAccessView --- tests/d3d12_resource.c | 10 +++++++--- tests/d3d12_sm_advanced.c | 8 ++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/d3d12_resource.c b/tests/d3d12_resource.c index 0cf095f487..e2f85f09ec 100644 --- a/tests/d3d12_resource.c +++ b/tests/d3d12_resource.c @@ -3598,6 +3598,7 @@ static void check_video_format_subresource_(unsigned int line, struct resource_r void test_planar_video_formats(void) { #define MAX_PLANES 2 + ID3D12DescriptorHeap *rtv_heap, *srv_uav_heap, *srv_uav_cpu_heap; D3D12_PLACED_SUBRESOURCE_FOOTPRINT footprints[MAX_PLANES]; D3D12_TEXTURE_COPY_LOCATION src_location, dst_location; UINT64 row_sizes[MAX_PLANES], total_sizes[MAX_PLANES]; @@ -3606,7 +3607,6 @@ void test_planar_video_formats(void) D3D12_FEATURE_DATA_FORMAT_SUPPORT format_support; unsigned int subsample_x_log2, subsample_y_log2; ID3D12PipelineState *graphics_psos[MAX_PLANES]; - ID3D12DescriptorHeap *rtv_heap, *srv_uav_heap; D3D12_DESCRIPTOR_RANGE descriptor_ranges[2]; D3D12_FEATURE_DATA_FORMAT_INFO format_info; D3D12_UNORDERED_ACCESS_VIEW_DESC uav_desc; @@ -3773,6 +3773,7 @@ void test_planar_video_formats(void) rtv = get_cpu_descriptor_handle(&context, rtv_heap, 0); srv_uav_heap = create_gpu_descriptor_heap(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, MAX_PLANES * 2); + srv_uav_cpu_heap = create_cpu_descriptor_heap(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, MAX_PLANES * 2); memset(&scissor, 0, sizeof(scissor)); memset(&viewport, 0, sizeof(viewport)); @@ -4263,6 +4264,8 @@ void test_planar_video_formats(void) ID3D12Device_CreateUnorderedAccessView(context.device, resources[1], NULL, &uav_desc, get_cpu_descriptor_handle(&context, srv_uav_heap, 2 * j + 1)); + ID3D12Device_CreateUnorderedAccessView(context.device, resources[1], NULL, &uav_desc, + get_cpu_descriptor_handle(&context, srv_uav_cpu_heap, 2 * j + 1)); ID3D12GraphicsCommandList_SetDescriptorHeaps(context.list, 1, &srv_uav_heap); ID3D12GraphicsCommandList_SetComputeRootSignature(context.list, context.root_signature); @@ -4285,7 +4288,7 @@ void test_planar_video_formats(void) ID3D12GraphicsCommandList_ClearUnorderedAccessViewFloat(context.list, get_gpu_descriptor_handle(&context, srv_uav_heap, 2 * j + 1), - get_cpu_descriptor_handle(&context, srv_uav_heap, 2 * j + 1), + get_cpu_descriptor_handle(&context, srv_uav_cpu_heap, 2 * j + 1), resources[1], clear_color, 0, NULL); transition_sub_resource_state(context.list, resources[1], j, @@ -4302,7 +4305,7 @@ void test_planar_video_formats(void) ID3D12GraphicsCommandList_ClearUnorderedAccessViewUint(context.list, get_gpu_descriptor_handle(&context, srv_uav_heap, 2 * j + 1), - get_cpu_descriptor_handle(&context, srv_uav_heap, 2 * j + 1), + get_cpu_descriptor_handle(&context, srv_uav_cpu_heap, 2 * j + 1), resources[1], clear_color_uint, 0, NULL); transition_sub_resource_state(context.list, resources[1], j, @@ -4364,6 +4367,7 @@ void test_planar_video_formats(void) ID3D12DescriptorHeap_Release(rtv_heap); ID3D12DescriptorHeap_Release(srv_uav_heap); + ID3D12DescriptorHeap_Release(srv_uav_cpu_heap); ID3D12PipelineState_Release(compute_pso); diff --git a/tests/d3d12_sm_advanced.c b/tests/d3d12_sm_advanced.c index 52ddb09b3e..c01f0624dc 100644 --- a/tests/d3d12_sm_advanced.c +++ b/tests/d3d12_sm_advanced.c @@ -3995,6 +3995,7 @@ void test_sm67_integer_sampling(void) void test_sm68_draw_parameters(void) { ID3D12CommandSignature *simple_sig, *complex_sig; + ID3D12DescriptorHeap *uav_heap, *uav_cpu_heap; D3D12_FEATURE_DATA_D3D12_OPTIONS21 options21; D3D12_FEATURE_DATA_SHADER_MODEL shader_model; D3D12_GRAPHICS_PIPELINE_STATE_DESC pso_desc; @@ -4007,7 +4008,6 @@ void test_sm68_draw_parameters(void) D3D12_ROOT_SIGNATURE_DESC rs_desc; D3D12_RESOURCE_DESC resource_desc; ID3D12Resource *uav, *draw_buffer; - ID3D12DescriptorHeap *uav_heap; struct resource_readback rb; struct test_context context; D3D12_VIEWPORT viewport; @@ -4138,6 +4138,7 @@ void test_sm68_draw_parameters(void) ok(hr == S_OK, "Failed to create UAV buffer, hr %#x.\n", hr); uav_heap = create_gpu_descriptor_heap(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 1); + uav_cpu_heap = create_cpu_descriptor_heap(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 1); memset(&uav_desc, 0, sizeof(uav_desc)); uav_desc.ViewDimension = D3D12_UAV_DIMENSION_BUFFER; @@ -4146,6 +4147,8 @@ void test_sm68_draw_parameters(void) ID3D12Device_CreateUnorderedAccessView(context.device, uav, NULL, &uav_desc, ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(uav_heap)); + ID3D12Device_CreateUnorderedAccessView(context.device, uav, NULL, &uav_desc, + ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(uav_cpu_heap)); heap_properties.Type = D3D12_HEAP_TYPE_CUSTOM; heap_properties.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE; @@ -4179,7 +4182,7 @@ void test_sm68_draw_parameters(void) ID3D12GraphicsCommandList_ClearUnorderedAccessViewUint(context.list, ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(uav_heap), - ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(uav_heap), + ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(uav_cpu_heap), uav, zero_uint, 0, NULL); uav_barrier(context.list, uav); @@ -4250,6 +4253,7 @@ void test_sm68_draw_parameters(void) ID3D12CommandSignature_Release(complex_sig); ID3D12DescriptorHeap_Release(uav_heap); + ID3D12DescriptorHeap_Release(uav_cpu_heap); destroy_test_context(&context); }