Save the whole patched ray dispatch with heap IDs, not just resources

* This is unused normally but will be helpful for doing CPU-side verifies of ray
  dispatches.
This commit is contained in:
baldurk
2024-12-02 13:39:26 +00:00
parent 6b8ef1232b
commit 131a5227e9
6 changed files with 14 additions and 8 deletions
@@ -1720,7 +1720,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_DispatchRays(SerialiserType &se
Unwrap(GetResourceManager()->GetCurrentAs<ID3D12StateObject>(state.stateobj)));
state.ApplyComputeRootElementsUnwrapped(Unwrap4(list));
m_Cmd->m_RayDispatches.push_back(patchedDispatch.resources);
m_Cmd->m_RayDispatches.push_back(patchedDispatch);
uint32_t eventId = m_Cmd->HandlePreCallback(list, ActionFlags::DispatchRay);
Unwrap4(list)->DispatchRays(&patchedDispatch.desc);
@@ -1748,7 +1748,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_DispatchRays(SerialiserType &se
Unwrap(GetResourceManager()->GetCurrentAs<ID3D12StateObject>(state.stateobj)));
state.ApplyComputeRootElementsUnwrapped(Unwrap4(pCommandList));
m_Cmd->m_RayDispatches.push_back(patchedDispatch.resources);
m_Cmd->m_RayDispatches.push_back(patchedDispatch);
Unwrap4(pCommandList)->DispatchRays(&patchedDispatch.desc);
@@ -4195,7 +4195,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteIndirect(
->SetPipelineState1(
Unwrap(GetResourceManager()->GetCurrentAs<ID3D12StateObject>(state.stateobj)));
state.ApplyComputeRootElementsUnwrapped(Unwrap(list));
m_Cmd->m_RayDispatches.push_back(patchedDispatch.resources);
m_Cmd->m_RayDispatches.push_back(patchedDispatch);
}
for(uint32_t i = 0; i < countToReplay; i++)
@@ -4268,7 +4268,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteIndirect(
->SetPipelineState1(
Unwrap(GetResourceManager()->GetCurrentAs<ID3D12StateObject>(state.stateobj)));
state.ApplyComputeRootElementsUnwrapped(Unwrap(list));
m_Cmd->m_RayDispatches.push_back(patchedDispatch.resources);
m_Cmd->m_RayDispatches.push_back(patchedDispatch);
}
uint32_t countToReplay = actualCount;
@@ -4370,7 +4370,7 @@ 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);
}
Unwrap(list)->ExecuteIndirect(comSig->GetReal(), MaxCommandCount, argBuffer, argOffset,
+1 -1
View File
@@ -363,7 +363,7 @@ struct D3D12CommandData
double m_TimeFrequency = 1.0f;
SDFile *m_StructuredFile;
rdcarray<PatchedRayDispatch::Resources> m_RayDispatches;
rdcarray<PatchedRayDispatch> m_RayDispatches;
std::map<ResourceId, rdcarray<EventUsage>> m_ResourceUses;
+2 -2
View File
@@ -5319,9 +5319,9 @@ void WrappedID3D12Device::ReplayLog(uint32_t startEventID, uint32_t endEventID,
// clear any previous ray dispatch references
D3D12CommandData &cmd = *m_Queue->GetCommandData();
for(PatchedRayDispatch::Resources &r : cmd.m_RayDispatches)
for(PatchedRayDispatch &r : cmd.m_RayDispatches)
{
r.Release();
r.resources.Release();
}
cmd.m_RayDispatches.clear();
+3
View File
@@ -1006,6 +1006,7 @@ PatchedRayDispatch D3D12RTManager::PatchRayDispatch(ID3D12GraphicsCommandList4 *
PatchedRayDispatch ret = {};
ret.desc = desc;
ret.heaps = heaps;
D3D12MarkerRegion region(unwrappedCmd, "PatchRayDispatch");
@@ -1036,6 +1037,8 @@ PatchedRayDispatch D3D12RTManager::PatchRayDispatch(ID3D12GraphicsCommandList4 *
D3D12GpuBufferHeapMemoryFlag::Default, patchDataSize,
D3D12_RAYTRACING_SHADER_TABLE_BYTE_ALIGNMENT, &scratchBuffer);
ret.resources.readbackBuffer = NULL;
RDCCOMPILE_ASSERT(WRAPPED_DESCRIPTOR_STRIDE == sizeof(D3D12Descriptor),
"Shader descriptor stride is wrong");
+3
View File
@@ -1032,6 +1032,8 @@ struct PatchedRayDispatch
// the argument buffer used for indirect executes.
D3D12GpuBuffer *argumentBuffer;
D3D12GpuBuffer *readbackBuffer;
// for convenience, when these resources are referenced in a queue they get a fence value to
// indicate when they're safe to release. This values are unset when returned from patching or
// referenced in the list and is set in each queue's copy of the references.
@@ -1056,6 +1058,7 @@ struct PatchedRayDispatch
// the patched dispatch descriptor
D3D12_DISPATCH_RAYS_DESC desc = {};
rdcarray<ResourceId> heaps;
};
struct D3D12ShaderExportDatabase;