Update D3D12 ExecuteIndrect argOffset during replay

This fixes D3D12_Execute_Indirect test failure

Only add to m_Cmd->m_RayDispatches when ray tracing is active in the execute indirect
This commit is contained in:
Jake Turner
2024-06-17 12:03:51 +01:00
parent 1ae6882c90
commit 8a2d483b40
@@ -4206,9 +4206,9 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteIndirect(
ID3D12Resource *argBuffer = Unwrap(patched.first);
UINT64 argOffset = patched.second;
PatchedRayDispatch patchedDispatch = {};
if(comSig->sig.raytraced)
{
PatchedRayDispatch patchedDispatch = {};
patchedDispatch =
GetResourceManager()->GetRaytracingResourceAndUtilHandler()->PatchIndirectRayDispatch(
Unwrap(pCommandList), state.heaps, comSig, MaxCommandCount, patched.first,
@@ -4225,10 +4225,9 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteIndirect(
->SetPipelineState1(
Unwrap(GetResourceManager()->GetCurrentAs<ID3D12StateObject>(state.stateobj)));
state.ApplyComputeRootElementsUnwrapped(Unwrap(pCommandList));
m_Cmd->m_RayDispatches.push_back(patchedDispatch.resources);
}
m_Cmd->m_RayDispatches.push_back(patchedDispatch.resources);
if(m_Cmd->m_FirstEventID <= 1)
{
// if we're replaying part-way into a multidraw we just clamp the count
@@ -4262,7 +4261,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteIndirect(
// fortunately ExecuteIndirect has no 'draw' builtin, so we can just offset the
// argument buffer and set count to 1
count = 1;
patched.second += comSig->sig.ByteStride * execidx;
argOffset += comSig->sig.ByteStride * execidx;
}
}
@@ -4308,9 +4307,9 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteIndirect(
ID3D12Resource *argBuffer = Unwrap(patched.first);
UINT64 argOffset = patched.second;
PatchedRayDispatch patchedDispatch = {};
if(comSig->sig.raytraced)
{
PatchedRayDispatch patchedDispatch = {};
patchedDispatch =
GetResourceManager()->GetRaytracingResourceAndUtilHandler()->PatchIndirectRayDispatch(
Unwrap(list), state.heaps, comSig, MaxCommandCount, patched.first, patched.second,
@@ -4327,10 +4326,9 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteIndirect(
->SetPipelineState1(
Unwrap(GetResourceManager()->GetCurrentAs<ID3D12StateObject>(state.stateobj)));
state.ApplyComputeRootElementsUnwrapped(Unwrap(pCommandList));
m_Cmd->m_RayDispatches.push_back(patchedDispatch.resources);
}
m_Cmd->m_RayDispatches.push_back(patchedDispatch.resources);
Unwrap(list)->ExecuteIndirect(comSig->GetReal(), MaxCommandCount, argBuffer, argOffset,
Unwrap(pCountBuffer), CountBufferOffset);