From: Giovanni Mascellani gmascellani@codeweavers.com
There is no guarantee that a resource is cleared upon creation. This fixes the test on NVIDIA and llvmpipe. --- tests/hlsl_d3d12.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/tests/hlsl_d3d12.c b/tests/hlsl_d3d12.c index b2273ffbc..62ce857d0 100644 --- a/tests/hlsl_d3d12.c +++ b/tests/hlsl_d3d12.c @@ -472,6 +472,11 @@ static void test_thread_id(void) { ID3D12GraphicsCommandList *command_list; struct d3d12_resource_readback rb; + D3D12_RESOURCE_BARRIER barrier = + { + .Type = D3D12_RESOURCE_BARRIER_TYPE_UAV, + .Flags = 0, + }; struct test_context context; ID3D12Resource *textures[3]; ID3D12DescriptorHeap *heap; @@ -516,10 +521,18 @@ 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); + barrier.UAV.pResource = textures[i]; + ID3D12GraphicsCommandList_ResourceBarrier(command_list, 1, &barrier); }
cs_code = compile_shader(cs_source, "cs_5_0");