From a882efef6604814df6fe9a77a3e100bb9f7a0e97 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 11 Sep 2024 14:29:34 +0100 Subject: [PATCH] Rename RT manager to be less of a mouthful --- .../driver/d3d12/d3d12_command_list4_wrap.cpp | 18 ++++----- .../driver/d3d12/d3d12_command_list_wrap.cpp | 21 +++++----- .../driver/d3d12/d3d12_command_queue_wrap.cpp | 6 +-- renderdoc/driver/d3d12/d3d12_device.cpp | 9 ++--- renderdoc/driver/d3d12/d3d12_device_wrap.cpp | 6 +-- .../driver/d3d12/d3d12_device_wrap14.cpp | 6 +-- renderdoc/driver/d3d12/d3d12_device_wrap5.cpp | 8 ++-- renderdoc/driver/d3d12/d3d12_device_wrap7.cpp | 8 ++-- renderdoc/driver/d3d12/d3d12_initstate.cpp | 6 +-- renderdoc/driver/d3d12/d3d12_manager.cpp | 39 +++++++++---------- renderdoc/driver/d3d12/d3d12_manager.h | 19 ++++----- renderdoc/driver/d3d12/d3d12_resources.cpp | 3 +- renderdoc/driver/d3d12/d3d12_resources.h | 4 +- 13 files changed, 67 insertions(+), 86 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_command_list4_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list4_wrap.cpp index 1b9c09a28..f5b964b89 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list4_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list4_wrap.cpp @@ -803,8 +803,7 @@ bool WrappedID3D12GraphicsCommandList::PatchAccStructBlasAddress( // Here, we are uploading the old BLAS addresses, and comparing the BLAS // addresses in the TLAS and patching it with the corresponding new address. - D3D12RaytracingResourceAndUtilHandler *rtHandler = - GetResourceManager()->GetRaytracingResourceAndUtilHandler(); + D3D12RTManager *rtManager = GetResourceManager()->GetRTManager(); // Create a resource for patched instance desc; we don't // need a resource of same size but of same number of instances in the TLAS with uav @@ -864,7 +863,7 @@ bool WrappedID3D12GraphicsCommandList::PatchAccStructBlasAddress( patchRaytracing->m_patchedInstanceBuffer->Offset(), instanceResource, instanceResOffset, totalInstancesSize); - D3D12AccStructPatchInfo patchInfo = rtHandler->GetAccStructPatchInfo(); + D3D12AccStructPatchInfo patchInfo = rtManager->GetAccStructPatchInfo(); { rdcarray resBarriers; @@ -1481,8 +1480,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_DispatchRays(SerialiserType &se // a reference to the lookup buffer used as well as a reference to the scratch buffer // containing the patched shader records. PatchedRayDispatch patchedDispatch = - GetResourceManager()->GetRaytracingResourceAndUtilHandler()->PatchRayDispatch( - Unwrap4(list), state.heaps, Desc); + GetResourceManager()->GetRTManager()->PatchRayDispatch(Unwrap4(list), state.heaps, Desc); // restore state that would have been mutated by the patching process Unwrap4(list)->SetComputeRootSignature( @@ -1507,9 +1505,8 @@ bool WrappedID3D12GraphicsCommandList::Serialise_DispatchRays(SerialiserType &se // this call will copy the specified buffers containing shader records and patch them. We get // a reference to the lookup buffer used as well as a reference to the scratch buffer // containing the patched shader records. - PatchedRayDispatch patchedDispatch = - GetResourceManager()->GetRaytracingResourceAndUtilHandler()->PatchRayDispatch( - Unwrap4(pCommandList), state.heaps, Desc); + PatchedRayDispatch patchedDispatch = GetResourceManager()->GetRTManager()->PatchRayDispatch( + Unwrap4(pCommandList), state.heaps, Desc); // restore state that would have been mutated by the patching process Unwrap4(pCommandList) @@ -1545,9 +1542,8 @@ void WrappedID3D12GraphicsCommandList::DispatchRays(_In_ const D3D12_DISPATCH_RA // this call will copy the specified buffers containing shader records and patch them. We get a // reference to the lookup buffer used as well as a reference to the scratch buffer containing the // patched shader records. - PatchedRayDispatch patchedDispatch = - GetResourceManager()->GetRaytracingResourceAndUtilHandler()->PatchRayDispatch( - m_pList4, m_CaptureComputeState.heaps, *pDesc); + PatchedRayDispatch patchedDispatch = GetResourceManager()->GetRTManager()->PatchRayDispatch( + m_pList4, m_CaptureComputeState.heaps, *pDesc); // restore state that would have been mutated by the patching process m_pList4->SetComputeRootSignature(Unwrap(GetResourceManager()->GetCurrentAs( diff --git a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp index 907f2d0ce..82f0517f6 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp @@ -4214,10 +4214,9 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteIndirect( if(comSig->sig.raytraced) { PatchedRayDispatch patchedDispatch = {}; - patchedDispatch = - GetResourceManager()->GetRaytracingResourceAndUtilHandler()->PatchIndirectRayDispatch( - Unwrap(pCommandList), state.heaps, comSig, MaxCommandCount, patched.first, - patched.second, pCountBuffer, CountBufferOffset); + patchedDispatch = GetResourceManager()->GetRTManager()->PatchIndirectRayDispatch( + Unwrap(pCommandList), state.heaps, comSig, MaxCommandCount, patched.first, + patched.second, pCountBuffer, CountBufferOffset); argBuffer = patchedDispatch.resources.argumentBuffer->Resource(); argOffset = patchedDispatch.resources.argumentBuffer->Offset(); @@ -4315,10 +4314,9 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteIndirect( if(comSig->sig.raytraced) { PatchedRayDispatch patchedDispatch = {}; - patchedDispatch = - GetResourceManager()->GetRaytracingResourceAndUtilHandler()->PatchIndirectRayDispatch( - Unwrap(list), state.heaps, comSig, MaxCommandCount, patched.first, patched.second, - pCountBuffer, CountBufferOffset); + patchedDispatch = GetResourceManager()->GetRTManager()->PatchIndirectRayDispatch( + Unwrap(list), state.heaps, comSig, MaxCommandCount, patched.first, patched.second, + pCountBuffer, CountBufferOffset); argBuffer = patchedDispatch.resources.argumentBuffer->Resource(); argOffset = patchedDispatch.resources.argumentBuffer->Offset(); @@ -4426,10 +4424,9 @@ void WrappedID3D12GraphicsCommandList::ExecuteIndirect(ID3D12CommandSignature *p PatchedRayDispatch patchedDispatch = {}; if(((WrappedID3D12CommandSignature *)pCommandSignature)->sig.raytraced) { - patchedDispatch = - GetResourceManager()->GetRaytracingResourceAndUtilHandler()->PatchIndirectRayDispatch( - m_pList, m_CaptureComputeState.heaps, pCommandSignature, MaxCommandCount, - pArgumentBuffer, ArgumentBufferOffset, pCountBuffer, CountBufferOffset); + patchedDispatch = GetResourceManager()->GetRTManager()->PatchIndirectRayDispatch( + m_pList, m_CaptureComputeState.heaps, pCommandSignature, MaxCommandCount, pArgumentBuffer, + ArgumentBufferOffset, pCountBuffer, CountBufferOffset); argBuffer = patchedDispatch.resources.argumentBuffer->Resource(); argOffset = patchedDispatch.resources.argumentBuffer->Offset(); diff --git a/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp index 1f5fe3037..4c7b94a20 100644 --- a/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp @@ -776,8 +776,8 @@ void WrappedID3D12CommandQueue::ExecuteCommandListsInternal(UINT NumCommandLists // results are available, since we could submit a build on one queue and then a dependent // build on another queue later once it's finished without any intermediate submissions on the // first queue. For that reason we pass these to the RT handler to hold onto, and tick it - GetResourceManager()->GetRaytracingResourceAndUtilHandler()->AddPendingASBuilds( - fence, m_RayFenceValue, pendingASBuildCallbacks); + GetResourceManager()->GetRTManager()->AddPendingASBuilds(fence, m_RayFenceValue, + pendingASBuildCallbacks); // add the signal for those callbacks to wait on HRESULT hr = m_pReal->Signal(fence, m_RayFenceValue++); @@ -786,7 +786,7 @@ void WrappedID3D12CommandQueue::ExecuteCommandListsInternal(UINT NumCommandLists } // check AS builds now - GetResourceManager()->GetRaytracingResourceAndUtilHandler()->CheckPendingASBuilds(); + GetResourceManager()->GetRTManager()->CheckPendingASBuilds(); } if(IsCaptureMode(m_State)) diff --git a/renderdoc/driver/d3d12/d3d12_device.cpp b/renderdoc/driver/d3d12/d3d12_device.cpp index 3ce0b0b61..3c450ee90 100644 --- a/renderdoc/driver/d3d12/d3d12_device.cpp +++ b/renderdoc/driver/d3d12/d3d12_device.cpp @@ -2565,8 +2565,7 @@ bool WrappedID3D12Device::Serialise_BeginCaptureFrame(SerialiserType &ser) m_InitialResourceStates = m_ResourceStates; GetDebugManager()->PrepareExecuteIndirectPatching(m_OrigGPUAddresses); - GetResourceManager()->GetRaytracingResourceAndUtilHandler()->PrepareRayDispatchBuffer( - &m_OrigGPUAddresses); + GetResourceManager()->GetRTManager()->PrepareRayDispatchBuffer(&m_OrigGPUAddresses); } std::map initialStates; @@ -2662,7 +2661,7 @@ void WrappedID3D12Device::StartFrameCapture(DeviceOwnedWindow devWnd) GPUSyncAllQueues(); // wait until we've synced all queues to check for these - GetResourceManager()->GetRaytracingResourceAndUtilHandler()->CheckPendingASBuilds(); + GetResourceManager()->GetRTManager()->CheckPendingASBuilds(); GetResourceManager()->PrepareInitialContents(); @@ -4177,7 +4176,7 @@ void WrappedID3D12Device::CreateInternalResources() } } - GetResourceManager()->GetRaytracingResourceAndUtilHandler()->CreateInternalResources(); + GetResourceManager()->GetRTManager()->CreateInternalResources(); // we don't want replay-only shaders added in WrappedID3D12Shader to pollute the list of resources WrappedID3D12Shader::InternalResources(true); @@ -4276,7 +4275,7 @@ void WrappedID3D12Device::CreateInternalResources() m_Replay->CreateResources(); WrappedID3D12Shader::InternalResources(false); - GetResourceManager()->GetRaytracingResourceAndUtilHandler()->InitInternalResources(); + GetResourceManager()->GetRTManager()->InitInternalResources(); } void WrappedID3D12Device::DestroyInternalResources() diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap.cpp index b9b66fd37..8e0a6db78 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap.cpp @@ -1180,8 +1180,7 @@ bool WrappedID3D12Device::Serialise_CreateRootSignature(SerialiserType &ser, UIN if(wrapped->sig.Flags & D3D12_ROOT_SIGNATURE_FLAG_LOCAL_ROOT_SIGNATURE) wrapped->localRootSigIdx = - GetResourceManager()->GetRaytracingResourceAndUtilHandler()->RegisterLocalRootSig( - wrapped->sig); + GetResourceManager()->GetRTManager()->RegisterLocalRootSig(wrapped->sig); { StructuredSerialiser structuriser(ser.GetStructuredFile().chunks.back(), &GetChunkName); @@ -1250,8 +1249,7 @@ HRESULT WrappedID3D12Device::CreateRootSignature(UINT nodeMask, const void *pBlo if(wrapped->sig.Flags & D3D12_ROOT_SIGNATURE_FLAG_LOCAL_ROOT_SIGNATURE) wrapped->localRootSigIdx = - GetResourceManager()->GetRaytracingResourceAndUtilHandler()->RegisterLocalRootSig( - wrapped->sig); + GetResourceManager()->GetRTManager()->RegisterLocalRootSig(wrapped->sig); if(!m_BindlessResourceUseActive) { diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap14.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap14.cpp index 52b0af6e2..287ed8027 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap14.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap14.cpp @@ -129,8 +129,7 @@ bool WrappedID3D12Device::Serialise_CreateRootSignatureFromSubobjectInLibrary( if(wrapped->sig.Flags & D3D12_ROOT_SIGNATURE_FLAG_LOCAL_ROOT_SIGNATURE) wrapped->localRootSigIdx = - GetResourceManager()->GetRaytracingResourceAndUtilHandler()->RegisterLocalRootSig( - wrapped->sig); + GetResourceManager()->GetRTManager()->RegisterLocalRootSig(wrapped->sig); { StructuredSerialiser structuriser(ser.GetStructuredFile().chunks.back(), &GetChunkName); @@ -201,8 +200,7 @@ HRESULT WrappedID3D12Device::CreateRootSignatureFromSubobjectInLibrary( if(wrapped->sig.Flags & D3D12_ROOT_SIGNATURE_FLAG_LOCAL_ROOT_SIGNATURE) wrapped->localRootSigIdx = - GetResourceManager()->GetRaytracingResourceAndUtilHandler()->RegisterLocalRootSig( - wrapped->sig); + GetResourceManager()->GetRTManager()->RegisterLocalRootSig(wrapped->sig); if(!m_BindlessResourceUseActive) { diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap5.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap5.cpp index 561411060..a86dfdb48 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap5.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap5.cpp @@ -175,8 +175,8 @@ bool WrappedID3D12Device::Serialise_CreateStateObject(SerialiserType &ser, WrappedID3D12StateObject *wrapped = new WrappedID3D12StateObject( GetResourceManager()->CreateDeferredHandle(), true, this); - wrapped->exports = new D3D12ShaderExportDatabase( - pStateObject, GetResourceManager()->GetRaytracingResourceAndUtilHandler()); + wrapped->exports = + new D3D12ShaderExportDatabase(pStateObject, GetResourceManager()->GetRTManager()); // TODO: Apply m_GlobalEXTUAV, m_GlobalEXTUAVSpace for processing extensions in the DXBC files? @@ -286,8 +286,8 @@ WrappedID3D12Device::CreateStateObject(const D3D12_STATE_OBJECT_DESC *pDesc, REF SCOPED_SERIALISE_CHUNK(D3D12Chunk::Device_CreateStateObject); Serialise_CreateStateObject(ser, pDesc, riid, (void **)&wrapped); - wrapped->exports = new D3D12ShaderExportDatabase( - wrapped->GetResourceID(), GetResourceManager()->GetRaytracingResourceAndUtilHandler()); + wrapped->exports = new D3D12ShaderExportDatabase(wrapped->GetResourceID(), + GetResourceManager()->GetRTManager()); wrapped->exports->SetObjectProperties(wrapped->GetProperties()); diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap7.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap7.cpp index c9f75fe93..7b85a3f44 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap7.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap7.cpp @@ -134,8 +134,8 @@ bool WrappedID3D12Device::Serialise_AddToStateObject(SerialiserType &ser, // TODO: Apply m_GlobalEXTUAV, m_GlobalEXTUAVSpace for processing extensions in the DXBC files? - wrapped->exports = new D3D12ShaderExportDatabase( - pNewStateObject, GetResourceManager()->GetRaytracingResourceAndUtilHandler()); + wrapped->exports = + new D3D12ShaderExportDatabase(pNewStateObject, GetResourceManager()->GetRTManager()); AddResource(pNewStateObject, ResourceType::PipelineState, "State Object"); DerivedResource(pStateObjectToGrowFrom, pNewStateObject); @@ -250,8 +250,8 @@ HRESULT STDMETHODCALLTYPE WrappedID3D12Device::AddToStateObject( SCOPED_SERIALISE_CHUNK(D3D12Chunk::Device_AddToStateObject); Serialise_AddToStateObject(ser, pAddition, pStateObjectToGrowFrom, riid, (void **)&wrapped); - wrapped->exports = new D3D12ShaderExportDatabase( - wrapped->GetResourceID(), GetResourceManager()->GetRaytracingResourceAndUtilHandler()); + wrapped->exports = new D3D12ShaderExportDatabase(wrapped->GetResourceID(), + GetResourceManager()->GetRTManager()); wrapped->exports->SetObjectProperties(wrapped->GetProperties()); diff --git a/renderdoc/driver/d3d12/d3d12_initstate.cpp b/renderdoc/driver/d3d12/d3d12_initstate.cpp index fbd0cee48..394c670aa 100644 --- a/renderdoc/driver/d3d12/d3d12_initstate.cpp +++ b/renderdoc/driver/d3d12/d3d12_initstate.cpp @@ -409,7 +409,7 @@ bool D3D12ResourceManager::Prepare_InitialState(ID3D12DeviceChild *res) // get the size { - D3D12GpuBuffer *ASQueryBuffer = GetRaytracingResourceAndUtilHandler()->ASQueryBuffer; + D3D12GpuBuffer *ASQueryBuffer = GetRTManager()->ASQueryBuffer; list4 = Unwrap4(m_Device->GetInitialStateList()); @@ -440,7 +440,7 @@ bool D3D12ResourceManager::Prepare_InitialState(ID3D12DeviceChild *res) ASQueryBuffer->Unmap(); // no other copies are in flight because of the above sync so we can resize this - GetRaytracingResourceAndUtilHandler()->ResizeSerialisationBuffer(desc.Width); + GetRTManager()->ResizeSerialisationBuffer(desc.Width); } ID3D12Resource *copyDst = NULL; @@ -456,7 +456,7 @@ bool D3D12ResourceManager::Prepare_InitialState(ID3D12DeviceChild *res) if(SUCCEEDED(hr)) { - D3D12GpuBuffer *ASSerialiseBuffer = GetRaytracingResourceAndUtilHandler()->ASSerialiseBuffer; + D3D12GpuBuffer *ASSerialiseBuffer = GetRTManager()->ASSerialiseBuffer; list4->CopyRaytracingAccelerationStructure( ASSerialiseBuffer->Address(), r->GetVirtualAddress(), diff --git a/renderdoc/driver/d3d12/d3d12_manager.cpp b/renderdoc/driver/d3d12/d3d12_manager.cpp index 5ca9ae704..8812d691e 100644 --- a/renderdoc/driver/d3d12/d3d12_manager.cpp +++ b/renderdoc/driver/d3d12/d3d12_manager.cpp @@ -691,8 +691,8 @@ D3D12Descriptor *DescriptorFromPortableHandle(D3D12ResourceManager *manager, Por #define BARRIER_ASSERT(...) #endif -D3D12RaytracingResourceAndUtilHandler::D3D12RaytracingResourceAndUtilHandler( - WrappedID3D12Device *device, D3D12GpuBufferAllocator &gpuBufferAllocator) +D3D12RTManager::D3D12RTManager(WrappedID3D12Device *device, + D3D12GpuBufferAllocator &gpuBufferAllocator) : m_wrappedDevice(device), m_cmdList(NULL), m_cmdAlloc(NULL), @@ -704,7 +704,7 @@ D3D12RaytracingResourceAndUtilHandler::D3D12RaytracingResourceAndUtilHandler( { } -void D3D12RaytracingResourceAndUtilHandler::CreateInternalResources() +void D3D12RTManager::CreateInternalResources() { if(m_wrappedDevice) { @@ -756,7 +756,7 @@ void D3D12RaytracingResourceAndUtilHandler::CreateInternalResources() } } -void D3D12RaytracingResourceAndUtilHandler::SyncGpuForRtWork() +void D3D12RTManager::SyncGpuForRtWork() { m_gpuSyncCounter++; @@ -771,7 +771,7 @@ void D3D12RaytracingResourceAndUtilHandler::SyncGpuForRtWork() WaitForSingleObject(m_gpuSyncHandle, 10000); } -void D3D12RaytracingResourceAndUtilHandler::InitInternalResources() +void D3D12RTManager::InitInternalResources() { if(IsReplayMode(m_wrappedDevice->GetState())) { @@ -780,7 +780,7 @@ void D3D12RaytracingResourceAndUtilHandler::InitInternalResources() InitRayDispatchPatchingResources(); } -void D3D12RaytracingResourceAndUtilHandler::ResizeSerialisationBuffer(UINT64 size) +void D3D12RTManager::ResizeSerialisationBuffer(UINT64 size) { if(!ASSerialiseBuffer || size > ASSerialiseBuffer->Size()) { @@ -791,8 +791,8 @@ void D3D12RaytracingResourceAndUtilHandler::ResizeSerialisationBuffer(UINT64 siz } } -void D3D12RaytracingResourceAndUtilHandler::AddPendingASBuilds( - ID3D12Fence *fence, UINT64 waitValue, const rdcarray> &callbacks) +void D3D12RTManager::AddPendingASBuilds(ID3D12Fence *fence, UINT64 waitValue, + const rdcarray> &callbacks) { SCOPED_LOCK(m_PendingASBuildsLock); for(const std::function &cb : callbacks) @@ -802,7 +802,7 @@ void D3D12RaytracingResourceAndUtilHandler::AddPendingASBuilds( } } -void D3D12RaytracingResourceAndUtilHandler::CheckPendingASBuilds() +void D3D12RTManager::CheckPendingASBuilds() { std::map fenceValues; SCOPED_LOCK(m_PendingASBuildsLock); @@ -828,9 +828,9 @@ void D3D12RaytracingResourceAndUtilHandler::CheckPendingASBuilds() m_PendingASBuilds.removeIf([](const PendingASBuild &build) { return build.fence == NULL; }); } -PatchedRayDispatch D3D12RaytracingResourceAndUtilHandler::PatchRayDispatch( - ID3D12GraphicsCommandList4 *unwrappedCmd, rdcarray heaps, - const D3D12_DISPATCH_RAYS_DESC &desc) +PatchedRayDispatch D3D12RTManager::PatchRayDispatch(ID3D12GraphicsCommandList4 *unwrappedCmd, + rdcarray heaps, + const D3D12_DISPATCH_RAYS_DESC &desc) { PatchedRayDispatch ret = {}; @@ -1005,7 +1005,7 @@ PatchedRayDispatch D3D12RaytracingResourceAndUtilHandler::PatchRayDispatch( return ret; } -PatchedRayDispatch D3D12RaytracingResourceAndUtilHandler::PatchIndirectRayDispatch( +PatchedRayDispatch D3D12RTManager::PatchIndirectRayDispatch( ID3D12GraphicsCommandList *unwrappedCmd, rdcarray heaps, ID3D12CommandSignature *pCommandSignature, UINT MaxCommandCount, ID3D12Resource *pArgumentBuffer, UINT64 ArgumentBufferOffset, ID3D12Resource *pCountBuffer, UINT64 CountBufferOffset) @@ -1162,8 +1162,7 @@ PatchedRayDispatch D3D12RaytracingResourceAndUtilHandler::PatchIndirectRayDispat return ret; } -void D3D12RaytracingResourceAndUtilHandler::PrepareRayDispatchBuffer( - const GPUAddressRangeTracker *origAddresses) +void D3D12RTManager::PrepareRayDispatchBuffer(const GPUAddressRangeTracker *origAddresses) { SCOPED_LOCK(m_LookupBufferLock); if(m_LookupBufferDirty || origAddresses) @@ -1266,7 +1265,7 @@ void D3D12RaytracingResourceAndUtilHandler::PrepareRayDispatchBuffer( } } -void D3D12RaytracingResourceAndUtilHandler::InitRayDispatchPatchingResources() +void D3D12RTManager::InitRayDispatchPatchingResources() { D3D12ShaderCache *shaderCache = m_wrappedDevice->GetShaderCache(); @@ -1560,7 +1559,7 @@ void D3D12RaytracingResourceAndUtilHandler::InitRayDispatchPatchingResources() } } -void D3D12RaytracingResourceAndUtilHandler::InitReplayBlasPatchingResources() +void D3D12RTManager::InitReplayBlasPatchingResources() { // Root Signature rdcarray rootParameters; @@ -1641,7 +1640,7 @@ void D3D12RaytracingResourceAndUtilHandler::InitReplayBlasPatchingResources() } } -uint32_t D3D12RaytracingResourceAndUtilHandler::RegisterLocalRootSig(const D3D12RootSignature &sig) +uint32_t D3D12RTManager::RegisterLocalRootSig(const D3D12RootSignature &sig) { rdcarray patchOffsets; uint32_t offset = D3D12_SHADER_IDENTIFIER_SIZE_IN_BYTES; @@ -1686,7 +1685,7 @@ uint32_t D3D12RaytracingResourceAndUtilHandler::RegisterLocalRootSig(const D3D12 return idx; } -void D3D12RaytracingResourceAndUtilHandler::RegisterExportDatabase(D3D12ShaderExportDatabase *db) +void D3D12RTManager::RegisterExportDatabase(D3D12ShaderExportDatabase *db) { SCOPED_LOCK(m_LookupBufferLock); m_ExportDatabases.push_back(db); @@ -1694,7 +1693,7 @@ void D3D12RaytracingResourceAndUtilHandler::RegisterExportDatabase(D3D12ShaderEx m_LookupBufferDirty = true; } -void D3D12RaytracingResourceAndUtilHandler::UnregisterExportDatabase(D3D12ShaderExportDatabase *db) +void D3D12RTManager::UnregisterExportDatabase(D3D12ShaderExportDatabase *db) { SCOPED_LOCK(m_LookupBufferLock); m_ExportDatabases.removeOne(db); diff --git a/renderdoc/driver/d3d12/d3d12_manager.h b/renderdoc/driver/d3d12/d3d12_manager.h index fc6667c42..acc939147 100644 --- a/renderdoc/driver/d3d12/d3d12_manager.h +++ b/renderdoc/driver/d3d12/d3d12_manager.h @@ -1025,11 +1025,10 @@ struct PatchedRayDispatch struct D3D12ShaderExportDatabase; -class D3D12RaytracingResourceAndUtilHandler +class D3D12RTManager { public: - D3D12RaytracingResourceAndUtilHandler(WrappedID3D12Device *device, - D3D12GpuBufferAllocator &gpuBufferAllocator); + D3D12RTManager(WrappedID3D12Device *device, D3D12GpuBufferAllocator &gpuBufferAllocator); void CreateInternalResources(); @@ -1040,7 +1039,7 @@ public: D3D12AccStructPatchInfo GetAccStructPatchInfo() const { return m_accStructPatchInfo; } void SyncGpuForRtWork(); - ~D3D12RaytracingResourceAndUtilHandler() + ~D3D12RTManager() { SAFE_RELEASE(m_cmdList); SAFE_RELEASE(m_cmdAlloc); @@ -1152,11 +1151,10 @@ public: D3D12ResourceManager(CaptureState &state, WrappedID3D12Device *dev) : ResourceManager(state), m_Device(dev), m_GPUBufferAllocator(dev) { - m_raytracingResourceManager = - new D3D12RaytracingResourceAndUtilHandler(m_Device, m_GPUBufferAllocator); + m_RTManager = new D3D12RTManager(m_Device, m_GPUBufferAllocator); } - ~D3D12ResourceManager() { SAFE_DELETE(m_raytracingResourceManager); } + ~D3D12ResourceManager() { SAFE_DELETE(m_RTManager); } template T *GetLiveAs(ResourceId id, bool optional = false) @@ -1184,10 +1182,7 @@ public: void ApplyBarriers(BarrierSet &barriers, std::map &states); - D3D12RaytracingResourceAndUtilHandler *GetRaytracingResourceAndUtilHandler() const - { - return m_raytracingResourceManager; - } + D3D12RTManager *GetRTManager() const { return m_RTManager; } D3D12GpuBufferAllocator &GetGPUBufferAllocator() { return m_GPUBufferAllocator; } @@ -1218,7 +1213,7 @@ private: void Apply_InitialState(ID3D12DeviceChild *live, const D3D12InitialContents &data); WrappedID3D12Device *m_Device; - D3D12RaytracingResourceAndUtilHandler *m_raytracingResourceManager; + D3D12RTManager *m_RTManager; D3D12GpuBufferAllocator m_GPUBufferAllocator; // dummy handle to use - starting from near highest valid pointer to minimise risk of overlap with real handles diff --git a/renderdoc/driver/d3d12/d3d12_resources.cpp b/renderdoc/driver/d3d12/d3d12_resources.cpp index 1d6bc449d..9b211db62 100644 --- a/renderdoc/driver/d3d12/d3d12_resources.cpp +++ b/renderdoc/driver/d3d12/d3d12_resources.cpp @@ -839,8 +839,7 @@ void WrappedID3D12PipelineState::ProcessDescriptorAccess() } } -D3D12ShaderExportDatabase::D3D12ShaderExportDatabase(ResourceId id, - D3D12RaytracingResourceAndUtilHandler *rayManager) +D3D12ShaderExportDatabase::D3D12ShaderExportDatabase(ResourceId id, D3D12RTManager *rayManager) : RefCounter12(NULL), objectOriginalId(id), m_RayManager(rayManager) { m_RayManager->RegisterExportDatabase(this); diff --git a/renderdoc/driver/d3d12/d3d12_resources.h b/renderdoc/driver/d3d12/d3d12_resources.h index 3578b3761..9c9d506c1 100644 --- a/renderdoc/driver/d3d12/d3d12_resources.h +++ b/renderdoc/driver/d3d12/d3d12_resources.h @@ -1036,7 +1036,7 @@ typedef WrappedID3D12PipelineState::ShaderEntry WrappedID3D12Shader; struct D3D12ShaderExportDatabase : public RefCounter12 { public: - D3D12ShaderExportDatabase(ResourceId id, D3D12RaytracingResourceAndUtilHandler *rayManager); + D3D12ShaderExportDatabase(ResourceId id, D3D12RTManager *rayManager); ~D3D12ShaderExportDatabase(); void SetObjectProperties(ID3D12StateObjectProperties *obj) { m_StateObjectProps = obj; } @@ -1085,7 +1085,7 @@ private: rdcarray parents; ID3D12StateObjectProperties *m_StateObjectProps = NULL; - D3D12RaytracingResourceAndUtilHandler *m_RayManager = NULL; + D3D12RTManager *m_RayManager = NULL; struct ExportLookup {