mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
tests: Test ClearUnorderedAccessView() with placed resources.
Catches certain implementation issues which committed resources do not. Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6c65f1b814
commit
1b66138006
@ -4688,11 +4688,14 @@ static void test_clear_unordered_access_view(void)
|
||||
struct test_context context;
|
||||
struct resource_readback rb;
|
||||
ID3D12CommandQueue *queue;
|
||||
D3D12_HEAP_DESC heap_desc;
|
||||
ID3D12Resource *buffer;
|
||||
ID3D12Device *device;
|
||||
UINT clear_value[4];
|
||||
unsigned int i, j;
|
||||
ID3D12Heap *heap;
|
||||
D3D12_BOX box;
|
||||
HRESULT hr;
|
||||
|
||||
#define BUFFER_SIZE (1024 * 1024)
|
||||
static const struct
|
||||
@ -4749,11 +4752,19 @@ static void test_clear_unordered_access_view(void)
|
||||
cpu_heap = create_cpu_descriptor_heap(device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 2);
|
||||
gpu_heap = create_gpu_descriptor_heap(device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 2);
|
||||
|
||||
heap_desc.SizeInBytes = 2 * BUFFER_SIZE;
|
||||
memset(&heap_desc.Properties, 0, sizeof(heap_desc.Properties));
|
||||
heap_desc.Properties.Type = D3D12_HEAP_TYPE_DEFAULT;
|
||||
heap_desc.Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
|
||||
heap_desc.Flags = D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS;
|
||||
hr = ID3D12Device_CreateHeap(device, &heap_desc, &IID_ID3D12Heap, (void **)&heap);
|
||||
ok(hr == S_OK, "Failed to create heap, hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(tests); ++i)
|
||||
{
|
||||
vkd3d_test_set_context("Test %u", i);
|
||||
|
||||
buffer = create_default_buffer(device, BUFFER_SIZE,
|
||||
buffer = create_placed_buffer(device, heap, BUFFER_SIZE, BUFFER_SIZE,
|
||||
D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
|
||||
|
||||
for (j = 0; j < ARRAY_SIZE(clear_value); ++j)
|
||||
@ -4810,6 +4821,7 @@ static void test_clear_unordered_access_view(void)
|
||||
|
||||
ID3D12DescriptorHeap_Release(cpu_heap);
|
||||
ID3D12DescriptorHeap_Release(gpu_heap);
|
||||
ID3D12Heap_Release(heap);
|
||||
destroy_test_context(&context);
|
||||
#undef BUFFER_SIZE
|
||||
}
|
||||
|
@ -111,6 +111,33 @@ static inline void queue_wait_(unsigned int line, ID3D12CommandQueue *queue, ID3
|
||||
ok_(line)(hr == S_OK, "Failed to submit wait operation to queue, hr %#x.\n", hr);
|
||||
}
|
||||
|
||||
#define create_placed_buffer(a, b, c, d, e, f) create_placed_buffer_(__LINE__, a, b, c, d, e, f)
|
||||
static inline ID3D12Resource *create_placed_buffer_(unsigned int line, ID3D12Device *device,
|
||||
ID3D12Heap *heap, size_t offset, size_t size, D3D12_RESOURCE_FLAGS resource_flags,
|
||||
D3D12_RESOURCE_STATES initial_resource_state)
|
||||
{
|
||||
D3D12_RESOURCE_DESC resource_desc;
|
||||
ID3D12Resource *buffer;
|
||||
HRESULT hr;
|
||||
|
||||
resource_desc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
|
||||
resource_desc.Alignment = 0;
|
||||
resource_desc.Width = size;
|
||||
resource_desc.Height = 1;
|
||||
resource_desc.DepthOrArraySize = 1;
|
||||
resource_desc.MipLevels = 1;
|
||||
resource_desc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
resource_desc.SampleDesc.Count = 1;
|
||||
resource_desc.SampleDesc.Quality = 0;
|
||||
resource_desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
|
||||
resource_desc.Flags = resource_flags;
|
||||
|
||||
hr = ID3D12Device_CreatePlacedResource(device, heap, offset, &resource_desc,
|
||||
initial_resource_state, NULL, &IID_ID3D12Resource, (void **)&buffer);
|
||||
assert_that_(line)(SUCCEEDED(hr), "Failed to create buffer, hr %#x.\n", hr);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
#define create_buffer(a, b, c, d, e) create_buffer_(__LINE__, a, b, c, d, e)
|
||||
static ID3D12Resource *create_buffer_(unsigned int line, ID3D12Device *device,
|
||||
D3D12_HEAP_TYPE heap_type, size_t size, D3D12_RESOURCE_FLAGS resource_flags,
|
||||
|
Loading…
Reference in New Issue
Block a user