From: Giovanni Mascellani gmascellani@codeweavers.com
The resource could be destructed before the command list left open is executed; instead, we immediately perform the transition. --- tests/shader_runner_d3d12.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/tests/shader_runner_d3d12.c b/tests/shader_runner_d3d12.c index 8453617ef..8abcdbc41 100644 --- a/tests/shader_runner_d3d12.c +++ b/tests/shader_runner_d3d12.c @@ -540,6 +540,7 @@ static struct resource_readback *d3d12_runner_get_resource_readback(struct shade struct d3d12_resource_readback *rb = malloc(sizeof(*rb)); struct d3d12_resource *resource = d3d12_resource(res); D3D12_RESOURCE_STATES state; + HRESULT hr;
if (resource->r.type == RESOURCE_TYPE_RENDER_TARGET) state = D3D12_RESOURCE_STATE_RENDER_TARGET; @@ -551,8 +552,14 @@ static struct resource_readback *d3d12_runner_get_resource_readback(struct shade get_resource_readback_with_command_list(resource->resource, 0, rb, test_context->queue, test_context->list); reset_command_list(test_context->list, test_context->allocator); + transition_resource_state(test_context->list, resource->resource, D3D12_RESOURCE_STATE_COPY_SOURCE, state); + hr = ID3D12GraphicsCommandList_Close(test_context->list); + assert_that(hr == S_OK, "Failed to close command list, hr %#x.\n", hr); + exec_command_list(test_context->queue, test_context->list); + wait_queue_idle(test_context->device, test_context->queue); + reset_command_list(test_context->list, test_context->allocator);
return &rb->rb; }