Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D3D12 Replay loading GPU sync for ExecuteIndirect. Closes #2970 #2973

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(SerialiserType &se
ID3D12CommandList *list = Unwrap(ppCommandLists[i]);
real->ExecuteCommandLists(1, &list);
if(D3D12_Debug_SingleSubmitFlushing())
m_pDevice->GPUSyncAllQueues();
m_pDevice->GPUSync();
}
else
{
Expand All @@ -504,8 +504,8 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(SerialiserType &se

for(size_t c = 1; c < info.crackedLists.size(); c++)
{
// ensure all work on all queues has finished
m_pDevice->GPUSyncAllQueues();
// ensure all GPU work has finished
m_pDevice->GPUSync();

if(m_pDevice->HasFatalError())
return false;
Expand All @@ -525,7 +525,7 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(SerialiserType &se
}

if(D3D12_Debug_SingleSubmitFlushing())
m_pDevice->GPUSyncAllQueues();
m_pDevice->GPUSync();
}
}

Expand Down Expand Up @@ -714,7 +714,7 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(SerialiserType &se
for(size_t i = 0; i < rerecordedCmds.size(); i++)
{
real->ExecuteCommandLists(1, &rerecordedCmds[i]);
m_pDevice->GPUSyncAllQueues();
m_pDevice->GPUSync();
}
}
else
Expand Down
21 changes: 12 additions & 9 deletions util/test/demos/d3d12/d3d12_execute_indirect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
36 changes: 32 additions & 4 deletions util/test/tests/D3D12/D3D12_Execute_Indirect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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