Skip to content

Commit

Permalink
tests: Fix cpu handle of descriptor heap used in ClearUnorderedAccess…
Browse files Browse the repository at this point in the history
…View
  • Loading branch information
Liu, Mengyang authored and HansKristian-Work committed Sep 13, 2024
1 parent 26d283c commit b73d5b0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 7 additions & 3 deletions tests/d3d12_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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;
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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);

Expand Down
8 changes: 6 additions & 2 deletions tests/d3d12_sm_advanced.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit b73d5b0

Please sign in to comment.