mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d/tests: Add tests for ID3D12GraphicsCommandList2::WriteBufferImmediate().
Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9c64642468
commit
0d43c776c5
@ -177,6 +177,13 @@ typedef enum D3D12_FORMAT_SUPPORT2
|
||||
D3D12_FORMAT_SUPPORT2_MULTIPLANE_OVERLAY = 0x00004000,
|
||||
} D3D12_FORMAT_SUPPORT2;
|
||||
|
||||
typedef enum D3D12_WRITEBUFFERIMMEDIATE_MODE
|
||||
{
|
||||
D3D12_WRITEBUFFERIMMEDIATE_MODE_DEFAULT = 0x0,
|
||||
D3D12_WRITEBUFFERIMMEDIATE_MODE_MARKER_IN = 0x1,
|
||||
D3D12_WRITEBUFFERIMMEDIATE_MODE_MARKER_OUT = 0x2,
|
||||
} D3D12_WRITEBUFFERIMMEDIATE_MODE;
|
||||
|
||||
interface ID3D12Fence;
|
||||
interface ID3D12RootSignature;
|
||||
interface ID3D12Heap;
|
||||
@ -1657,6 +1664,12 @@ typedef enum D3D12_RESIDENCY_PRIORITY
|
||||
D3D12_RESIDENCY_PRIORITY_MAXIMUM = 0xc8000000,
|
||||
} D3D12_RESIDENCY_PRIORITY;
|
||||
|
||||
typedef struct D3D12_WRITEBUFFERIMMEDIATE_PARAMETER
|
||||
{
|
||||
D3D12_GPU_VIRTUAL_ADDRESS Dest;
|
||||
UINT32 Value;
|
||||
} D3D12_WRITEBUFFERIMMEDIATE_PARAMETER;
|
||||
|
||||
[
|
||||
uuid(c4fec28f-7966-4e95-9f94-f431cb56c3b8),
|
||||
object,
|
||||
@ -2004,6 +2017,19 @@ interface ID3D12GraphicsCommandList1 : ID3D12GraphicsCommandList
|
||||
void SetViewInstanceMask(UINT mask);
|
||||
}
|
||||
|
||||
[
|
||||
uuid(38c3e585-ff17-412c-9150-4fc6f9d72a28),
|
||||
object,
|
||||
local,
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface ID3D12GraphicsCommandList2 : ID3D12GraphicsCommandList1
|
||||
{
|
||||
void WriteBufferImmediate(UINT count,
|
||||
const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *parameters,
|
||||
const D3D12_WRITEBUFFERIMMEDIATE_MODE *modes);
|
||||
}
|
||||
|
||||
typedef enum D3D12_TILE_RANGE_FLAGS
|
||||
{
|
||||
D3D12_TILE_RANGE_FLAG_NONE = 0x0,
|
||||
|
@ -32728,6 +32728,89 @@ static void test_bufinfo_instruction(void)
|
||||
destroy_test_context(&context);
|
||||
}
|
||||
|
||||
static void test_write_buffer_immediate(void)
|
||||
{
|
||||
D3D12_WRITEBUFFERIMMEDIATE_PARAMETER parameters[2];
|
||||
ID3D12GraphicsCommandList2 *command_list2;
|
||||
D3D12_WRITEBUFFERIMMEDIATE_MODE modes[2];
|
||||
ID3D12GraphicsCommandList *command_list;
|
||||
struct resource_readback rb;
|
||||
struct test_context context;
|
||||
ID3D12CommandQueue *queue;
|
||||
ID3D12Resource *buffer;
|
||||
ID3D12Device *device;
|
||||
unsigned int value;
|
||||
HRESULT hr;
|
||||
|
||||
static const unsigned int data_values[] = {0xdeadbeef, 0xf00baa};
|
||||
|
||||
if (!init_test_context(&context, NULL))
|
||||
return;
|
||||
device = context.device;
|
||||
command_list = context.list;
|
||||
queue = context.queue;
|
||||
|
||||
if (FAILED(hr = ID3D12GraphicsCommandList_QueryInterface(command_list,
|
||||
&IID_ID3D12GraphicsCommandList2, (void **)&command_list2)))
|
||||
{
|
||||
skip("ID3D12GraphicsCommandList2 not implemented.\n");
|
||||
destroy_test_context(&context);
|
||||
return;
|
||||
}
|
||||
|
||||
buffer = create_default_buffer(device, sizeof(data_values),
|
||||
D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COPY_DEST);
|
||||
upload_buffer_data(buffer, 0, sizeof(data_values), data_values, queue, command_list);
|
||||
reset_command_list(command_list, context.allocator);
|
||||
|
||||
parameters[0].Dest = ID3D12Resource_GetGPUVirtualAddress(buffer);
|
||||
parameters[0].Value = 0x1020304;
|
||||
parameters[1].Dest = parameters[0].Dest + sizeof(data_values[0]);
|
||||
parameters[1].Value = 0xc0d0e0f;
|
||||
ID3D12GraphicsCommandList2_WriteBufferImmediate(command_list2, ARRAY_SIZE(parameters), parameters, NULL);
|
||||
hr = ID3D12GraphicsCommandList_Close(command_list);
|
||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
exec_command_list(queue, command_list);
|
||||
wait_queue_idle(device, queue);
|
||||
reset_command_list(command_list, context.allocator);
|
||||
|
||||
get_buffer_readback_with_command_list(buffer, DXGI_FORMAT_R32_UINT, &rb, queue, command_list);
|
||||
value = get_readback_uint(&rb, 0, 0, 0);
|
||||
ok(value == parameters[0].Value, "Got unexpected value %#x, expected %#x.\n", value, parameters[0].Value);
|
||||
value = get_readback_uint(&rb, 1, 0, 0);
|
||||
ok(value == parameters[1].Value, "Got unexpected value %#x, expected %#x.\n", value, parameters[1].Value);
|
||||
release_resource_readback(&rb);
|
||||
reset_command_list(command_list, context.allocator);
|
||||
|
||||
parameters[0].Value = 0x2030405;
|
||||
parameters[1].Value = 0xb0c0d0e;
|
||||
modes[0] = D3D12_WRITEBUFFERIMMEDIATE_MODE_MARKER_IN;
|
||||
modes[1] = D3D12_WRITEBUFFERIMMEDIATE_MODE_MARKER_OUT;
|
||||
ID3D12GraphicsCommandList2_WriteBufferImmediate(command_list2, ARRAY_SIZE(parameters), parameters, modes);
|
||||
hr = ID3D12GraphicsCommandList_Close(command_list);
|
||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
exec_command_list(queue, command_list);
|
||||
wait_queue_idle(device, queue);
|
||||
reset_command_list(command_list, context.allocator);
|
||||
|
||||
get_buffer_readback_with_command_list(buffer, DXGI_FORMAT_R32_UINT, &rb, queue, command_list);
|
||||
value = get_readback_uint(&rb, 0, 0, 0);
|
||||
ok(value == parameters[0].Value, "Got unexpected value %#x, expected %#x.\n", value, parameters[0].Value);
|
||||
value = get_readback_uint(&rb, 1, 0, 0);
|
||||
ok(value == parameters[1].Value, "Got unexpected value %#x, expected %#x.\n", value, parameters[1].Value);
|
||||
release_resource_readback(&rb);
|
||||
reset_command_list(command_list, context.allocator);
|
||||
|
||||
modes[0] = 0x7fffffff;
|
||||
ID3D12GraphicsCommandList2_WriteBufferImmediate(command_list2, ARRAY_SIZE(parameters), parameters, modes);
|
||||
hr = ID3D12GraphicsCommandList_Close(command_list);
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
ID3D12Resource_Release(buffer);
|
||||
ID3D12GraphicsCommandList2_Release(command_list2);
|
||||
destroy_test_context(&context);
|
||||
}
|
||||
|
||||
START_TEST(d3d12)
|
||||
{
|
||||
parse_args(argc, argv);
|
||||
@ -32891,4 +32974,5 @@ START_TEST(d3d12)
|
||||
run_test(test_early_depth_stencil_tests);
|
||||
run_test(test_conditional_rendering);
|
||||
run_test(test_bufinfo_instruction);
|
||||
run_test(test_write_buffer_immediate);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user