diff --git a/tests/d3d12.c b/tests/d3d12.c index 7655c4e9..e3771b7f 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -128,17 +128,6 @@ static void check_alignment_(unsigned int line, uint64_t size, uint64_t alignmen size, aligned_size); } -static void uav_barrier(ID3D12GraphicsCommandList *list, ID3D12Resource *resource) -{ - D3D12_RESOURCE_BARRIER barrier; - - barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV; - barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE; - barrier.UAV.pResource = resource; - - ID3D12GraphicsCommandList_ResourceBarrier(list, 1, &barrier); -} - static const DXGI_FORMAT depth_stencil_formats[] = { DXGI_FORMAT_R32G8X24_TYPELESS, diff --git a/tests/d3d12_test_utils.h b/tests/d3d12_test_utils.h index cf27b40f..4fe6fa71 100644 --- a/tests/d3d12_test_utils.h +++ b/tests/d3d12_test_utils.h @@ -269,6 +269,17 @@ static void transition_sub_resource_state(ID3D12GraphicsCommandList *list, ID3D1 ID3D12GraphicsCommandList_ResourceBarrier(list, 1, &barrier); } +static inline void uav_barrier(ID3D12GraphicsCommandList *list, ID3D12Resource *resource) +{ + D3D12_RESOURCE_BARRIER barrier; + + barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV; + barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE; + barrier.UAV.pResource = resource; + + ID3D12GraphicsCommandList_ResourceBarrier(list, 1, &barrier); +} + #define create_command_queue(a, b, c) create_command_queue_(__LINE__, a, b, c) static inline ID3D12CommandQueue *create_command_queue_(unsigned int line, ID3D12Device *device, D3D12_COMMAND_LIST_TYPE type, int priority) diff --git a/tests/hlsl_d3d12.c b/tests/hlsl_d3d12.c index b2273ffb..4188d720 100644 --- a/tests/hlsl_d3d12.c +++ b/tests/hlsl_d3d12.c @@ -516,10 +516,17 @@ static void test_thread_id(void) for (i = 0; i < 3; ++i) { + const UINT clear_value[4] = {0}; + textures[i] = create_default_texture3d(device, 16, 8, 8, 1, DXGI_FORMAT_R32G32B32A32_UINT, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_UNORDERED_ACCESS); ID3D12Device_CreateUnorderedAccessView(device, textures[i], NULL, NULL, get_cpu_descriptor_handle(&context, heap, i)); + ID3D12GraphicsCommandList_ClearUnorderedAccessViewUint(command_list, + get_gpu_descriptor_handle(&context, heap, i), + get_cpu_descriptor_handle(&context, heap, i), + textures[i], clear_value, 0, NULL); + uav_barrier(command_list, textures[i]); } cs_code = compile_shader(cs_source, "cs_5_0");