Rename and group RT debug options

This commit is contained in:
baldurk
2024-12-02 13:39:27 +00:00
parent 250c448ebc
commit a77c8fc13b
7 changed files with 50 additions and 50 deletions
@@ -28,7 +28,7 @@
#include "data/hlsl/hlsl_cbuffers.h"
RDOC_EXTERN_CONFIG(bool, D3D12_Debug_RTAuditing);
RDOC_EXTERN_CONFIG(bool, D3D12_Debug_RT_Auditing);
static rdcstr ToHumanStr(const D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE &el)
{
@@ -884,7 +884,7 @@ bool WrappedID3D12GraphicsCommandList::PatchAccStructBlasAddress(
patchRaytracing->patchedInstanceBuffer->Offset(),
instanceResource, instanceResOffset, totalInstancesSize);
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
GetResourceManager()->GetGPUBufferAllocator().Alloc(
D3D12GpuBufferHeapType::ReadBackHeap, D3D12GpuBufferHeapMemoryFlag::Default,
@@ -1007,7 +1007,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_BuildRaytracingAccelerationStru
D3D12AccelerationStructure *accStructAtDstOffset = NULL;
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
RDCLOG("Recording %s dynamic build to %llx on %s",
AccStructDesc.Inputs.Type == D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL
@@ -1065,7 +1065,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_BuildRaytracingAccelerationStru
accStructAtDstOffset ? accStructAtDstOffset->GetResourceID() : ResourceId();
}
if(!D3D12_Debug_RTAuditing())
if(!D3D12_Debug_RT_Auditing())
{
Unwrap4(list)->BuildRaytracingAccelerationStructure(&AccStructDesc, NumPostbuildInfoDescs,
pPostbuildInfoDescs);
@@ -1105,7 +1105,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_BuildRaytracingAccelerationStru
}
}
if(!D3D12_Debug_RTAuditing())
if(!D3D12_Debug_RT_Auditing())
{
Unwrap4(pCommandList)
->BuildRaytracingAccelerationStructure(&AccStructDesc, NumPostbuildInfoDescs,
@@ -1206,7 +1206,7 @@ void WrappedID3D12GraphicsCommandList::BuildRaytracingAccelerationStructure(
// pre-allocate the AS ID so it can be serialised before the resource is created later on after submission
ResourceId dstASId = ResourceIDGen::GetNewUniqueID();
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
RDCLOG("%s: Build to %llx, will be %s", ToStr(GetResourceID()).c_str(),
pDesc->DestAccelerationStructureData, ToStr(dstASId).c_str());
@@ -1427,7 +1427,7 @@ void WrappedID3D12GraphicsCommandList::EmitRaytracingAccelerationStructurePostbu
if(IsCaptureMode(m_State))
{
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
if(NumSourceAccelerationStructures == 1)
{
@@ -1485,13 +1485,13 @@ bool WrappedID3D12GraphicsCommandList::Serialise_CopyRaytracingAccelerationStruc
{
ID3D12GraphicsCommandList4 *list = Unwrap4(m_Cmd->RerecordCmdList(m_Cmd->m_LastCmdListID));
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
RDCLOG("Recording copy from %llx to %llx on %s", SourceAccelerationStructureData,
DestAccelerationStructureData, ToStr(m_Cmd->m_LastCmdListID).c_str());
}
if(!D3D12_Debug_RTAuditing())
if(!D3D12_Debug_RT_Auditing())
{
list->CopyRaytracingAccelerationStructure(DestAccelerationStructureData,
SourceAccelerationStructureData, Mode);
@@ -1500,14 +1500,14 @@ bool WrappedID3D12GraphicsCommandList::Serialise_CopyRaytracingAccelerationStruc
}
else
{
if(!D3D12_Debug_RTAuditing())
if(!D3D12_Debug_RT_Auditing())
{
Unwrap4(pCommandList)
->CopyRaytracingAccelerationStructure(DestAccelerationStructureData,
SourceAccelerationStructureData, Mode);
}
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
RDCLOG("Recording copy from %llx to %llx on %s", SourceAccelerationStructureData,
DestAccelerationStructureData, ToStr(m_Cmd->m_LastCmdListID).c_str());
@@ -1546,7 +1546,7 @@ void WrappedID3D12GraphicsCommandList::CopyRaytracingAccelerationStructure(
// pre-allocate the AS ID so it can be serialised before the resource is created later on after submission
ResourceId dstASId = ResourceIDGen::GetNewUniqueID();
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
RDCLOG("%s: Copy %llx to %llx (%s), will be %s", ToStr(GetResourceID()).c_str(),
SourceAccelerationStructureData, DestAccelerationStructureData, ToStr(Mode).c_str(),
@@ -1813,7 +1813,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_DispatchRays(SerialiserType &se
const D3D12RenderState &state = m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].state;
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
Desc.Width = Desc.Height = Desc.Depth = 0;
}
@@ -30,7 +30,7 @@
#include "d3d12_command_queue.h"
#include "d3d12_debug.h"
RDOC_EXTERN_CONFIG(bool, D3D12_Debug_RTAuditing);
RDOC_EXTERN_CONFIG(bool, D3D12_Debug_RT_Auditing);
template <typename SerialiserType>
bool WrappedID3D12GraphicsCommandList::Serialise_Close(SerialiserType &ser)
@@ -4095,7 +4095,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteIndirect(
WrappedID3D12CommandSignature *comSig = (WrappedID3D12CommandSignature *)pCommandSignature;
if(D3D12_Debug_RTAuditing() && comSig->sig.raytraced)
if(D3D12_Debug_RT_Auditing() && comSig->sig.raytraced)
{
// only one execute is allowed per command signature, if it's ray tracing and we're auditing then turn it off
MaxCommandCount = 0;
@@ -28,7 +28,7 @@
#include "d3d12_resources.h"
RDOC_EXTERN_CONFIG(bool, D3D12_Debug_SingleSubmitFlushing);
RDOC_EXTERN_CONFIG(bool, D3D12_Debug_RTAuditing);
RDOC_EXTERN_CONFIG(bool, D3D12_Debug_RT_Auditing);
template <typename SerialiserType>
bool WrappedID3D12CommandQueue::Serialise_UpdateTileMappings(
@@ -492,12 +492,12 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(SerialiserType &se
ID3D12CommandList *list = Unwrap(ppCommandLists[i]);
real->ExecuteCommandLists(1, &list);
if(D3D12_Debug_SingleSubmitFlushing() || D3D12_Debug_RTAuditing())
if(D3D12_Debug_SingleSubmitFlushing() || D3D12_Debug_RT_Auditing())
m_pDevice->GPUSync();
BakedCmdListInfo &info = m_Cmd.m_BakedCmdListInfo[cmd];
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
for(auto it = info.m_patchRaytracingInfo.begin(); it != info.m_patchRaytracingInfo.end();
++it)
@@ -843,7 +843,7 @@ void WrappedID3D12CommandQueue::ExecuteCommandListsInternal(UINT NumCommandLists
WrappedID3D12GraphicsCommandList *wrapped =
(WrappedID3D12GraphicsCommandList *)(ppCommandLists[i]);
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
RDCLOG("Submit-callbacks for %s", ToStr(wrapped->GetResourceID()).c_str());
}
+5 -5
View File
@@ -51,8 +51,8 @@ RDOC_EXTERN_CONFIG(bool, Replay_Debug_SingleThreadedCompilation);
RDOC_DEBUG_CONFIG(bool, D3D12_Debug_SingleSubmitFlushing, false,
"Every command buffer is submitted and fully flushed to the GPU, to narrow down "
"the source of problems.");
RDOC_DEBUG_CONFIG(bool, D3D12_Debug_RTOverlay, false, "Add some RT tracking to the overlay.");
RDOC_EXTERN_CONFIG(bool, D3D12_Debug_RTAuditing);
RDOC_DEBUG_CONFIG(bool, D3D12_Debug_RT_Overlay, false, "Add some RT tracking to the overlay.");
RDOC_EXTERN_CONFIG(bool, D3D12_Debug_RT_Auditing);
WRAPPED_POOL_INST(WrappedID3D12Device);
@@ -2441,7 +2441,7 @@ HRESULT WrappedID3D12Device::Present(ID3D12GraphicsCommandList *pOverlayCommandL
rdcstr overlayText =
RenderDoc::Inst().GetOverlayText(RDCDriver::D3D12, devWnd, m_FrameCounter, 0);
if(D3D12_Debug_RTOverlay() && m_UsedRT)
if(D3D12_Debug_RT_Overlay() && m_UsedRT)
{
ASStats blasStats = {}, tlasStats = {};
@@ -3952,7 +3952,7 @@ bool WrappedID3D12Device::Serialise_CreateAS(SerialiserType &ser, ID3D12Resource
{
GetResourceManager()->AddLiveResource(asId, accStructAtOffset);
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
RDCLOG("Creating %s AS %s at %s + %llu (%llu bytes): %llx remapped to %llx",
type == D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL ? "blas" : "tlas",
@@ -4011,7 +4011,7 @@ void WrappedID3D12Device::CreateAS(ID3D12Resource *pResource, UINT64 resourceOff
{
D3D12ResourceRecord *record = as->GetResourceRecord();
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
RDCLOG("Creating %s at %s + %llx (%llx)", ToStr(as->GetResourceID()).c_str(),
ToStr(GetResID(pResource)).c_str(), resourceOffset, as->GetVirtualAddress());
+2 -2
View File
@@ -39,7 +39,7 @@ RDOC_EXTERN_CONFIG(bool, Replay_Debug_SingleThreadedCompilation);
RDOC_DEBUG_CONFIG(bool, D3D12_Experimental_EnableRTSupport, false,
"Enable support for experimental DXR support");
RDOC_EXTERN_CONFIG(bool, D3D12_Debug_RTAuditing);
RDOC_EXTERN_CONFIG(bool, D3D12_Debug_RT_Auditing);
static RDResult DeferredPipelineCompile(ID3D12Device *device,
const D3D12_GRAPHICS_PIPELINE_STATE_DESC &Descriptor,
@@ -1326,7 +1326,7 @@ bool WrappedID3D12Device::Serialise_DynamicDescriptorWrite(SerialiserType &ser,
RDCASSERT(desc.GetType() != D3D12DescriptorType::Undefined);
// to remove any ray query work, force AS descriptors to NULL
if(D3D12_Debug_RTAuditing() && desc.GetType() == D3D12DescriptorType::SRV)
if(D3D12_Debug_RT_Auditing() && desc.GetType() == D3D12DescriptorType::SRV)
{
D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc = desc.GetSRV();
if(srvDesc.ViewDimension == D3D12_SRV_DIMENSION_RAYTRACING_ACCELERATION_STRUCTURE)
+8 -8
View File
@@ -36,7 +36,7 @@ RDOC_EXTERN_CONFIG(bool, D3D12_Debug_SingleSubmitFlushing);
RDOC_CONFIG(bool, D3D12_Debug_DriverASSerialisation, false,
"Use driver-side serialisation for saving and restoring ASs");
RDOC_EXTERN_CONFIG(bool, D3D12_Debug_RTAuditing);
RDOC_EXTERN_CONFIG(bool, D3D12_Debug_RT_Auditing);
template <class SerialiserType>
void DoSerialise(SerialiserType &ser, ASBuildData::RVAWithStride &el)
@@ -817,7 +817,7 @@ bool D3D12ResourceManager::Serialise_InitialState(SerialiserType &ser, ResourceI
desc.NumDescriptors = heap->GetNumDescriptors();
// to remove any ray query work, force AS descriptors to NULL
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
for(uint32_t i = 0; i < RDCMIN(numElems, desc.NumDescriptors); i++)
{
@@ -1488,7 +1488,7 @@ bool D3D12ResourceManager::Serialise_InitialState(SerialiserType &ser, ResourceI
D3D12AccelerationStructure *blasCheck = NULL;
// check and log more fine-grained if we're auditing
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
rdcstr invalid;
@@ -1532,7 +1532,7 @@ bool D3D12ResourceManager::Serialise_InitialState(SerialiserType &ser, ResourceI
continue;
}
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
RDCLOG("%s %u: remapped from %llx to %llx", ToStr(id).c_str(), i,
instances[i].AccelerationStructure,
@@ -2091,7 +2091,7 @@ void D3D12ResourceManager::Apply_InitialState(ID3D12DeviceChild *live, D3D12Init
{
desc.DestAccelerationStructureData = as->GetVirtualAddress();
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
RDCLOG("Apply TLAS - Rebuilding %s to %llx",
ToStr(GetOriginalID(as->GetResourceID())).c_str(),
@@ -2119,7 +2119,7 @@ void D3D12ResourceManager::Apply_InitialState(ID3D12DeviceChild *live, D3D12Init
desc.DestAccelerationStructureData = data.cachedBuiltAS->Address();
list->BuildRaytracingAccelerationStructure(&desc, 0, NULL);
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
RDCLOG("Apply BLAS - Caching %s to %llx", ToStr(GetOriginalID(as->GetResourceID())).c_str(),
desc.DestAccelerationStructureData);
@@ -2132,7 +2132,7 @@ void D3D12ResourceManager::Apply_InitialState(ID3D12DeviceChild *live, D3D12Init
as->GetVirtualAddress(), desc.DestAccelerationStructureData,
D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_CLONE);
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
RDCLOG("Apply BLAS - Copying %s from %llx to %llx",
ToStr(GetOriginalID(as->GetResourceID())).c_str(),
@@ -2153,7 +2153,7 @@ void D3D12ResourceManager::Apply_InitialState(ID3D12DeviceChild *live, D3D12Init
as->GetVirtualAddress(), data.cachedBuiltAS->Address(),
D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_CLONE);
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
RDCLOG("Apply BLAS - Copying %s from %llx to %llx",
ToStr(GetOriginalID(as->GetResourceID())).c_str(), data.cachedBuiltAS->Address(),
+16 -16
View File
@@ -37,23 +37,23 @@
#include "data/hlsl/hlsl_cbuffers.h"
RDOC_CONFIG(uint32_t, D3D12_Debug_RTIndirectEstimateOverride, 0,
RDOC_CONFIG(uint32_t, D3D12_Debug_RT_IndirectEstimateOverride, 0,
"Override how many bytes are reserved for shader tables in each indirect ray dispatch");
RDOC_CONFIG(uint32_t, D3D12_Debug_RTMaxVertexIncrement, 1000,
RDOC_CONFIG(uint32_t, D3D12_Debug_RT_MaxVertexIncrement, 1000,
"Amount to add to the API-provided max vertex when building a BLAS with an index "
"buffer, to account for incorrectly set values by application.");
RDOC_CONFIG(
uint32_t, D3D12_Debug_RTMaxVertexPercentIncrease, 10,
uint32_t, D3D12_Debug_RT_MaxVertexPercentIncrease, 10,
"Percentage increase for the API-provided max vertex when building a BLAS with an index "
"buffer, to account for incorrectly set values by application.");
RDOC_CONFIG(uint32_t, D3D12_Debug_RTASCacheThreshold, 5000,
RDOC_CONFIG(uint32_t, D3D12_Debug_RT_ASCacheThreshold, 5000,
"How many milliseconds to wait before caching an AS to disk if it has been unmodified "
"for that long");
RDOC_CONFIG(bool, D3D12_Debug_RTAuditing, false, "Audit RT work during capture and replay.");
RDOC_CONFIG(bool, D3D12_Debug_RT_Auditing, false, "Audit RT work during capture and replay.");
// batch 50 at a time, if we have one check per frame this would cache 5000 BLASs in 100 frames
// which is a reasonable background pace
RDOC_CONFIG(uint32_t, D3D12_Debug_RTASCacheBatchSize, 50,
RDOC_CONFIG(uint32_t, D3D12_Debug_RT_ASCacheBatchSize, 50,
"The maximum number of ASs to cache to disk in a single batch (batch processing "
"happens at indeterminate intervals but no more than once per submission");
@@ -1006,8 +1006,8 @@ void D3D12RTManager::CheckASCaching()
SCOPED_LOCK(m_ASBuildDataLock);
const uint32_t ageThreshold = D3D12_Debug_RTASCacheThreshold();
const size_t maxCacheBatch = D3D12_Debug_RTASCacheBatchSize();
const uint32_t ageThreshold = D3D12_Debug_RT_ASCacheThreshold();
const size_t maxCacheBatch = D3D12_Debug_RT_ASCacheBatchSize();
// see if any AS builds are finished and old enough that we should flush them to disk.
// to avoid doing too much work at a time we do these in batches of up to N. They're pushed in
@@ -1068,7 +1068,7 @@ void D3D12RTManager::CheckASCaching()
{
ASBuildData *buildData = m_InMemASBuildDatas[i];
if(D3D12_Debug_RTAuditing())
if(D3D12_Debug_RT_Auditing())
{
RDCDEBUG("Flushing AS build data of size %llu to disk", buildData->buffer->Size());
}
@@ -1216,7 +1216,7 @@ PatchedRayDispatch D3D12RTManager::PatchRayDispatch(ID3D12GraphicsCommandList4 *
ret.resources.readbackBuffer = NULL;
if(IsReplayMode(m_wrappedDevice->GetState()) && D3D12_Debug_RTAuditing())
if(IsReplayMode(m_wrappedDevice->GetState()) && D3D12_Debug_RT_Auditing())
{
m_GPUBufferAllocator.Alloc(D3D12GpuBufferHeapType::ReadBackHeap,
D3D12GpuBufferHeapMemoryFlag::Default, patchDataSize * 2,
@@ -1423,8 +1423,8 @@ PatchedRayDispatch D3D12RTManager::PatchIndirectRayDispatch(
// in the largest TLAS, multiplied by the largest local root signature size.
uint32_t patchDataSize = 20 * 1024 * 1024 * MaxCommandCount;
if(D3D12_Debug_RTIndirectEstimateOverride() > 0)
patchDataSize = RDCMAX(patchDataSize, D3D12_Debug_RTIndirectEstimateOverride());
if(D3D12_Debug_RT_IndirectEstimateOverride() > 0)
patchDataSize = RDCMAX(patchDataSize, D3D12_Debug_RT_IndirectEstimateOverride());
m_GPUBufferAllocator.Alloc(D3D12GpuBufferHeapType::DefaultHeapWithUav,
D3D12GpuBufferHeapMemoryFlag::Default, patchDataSize,
@@ -1803,8 +1803,8 @@ ASBuildData *D3D12RTManager::CopyBuildInputs(
uint32_t untrustedVertexCount = desc.Triangles.VertexCount;
uint32_t estimatedVertexCount =
untrustedVertexCount +
(untrustedVertexCount / 100) * D3D12_Debug_RTMaxVertexPercentIncrease() +
D3D12_Debug_RTMaxVertexIncrement();
(untrustedVertexCount / 100) * D3D12_Debug_RT_MaxVertexPercentIncrease() +
D3D12_Debug_RT_MaxVertexIncrement();
RDCASSERT(vbSize >= desc.Triangles.VertexBuffer.StrideInBytes * untrustedVertexCount);
@@ -1922,8 +1922,8 @@ ASBuildData *D3D12RTManager::CopyBuildInputs(
uint32_t untrustedVertexCount = desc.Triangles.VertexCount;
uint32_t estimatedVertexCount =
untrustedVertexCount +
(untrustedVertexCount / 100) * D3D12_Debug_RTMaxVertexPercentIncrease() +
D3D12_Debug_RTMaxVertexIncrement();
(untrustedVertexCount / 100) * D3D12_Debug_RT_MaxVertexPercentIncrease() +
D3D12_Debug_RT_MaxVertexIncrement();
vbSize = RDCMIN(vbSize, desc.Triangles.VertexBuffer.StrideInBytes * estimatedVertexCount);