From: Conor McCarthy Subject: [PATCH vkd3d 4/5] tests: Test the effect of bundle default state on the executing command list. Message-Id: <20210903145859.2490-4-cmccarthy@codeweavers.com> Date: Sat, 4 Sep 2021 00:58:58 +1000 In-Reply-To: <20210903145859.2490-1-cmccarthy@codeweavers.com> References: <20210903145859.2490-1-cmccarthy@codeweavers.com> Signed-off-by: Conor McCarthy --- tests/d3d12.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/tests/d3d12.c b/tests/d3d12.c index 6bc03b0b..1e895dcd 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -7440,6 +7440,41 @@ static void test_bundle_state_inheritance(void) reset_command_list(command_list, context.allocator); reset_command_list(bundle, bundle_allocator); + /* A bundle sets to null the pipeline state in the executing command list. */ + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL); + + ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, false, NULL); + ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature); + ID3D12GraphicsCommandList_SetPipelineState(command_list, context.pipeline_state); + ID3D12GraphicsCommandList_IASetPrimitiveTopology(command_list, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + ID3D12GraphicsCommandList_RSSetViewports(command_list, 1, &context.viewport); + ID3D12GraphicsCommandList_RSSetScissorRects(command_list, 1, &context.scissor_rect); + + ID3D12GraphicsCommandList_IASetPrimitiveTopology(bundle, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + hr = ID3D12GraphicsCommandList_Close(bundle); + ok(SUCCEEDED(hr), "Failed to close bundle, hr %#x.\n", hr); + + ID3D12GraphicsCommandList_ExecuteBundle(command_list, bundle); + ID3D12GraphicsCommandList_DrawInstanced(command_list, 3, 1, 0, 0); + + transition_resource_state(command_list, context.render_target, + D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + + get_texture_readback_with_command_list(context.render_target, 0, &rb, queue, command_list); + for (y = 0; y < rb.height; ++y) + { + for (x = 0; x < rb.width; ++x) + { + unsigned int v = get_readback_uint(&rb, x, y, 0); + todo + ok(v == 0xffffffff, "Got unexpected value 0x%08x at (%u, %u).\n", v, x, y); + } + } + release_resource_readback(&rb); + + reset_command_list(command_list, context.allocator); + reset_command_list(bundle, bundle_allocator); + /* A bundle does not inherit the current primitive topology. */ transition_resource_state(command_list, context.render_target, D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET); @@ -7477,6 +7512,43 @@ static void test_bundle_state_inheritance(void) reset_command_list(command_list, context.allocator); reset_command_list(bundle, bundle_allocator); + /* A bundle sets to undefined the primitive topology in the executing command list. */ + transition_resource_state(command_list, context.render_target, + D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL); + + ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, false, NULL); + ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature); + ID3D12GraphicsCommandList_SetPipelineState(command_list, context.pipeline_state); + ID3D12GraphicsCommandList_IASetPrimitiveTopology(command_list, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + ID3D12GraphicsCommandList_RSSetViewports(command_list, 1, &context.viewport); + ID3D12GraphicsCommandList_RSSetScissorRects(command_list, 1, &context.scissor_rect); + + ID3D12GraphicsCommandList_SetPipelineState(bundle, context.pipeline_state); + hr = ID3D12GraphicsCommandList_Close(bundle); + ok(SUCCEEDED(hr), "Failed to close bundle, hr %#x.\n", hr); + + ID3D12GraphicsCommandList_ExecuteBundle(command_list, bundle); + ID3D12GraphicsCommandList_DrawInstanced(command_list, 3, 1, 0, 0); + + transition_resource_state(command_list, context.render_target, + D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + + get_texture_readback_with_command_list(context.render_target, 0, &rb, queue, command_list); + for (y = 0; y < rb.height; ++y) + { + for (x = 0; x < rb.width; ++x) + { + unsigned int v = get_readback_uint(&rb, x, y, 0); + /* This works on AMD. */ + ok(v == 0xffffffff || v == 0xff00ff00, "Got unexpected value 0x%08x at (%u, %u).\n", v, x, y); + } + } + release_resource_readback(&rb); + + reset_command_list(command_list, context.allocator); + reset_command_list(bundle, bundle_allocator); + /* A bundle inherit all other states. */ transition_resource_state(command_list, context.render_target, D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET); -- 2.32.0