From 42a1b4e641557bb2122ccbf4efe03c32778a9f4b Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Wed, 18 Sep 2024 12:45:55 +0100 Subject: [PATCH] For Test D3D12_Sharing validate the D3D12 Drawcall results In addition to the Copy results --- util/test/demos/d3d12/d3d12_sharing.cpp | 2 ++ util/test/tests/D3D12/D3D12_Sharing.py | 47 ++++++++++++++++--------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/util/test/demos/d3d12/d3d12_sharing.cpp b/util/test/demos/d3d12/d3d12_sharing.cpp index bb256b8eb..ce47732b9 100644 --- a/util/test/demos/d3d12/d3d12_sharing.cpp +++ b/util/test/demos/d3d12/d3d12_sharing.cpp @@ -142,6 +142,8 @@ RD_TEST(D3D12_Sharing, D3D12GraphicsTest) OMSetRenderTargets(cmd, {rtv}, {}); + setMarker(cmd, "Draw"); + cmd->DrawInstanced(3, 1, 0, 0); ResourceBarrier(cmd, d3d12tex, D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_COMMON); diff --git a/util/test/tests/D3D12/D3D12_Sharing.py b/util/test/tests/D3D12/D3D12_Sharing.py index 447c1e16f..91bf649b4 100644 --- a/util/test/tests/D3D12/D3D12_Sharing.py +++ b/util/test/tests/D3D12/D3D12_Sharing.py @@ -6,29 +6,42 @@ class D3D12_Sharing(rdtest.TestCase): demos_test_name = 'D3D12_Sharing' def check_capture(self): - action = self.find_action("Copy") + markers = ["Draw", "Copy"] + for marker in markers: + action = self.find_action(marker) - action: rd.ActionDescription = action.next + action: rd.ActionDescription = action.next - self.controller.SetFrameEvent(action.eventId, False) + self.controller.SetFrameEvent(action.eventId, False) - pipe: rd.PipeState = self.controller.GetPipelineState() + pipe: rd.PipeState = self.controller.GetPipelineState() - # Should be white in the top left, green in the bottom right, and red elsewhere - self.check_pixel_value(action.copyDestination, 0.2, 0.2, [1.0, 1.0, 1.0, 1.0]) - self.check_pixel_value(action.copyDestination, 0.3, 0.3, [1.0, 1.0, 1.0, 1.0]) - self.check_pixel_value(action.copyDestination, 0.4, 0.4, [1.0, 1.0, 1.0, 1.0]) + rdtest.log.print(f"Checking Event: {marker}") + draw = marker == "Draw" + target = action.outputs[0] if draw else action.copyDestination - self.check_pixel_value(action.copyDestination, 0.6, 0.6, [0.0, 1.0, 0.0, 1.0]) - self.check_pixel_value(action.copyDestination, 0.7, 0.7, [0.0, 1.0, 0.0, 1.0]) - self.check_pixel_value(action.copyDestination, 0.8, 0.8, [0.0, 1.0, 0.0, 1.0]) + # Draw : Should be red in the top left + # Copy : Should be white in the top left + expected = [1.0, 0.0, 0.0, 1.0] if draw else [1.0, 1.0, 1.0, 1.0] + self.check_pixel_value(target, 0.2, 0.2, expected) + self.check_pixel_value(target, 0.3, 0.3, expected) + self.check_pixel_value(target, 0.4, 0.4, expected) - self.check_pixel_value(action.copyDestination, 0.1, 0.6, [1.0, 0.0, 0.0, 1.0]) - self.check_pixel_value(action.copyDestination, 0.1, 0.7, [1.0, 0.0, 0.0, 1.0]) - self.check_pixel_value(action.copyDestination, 0.1, 0.8, [1.0, 0.0, 0.0, 1.0]) + # green in the bottom right + expected = [0.0, 1.0, 0.0, 1.0] + self.check_pixel_value(target, 0.6, 0.6, expected) + self.check_pixel_value(target, 0.7, 0.7, expected) + self.check_pixel_value(target, 0.8, 0.8, expected) - self.check_pixel_value(action.copyDestination, 0.6, 0.1, [1.0, 0.0, 0.0, 1.0]) - self.check_pixel_value(action.copyDestination, 0.7, 0.1, [1.0, 0.0, 0.0, 1.0]) - self.check_pixel_value(action.copyDestination, 0.8, 0.1, [1.0, 0.0, 0.0, 1.0]) + # red elsewhere + expected = [1.0, 0.0, 0.0, 1.0] + self.check_pixel_value(target, 0.1, 0.6, expected) + self.check_pixel_value(target, 0.1, 0.7, expected) + self.check_pixel_value(target, 0.1, 0.8, expected) + + expected = [1.0, 0.0, 0.0, 1.0] + self.check_pixel_value(target, 0.6, 0.1, expected) + self.check_pixel_value(target, 0.7, 0.1, expected) + self.check_pixel_value(target, 0.8, 0.1, expected) rdtest.log.success("Picked values are as expected") \ No newline at end of file