tests: Clear the UAV before testing.

There is no guarantee that a resource is cleared upon creation. This
fixes the test on NVIDIA and llvmpipe.
This commit is contained in:
Giovanni Mascellani 2024-03-08 23:38:21 +01:00 committed by Alexandre Julliard
parent 5e43f99809
commit dff22c9ed7
Notes: Alexandre Julliard 2024-03-11 23:07:26 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/700
3 changed files with 18 additions and 11 deletions

View File

@ -128,17 +128,6 @@ static void check_alignment_(unsigned int line, uint64_t size, uint64_t alignmen
size, aligned_size); 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[] = static const DXGI_FORMAT depth_stencil_formats[] =
{ {
DXGI_FORMAT_R32G8X24_TYPELESS, DXGI_FORMAT_R32G8X24_TYPELESS,

View File

@ -269,6 +269,17 @@ static void transition_sub_resource_state(ID3D12GraphicsCommandList *list, ID3D1
ID3D12GraphicsCommandList_ResourceBarrier(list, 1, &barrier); 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) #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, static inline ID3D12CommandQueue *create_command_queue_(unsigned int line, ID3D12Device *device,
D3D12_COMMAND_LIST_TYPE type, int priority) D3D12_COMMAND_LIST_TYPE type, int priority)

View File

@ -516,10 +516,17 @@ static void test_thread_id(void)
for (i = 0; i < 3; ++i) 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, 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); D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
ID3D12Device_CreateUnorderedAccessView(device, textures[i], NULL, NULL, ID3D12Device_CreateUnorderedAccessView(device, textures[i], NULL, NULL,
get_cpu_descriptor_handle(&context, heap, i)); 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"); cs_code = compile_shader(cs_source, "cs_5_0");