From aa341b42d76facbdc1f03b6a8f209e4f277e56ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Thu, 27 Jun 2019 14:26:21 +0200 Subject: [PATCH] tests: Add more tests for predicated rendering. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- tests/d3d12.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/tests/d3d12.c b/tests/d3d12.c index 1eec9222..2e4daf56 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -30883,6 +30883,7 @@ static void prepare_instanced_draw(struct test_context *context) static void test_conditional_rendering(void) { D3D12_ROOT_SIGNATURE_DESC root_signature_desc; + ID3D12Resource *conditions, *upload_buffer; ID3D12CommandSignature *command_signature; ID3D12GraphicsCommandList *command_list; D3D12_ROOT_PARAMETER root_parameters[2]; @@ -30895,7 +30896,6 @@ static void test_conditional_rendering(void) struct test_context context; ID3D12Resource *buffer, *cb; struct resource_readback rb; - ID3D12Resource *conditions; ID3D12CommandQueue *queue; unsigned int i; uint32_t value; @@ -30976,7 +30976,7 @@ static void test_conditional_rendering(void) transition_resource_state(command_list, context.render_target, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); - todo check_sub_resource_uint(context.render_target, 0, queue, command_list, 0x00000000, 0); + check_sub_resource_uint(context.render_target, 0, queue, command_list, 0xffffffff, 0); reset_command_list(command_list, context.allocator); transition_resource_state(command_list, context.render_target, @@ -30992,6 +30992,8 @@ static void test_conditional_rendering(void) transition_resource_state(command_list, context.render_target, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + ID3D12GraphicsCommandList_SetPredication(command_list, conditions, + sizeof(uint64_t), D3D12_PREDICATION_OP_EQUAL_ZERO); check_sub_resource_uint(context.render_target, 0, queue, command_list, 0xffffffff, 0); reset_command_list(command_list, context.allocator); @@ -31095,6 +31097,26 @@ static void test_conditional_rendering(void) check_sub_resource_uint(context.render_target, 0, queue, command_list, 0xff00ff00, 0); ID3D12Resource_Release(buffer); + reset_command_list(command_list, context.allocator); + transition_resource_state(command_list, context.render_target, + D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET); + + /* SetPredication() and upload buffer. */ + upload_buffer = create_upload_buffer(context.device, sizeof(predicate_args), predicate_args); + + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL); + prepare_instanced_draw(&context); + /* Skip. */ + ID3D12GraphicsCommandList_SetPredication(command_list, upload_buffer, + 0, D3D12_PREDICATION_OP_EQUAL_ZERO); + ID3D12GraphicsCommandList_DrawInstanced(command_list, 3, 1, 0, 0); + + ID3D12GraphicsCommandList_SetPredication(command_list, upload_buffer, + 0, D3D12_PREDICATION_OP_NOT_EQUAL_ZERO); + transition_resource_state(command_list, context.render_target, + D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + check_sub_resource_uint(context.render_target, 0, queue, command_list, 0xffffffff, 0); + reset_command_list(command_list, context.allocator); transition_resource_state(command_list, context.render_target, D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET); @@ -31300,6 +31322,7 @@ static void test_conditional_rendering(void) ID3D12Resource_Release(conditions); ID3D12Resource_Release(cb); ID3D12Resource_Release(buffer); + ID3D12Resource_Release(upload_buffer); ID3D12RootSignature_Release(root_signature); ID3D12PipelineState_Release(pipeline_state); destroy_test_context(&context);