Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/HansKristian-Work/vkd3d-proton.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2021-09-24 00:07:04 +0300
committerHans-Kristian Arntzen <post@arntzen-software.no>2021-09-24 13:47:00 +0300
commit985c906d3a0cff0892a711ae590161f29741586a (patch)
treeacffc2515f6133b4e8193c3e53bb438d09d7cd2e
parent768ccee59e88d9fad93dce5315303958ba3396fe (diff)
Hack up test for repro.host-mem-invalidation-repro
-rw-r--r--tests/d3d12_sync.c73
1 files changed, 48 insertions, 25 deletions
diff --git a/tests/d3d12_sync.c b/tests/d3d12_sync.c
index ac9291f0..c824d88a 100644
--- a/tests/d3d12_sync.c
+++ b/tests/d3d12_sync.c
@@ -87,7 +87,7 @@ void test_queue_wait(void)
context.pipeline_state = create_pipeline_state(context.device,
context.root_signature, context.render_target_desc.Format, NULL, &ps, NULL);
- cb = create_upload_buffer(device, sizeof(color), NULL);
+ cb = create_upload_buffer(device, 512, NULL);
resource_desc = ID3D12Resource_GetDesc(context.render_target);
@@ -95,6 +95,18 @@ void test_queue_wait(void)
buffer_size = row_pitch * resource_desc.Height;
readback_buffer = create_readback_buffer(device, buffer_size);
+ dst_location.pResource = readback_buffer;
+ dst_location.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
+ dst_location.PlacedFootprint.Offset = 0;
+ dst_location.PlacedFootprint.Footprint.Format = resource_desc.Format;
+ dst_location.PlacedFootprint.Footprint.Width = resource_desc.Width;
+ dst_location.PlacedFootprint.Footprint.Height = resource_desc.Height;
+ dst_location.PlacedFootprint.Footprint.Depth = 1;
+ dst_location.PlacedFootprint.Footprint.RowPitch = row_pitch;
+ src_location.pResource = context.render_target;
+ src_location.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
+ src_location.SubresourceIndex = 0;
+
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);
@@ -105,29 +117,36 @@ void test_queue_wait(void)
ID3D12GraphicsCommandList_SetGraphicsRootConstantBufferView(command_list, 0,
ID3D12Resource_GetGPUVirtualAddress(cb));
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);
-
- dst_location.pResource = readback_buffer;
- dst_location.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
- dst_location.PlacedFootprint.Offset = 0;
- dst_location.PlacedFootprint.Footprint.Format = resource_desc.Format;
- dst_location.PlacedFootprint.Footprint.Width = resource_desc.Width;
- dst_location.PlacedFootprint.Footprint.Height = resource_desc.Height;
- dst_location.PlacedFootprint.Footprint.Depth = 1;
- dst_location.PlacedFootprint.Footprint.RowPitch = row_pitch;
- src_location.pResource = context.render_target;
- src_location.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
- src_location.SubresourceIndex = 0;
ID3D12GraphicsCommandList_CopyTextureRegion(command_list, &dst_location, 0, 0, 0, &src_location, NULL);
-
transition_resource_state(command_list, context.render_target,
D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET);
-
hr = ID3D12GraphicsCommandList_Close(command_list);
ok(hr == S_OK, "Failed to close command list, hr %#x.\n", hr);
+ ID3D12GraphicsCommandList *command_list2;
+
+ ID3D12Device_CreateCommandList(device, 0, D3D12_COMMAND_LIST_TYPE_DIRECT,
+ context.allocator, NULL, &IID_ID3D12GraphicsCommandList, (void**)&command_list2);
+ ID3D12GraphicsCommandList_ClearRenderTargetView(command_list2, context.rtv, white, 0, NULL);
+ ID3D12GraphicsCommandList_OMSetRenderTargets(command_list2, 1, &context.rtv, false, NULL);
+ ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list2, context.root_signature);
+ ID3D12GraphicsCommandList_SetPipelineState(command_list2, context.pipeline_state);
+ ID3D12GraphicsCommandList_IASetPrimitiveTopology(command_list2, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+ ID3D12GraphicsCommandList_RSSetViewports(command_list2, 1, &context.viewport);
+ ID3D12GraphicsCommandList_RSSetScissorRects(command_list2, 1, &context.scissor_rect);
+ ID3D12GraphicsCommandList_SetGraphicsRootConstantBufferView(command_list2, 0,
+ ID3D12Resource_GetGPUVirtualAddress(cb) + 0);
+ ID3D12GraphicsCommandList_DrawInstanced(command_list2, 3, 1, 0, 0);
+ transition_resource_state(command_list2, context.render_target,
+ D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE);
+ ID3D12GraphicsCommandList_CopyTextureRegion(command_list2, &dst_location, 0, 0, 0, &src_location, NULL);
+ transition_resource_state(command_list2, context.render_target,
+ D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET);
+ hr = ID3D12GraphicsCommandList_Close(command_list2);
+ ok(hr == S_OK, "Failed to close command list, hr %#x.\n", hr);
+
/* Wait() with signaled fence */
update_buffer_data(cb, 0, sizeof(green), &green);
queue_wait(queue, fence, 1);
@@ -139,20 +158,21 @@ void test_queue_wait(void)
/* Wait() before CPU signal */
update_buffer_data(cb, 0, sizeof(blue), &blue);
- queue_wait(queue, fence, 2);
+ queue_wait(queue, fence, 1000);
exec_command_list(queue, command_list);
queue_signal(queue, fence2, 1);
hr = ID3D12Fence_SetEventOnCompletion(fence2, 1, event);
ok(hr == S_OK, "Failed to set event on completion, hr %#x.\n", hr);
- ret = wait_event(event, 0);
- ok(ret == WAIT_TIMEOUT, "Got unexpected return value %#x.\n", ret);
- init_readback(&rb, readback_buffer, buffer_size, resource_desc.Width, resource_desc.Height, 1, row_pitch);
- check_readback_data_uint(&rb, NULL, 0xff00ff00, 0);
- release_resource_readback(&rb);
- value = ID3D12Fence_GetCompletedValue(fence2);
- ok(value == 0, "Got unexpected value %"PRIu64".\n", value);
- hr = ID3D12Fence_Signal(fence, 2);
+ //ret = wait_event(event, 0);
+ //ok(ret == WAIT_TIMEOUT, "Got unexpected return value %#x.\n", ret);
+ //init_readback(&rb, readback_buffer, buffer_size, resource_desc.Width, resource_desc.Height, 1, row_pitch);
+ //check_readback_data_uint(&rb, NULL, 0xff00ff00, 0);
+ //release_resource_readback(&rb);
+ //value = ID3D12Fence_GetCompletedValue(fence2);
+ //ok(value == 0, "Got unexpected value %"PRIu64".\n", value);
+
+ hr = ID3D12Fence_Signal(fence, 1000);
ok(hr == S_OK, "Failed to signal fence, hr %#x.\n", hr);
ret = wait_event(event, INFINITE);
ok(ret == WAIT_OBJECT_0, "Got unexpected return value %#x.\n", ret);
@@ -164,6 +184,7 @@ void test_queue_wait(void)
value = ID3D12Fence_GetCompletedValue(fence2);
ok(value == 1, "Got unexpected value %"PRIu64".\n", value);
+#if 0
/* Wait() before GPU signal */
update_buffer_data(cb, 0, sizeof(green), &green);
queue_wait(queue, fence, 3);
@@ -224,6 +245,7 @@ void test_queue_wait(void)
value = ID3D12Fence_GetCompletedValue(fence);
ok(value == 7, "Got unexpected value %"PRIu64".\n", value);
+#endif
destroy_event(event);
ID3D12Fence_Release(fence);
@@ -231,6 +253,7 @@ void test_queue_wait(void)
ID3D12Resource_Release(cb);
ID3D12CommandQueue_Release(queue2);
ID3D12Resource_Release(readback_buffer);
+ ID3D12GraphicsCommandList_Release(command_list2);
destroy_test_context(&context);
}