Extend D3D12 Execute Indirect test

Change it to do 8 indirect draws with a clear in between.
Check the pixel and mesh data for each draw is correct (simple triangle)
This commit is contained in:
Jake Turner
2023-07-03 11:54:49 +01:00
parent c328c3fdf7
commit 53bf231104
2 changed files with 44 additions and 13 deletions
@@ -81,20 +81,23 @@ RD_TEST(D3D12_Execute_Indirect, D3D12GraphicsTest)
D3D12_CPU_DESCRIPTOR_HANDLE rtv =
MakeRTV(bb).Format(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB).CreateCPU(0);
ClearRenderTargetView(cmd, rtv, {1.0f, 0.0f, 0.0f, 1.0f});
for(int i = 0; i < 8; ++i)
{
ClearRenderTargetView(cmd, rtv, {1.0f, 0.0f, 0.0f, 1.0f});
cmd->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
cmd->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
IASetVertexBuffer(cmd, vb, sizeof(DefaultA2V), 0);
cmd->SetPipelineState(pso);
cmd->SetGraphicsRootSignature(sig);
IASetVertexBuffer(cmd, vb, sizeof(DefaultA2V), 0);
cmd->SetPipelineState(pso);
cmd->SetGraphicsRootSignature(sig);
RSSetViewport(cmd, {0.0f, 0.0f, (float)screenWidth, (float)screenHeight, 0.0f, 1.0f});
RSSetScissorRect(cmd, {0, 0, screenWidth, screenHeight});
RSSetViewport(cmd, {0.0f, 0.0f, (float)screenWidth, (float)screenHeight, 0.0f, 1.0f});
RSSetScissorRect(cmd, {0, 0, screenWidth, screenHeight});
OMSetRenderTargets(cmd, {rtv}, {});
OMSetRenderTargets(cmd, {rtv}, {});
cmd->ExecuteIndirect(cmdsig, 1, argBuf, 0, NULL, 0);
cmd->ExecuteIndirect(cmdsig, 1, argBuf, 0, NULL, 0);
}
FinishUsingBackbuffer(cmd, D3D12_RESOURCE_STATE_RENDER_TARGET);
@@ -6,9 +6,37 @@ class D3D12_Execute_Indirect(rdtest.TestCase):
demos_test_name = 'D3D12_Execute_Indirect'
def check_capture(self):
action = self.find_action("IndirectDraw")
from_eid = 0
for i in range(8):
action = self.find_action("IndirectDraw", from_eid)
self.controller.SetFrameEvent(action.eventId, False)
# Should be a green triangle in the centre of the screen on a red background
self.check_triangle(back=[1.0, 0.0, 0.0, 1.0])
postvs_data = self.get_postvs(action, rd.MeshDataStage.VSOut, 0, action.numIndices)
self.controller.SetFrameEvent(action.eventId, False)
postvs_ref = {
0: {
'vtx': 0,
'idx': 0,
'SV_POSITION': [-0.5, -0.5, 0.0, 1.0],
'COLOR': [0.0, 1.0, 0.0, 1.0],
'TEXCOORD': [0.0, 0.0],
},
1: {
'vtx': 1,
'idx': 1,
'SV_POSITION': [0.0, 0.5, 0.0, 1.0],
'COLOR': [0.0, 1.0, 0.0, 1.0],
'TEXCOORD': [0.0, 1.0],
},
2: {
'vtx': 2,
'idx': 2,
'SV_POSITION': [0.5, -0.5, 0.0, 1.0],
'COLOR': [0.0, 1.0, 0.0, 1.0],
'TEXCOORD': [1.0, 0.0],
},
}
# Should be a green triangle in the centre of the screen on a red background
self.check_triangle(back=[1.0, 0.0, 0.0, 1.0])
self.check_mesh_data(postvs_ref, postvs_data)
from_eid = action.eventId + 1