D3D12 Pixel History Test add some drawcall stress tests

1000 drawcalls of 1 instance of 1 triangle
1 drawcall of 1000 instances of 1 triangle

Python tests verify the count of modifications is correct, the modifications are self-consistent and the picked texture value matches the final modifications tex after value
This commit is contained in:
Jake Turner
2024-01-13 08:50:49 +00:00
parent c4e3f96f57
commit e18ea02a2b
2 changed files with 42 additions and 0 deletions
@@ -217,6 +217,14 @@ float4 main(v2f vertIn, uint primId : SV_PrimitiveID, uint sampleId : SV_SampleI
{Vec3f(-0.7f, 0.5f, 0.33f), Vec4f(1.0f, 1.0f, 0.0f, 1.0f), Vec2f(0.0f, 1.0f)},
{Vec3f(-0.6f, 0.3f, 0.33f), Vec4f(1.0f, 1.0f, 0.0f, 1.0f), Vec2f(0.0f, 0.0f)},
{Vec3f(-0.8f, 0.3f, 0.33f), Vec4f(1.0f, 1.0f, 0.0f, 1.0f), Vec2f(1.0f, 0.0f)},
// 1000 draws of 1 triangle
{Vec3f(-0.7f, 0.0f, 0.33f), Vec4f(0.5f, 1.0f, 0.0f, 1.0f), Vec2f(0.0f, 1.0f)},
{Vec3f(-0.8f, 0.2f, 0.33f), Vec4f(0.5f, 1.0f, 0.0f, 1.0f), Vec2f(1.0f, 0.0f)},
{Vec3f(-0.6f, 0.2f, 0.33f), Vec4f(0.5f, 1.0f, 0.0f, 1.0f), Vec2f(0.0f, 0.0f)},
// 1000 instances of 1 triangle
{Vec3f(-0.7f, 0.6f, 0.33f), Vec4f(1.0f, 0.5f, 0.0f, 1.0f), Vec2f(0.0f, 1.0f)},
{Vec3f(-0.8f, 0.8f, 0.33f), Vec4f(1.0f, 0.5f, 0.0f, 1.0f), Vec2f(1.0f, 0.0f)},
{Vec3f(-0.6f, 0.8f, 0.33f), Vec4f(1.0f, 0.5f, 0.0f, 1.0f), Vec2f(0.0f, 0.0f)},
};
ID3D12ResourcePtr vb = MakeBuffer().Data(VBData);
@@ -608,6 +616,17 @@ float4 main(v2f vertIn, uint primId : SV_PrimitiveID, uint sampleId : SV_SampleI
cmd->OMSetDepthBounds(0.4f, 0.6f);
cmd->DrawInstanced(3, 1, 66, 0);
pushMarker(cmd, "Stress Test");
pushMarker(cmd, "Lots of Drawcalls");
setMarker(cmd, "1000 Draws");
cmd->SetPipelineState(pass.depthWritePipe);
for(int d = 0; d < 1000; ++d)
cmd->DrawInstanced(3, 1, 72, 0);
popMarker(cmd);
setMarker(cmd, "1000 Instances");
cmd->DrawInstanced(3, 1000, 75, 0);
popMarker(cmd);
// Add a marker so we can easily locate this draw
setMarker(cmd, "Test Begin");
@@ -96,6 +96,7 @@ class D3D12_Pixel_History(rdtest.TestCase):
depth_16bit_test_eid = self.find_action("Depth 16-bit Test", begin_renderpass_eid).next.eventId
depth_bounds_prep_eid = self.find_action("Depth Bounds Prep", begin_renderpass_eid).next.eventId
depth_bounds_clip_eid = self.find_action("Depth Bounds Clip", begin_renderpass_eid).next.eventId
one_thousand_instances_action = self.find_action("1000 Instances", begin_renderpass_eid)
# For pixel 110, 100, inside the red triangle with stencil value 0x55
x, y = 110, 100
@@ -274,6 +275,28 @@ class D3D12_Pixel_History(rdtest.TestCase):
self.check_events(events, modifs, False)
self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast)
# For pixel 60, 130 inside the light green triangle which is 1000 draws of 1 instance of 1 triangle
rdtest.log.print("Testing Lots of Drawcalls")
self.controller.SetFrameEvent(one_thousand_instances_action.eventId, True)
x, y = 60, 130
rdtest.log.print("Testing pixel {}, {}".format(x, y))
modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast)
self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast)
countEvents = 1 + 1000
self.check(len(modifs) == countEvents, "Expected {} events, got {}".format(countEvents, len(modifs)))
self.check_modifs_consistent(modifs)
# For pixel 60, 50 inside the orange triangle which is 1 draws of 1000 instances of 1 triangle
rdtest.log.print("Testing Lots of Instances")
self.controller.SetFrameEvent(one_thousand_instances_action.next.eventId, True)
x, y = 60, 50
rdtest.log.print("Testing pixel {}, {}".format(x, y))
modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast)
self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast)
countEvents = 1 + 255
self.check(len(modifs) == countEvents, "Expected {} events, got {}".format(countEvents, len(modifs)))
self.check_modifs_consistent(modifs)
def multisampled_image_test(self, pass_name: str):
begin_pass_action = self.find_action(pass_name)
if begin_pass_action is None: