diff --git a/renderdoc/core/resource_manager.h b/renderdoc/core/resource_manager.h index a238ca4f9..f8c7ee1dd 100644 --- a/renderdoc/core/resource_manager.h +++ b/renderdoc/core/resource_manager.h @@ -632,9 +632,6 @@ public: /////////////////////////////////////////// // Replay-side methods - // resources which are owned by the resource manager and so automatically released on shutdown - void TakeResourceOwnership(WrappedResourceType res); - // when asked for a given id, return the resource for a replacement id void ReplaceResource(ResourceId from, ResourceId to); bool HasReplacement(ResourceId from); @@ -744,9 +741,6 @@ protected: // capture and replay. std::unordered_map m_ResourceMap; - // used during replay - holds resources allocated for replay which should be automatically destroyed on shutdown - rdcarray m_OwnedResources; - // used during capture - holds resource records by id. std::unordered_map m_ResourceRecords; Threading::RWLock m_ResourceRecordLock; @@ -809,13 +803,18 @@ void ResourceManager::Shutdown() { FreeInitialContents(); - while(!m_OwnedResources.empty()) + if(!m_Capturing) { - WrappedResourceType it = m_OwnedResources.back(); - ResourceTypeRelease(it); + while(!m_ResourceMap.empty()) + { + auto it = m_ResourceMap.begin(); + ResourceId id = it->first; + ResourceTypeRelease(it->second); - if(it == m_OwnedResources.back()) - m_OwnedResources.pop_back(); + auto removeit = m_ResourceMap.find(id); + if(removeit != m_ResourceMap.end()) + m_ResourceMap.erase(removeit); + } } RDCASSERT(m_ResourceRecords.empty()); @@ -824,7 +823,7 @@ void ResourceManager::Shutdown() template ResourceManager::~ResourceManager() { - RDCASSERT(m_OwnedResources.empty()); + RDCASSERT(m_ResourceMap.empty()); RDCASSERT(m_InitialContents.empty()); RDCASSERT(m_ResourceRecords.empty()); @@ -1829,14 +1828,6 @@ typename Configuration::WrappedResourceType ResourceManager::GetW return m_WrapperMap[real]; } -template -void ResourceManager::TakeResourceOwnership(WrappedResourceType res) -{ - RDCASSERT(!m_Capturing); - - m_OwnedResources.push_back(res); -} - template typename Configuration::WrappedResourceType ResourceManager::GetResource(ResourceId id, bool optional) @@ -1900,12 +1891,7 @@ void ResourceManager::ReleaseResource(ResourceId id) if(IsActiveCapturing(m_State)) Prepare_InitialStateIfPostponed(id, true); - { - auto it = m_ResourceMap.find(id); - m_OwnedResources.removeOne(it->second); - m_ResourceMap.erase(it); - } - + m_ResourceMap.erase(id); m_DirtyResources.erase(id); auto it = std::lower_bound(m_ResourceRefTimes.begin(), m_ResourceRefTimes.end(), id); diff --git a/renderdoc/driver/d3d11/d3d11_device.cpp b/renderdoc/driver/d3d11/d3d11_device.cpp index cadd36cf9..e8a9308da 100644 --- a/renderdoc/driver/d3d11/d3d11_device.cpp +++ b/renderdoc/driver/d3d11/d3d11_device.cpp @@ -1036,7 +1036,6 @@ bool WrappedID3D11Device::ProcessChunk(ReadSerialiser &ser, D3D11Chunk context) { m_pImmediateContext->AddRef(); m_pImmediateContext->SetReplayResourceID(ImmediateContext); - m_ResourceManager->TakeResourceOwnership(m_pImmediateContext); ResourceId descId = m_pImmediateContext->GetDescriptorsID(); AddResource(descId, ResourceType::DescriptorStore, ""); @@ -1734,8 +1733,6 @@ bool WrappedID3D11Device::Serialise_WrapSwapchainBuffer(SerialiserType &ser, IDX wrapped->m_RealDescriptor = new D3D11_TEXTURE2D_DESC(realDescriptor); SetDebugName(fakeBB, "Serialised Swap Chain Buffer"); - - GetResourceManager()->TakeResourceOwnership(fakeBB); } } @@ -1800,10 +1797,6 @@ IUnknown *WrappedID3D11Device::WrapSwapchainBuffer(IDXGISwapper *swapper, DXGI_F record->AddChunk(scope.Get()); } - else - { - GetResourceManager()->TakeResourceOwnership(pTex); - } } if(buffer == 0 && IsCaptureMode(m_State) && m_SwapChains[swapper] == NULL) diff --git a/renderdoc/driver/d3d11/d3d11_device1_wrap.cpp b/renderdoc/driver/d3d11/d3d11_device1_wrap.cpp index 63f7f7281..eb4d80ba9 100644 --- a/renderdoc/driver/d3d11/d3d11_device1_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_device1_wrap.cpp @@ -107,14 +107,10 @@ bool WrappedID3D11Device::Serialise_CreateBlendState1(SerialiserType &ser, ret->Release(); ret = (ID3D11BlendState1 *)GetResourceManager()->GetWrapper(ret); ret->AddRef(); - - GetResourceManager()->TakeResourceOwnership(ret); } else { ret = new WrappedID3D11BlendState1(pState, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } } @@ -225,14 +221,10 @@ bool WrappedID3D11Device::Serialise_CreateRasterizerState1( ret->Release(); ret = (ID3D11RasterizerState1 *)GetResourceManager()->GetWrapper(ret); ret->AddRef(); - - GetResourceManager()->TakeResourceOwnership(ret); } else { ret = new WrappedID3D11RasterizerState2(pState, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } } diff --git a/renderdoc/driver/d3d11/d3d11_device3_wrap.cpp b/renderdoc/driver/d3d11/d3d11_device3_wrap.cpp index b6fd44f86..3bd037d89 100644 --- a/renderdoc/driver/d3d11/d3d11_device3_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_device3_wrap.cpp @@ -97,8 +97,6 @@ bool WrappedID3D11Device::Serialise_CreateTexture2D1(SerialiserType &ser, else { ret = new WrappedID3D11Texture2D1(pTexture, (ID3D11Texture2D1 *)ret, this, dispType); - - GetResourceManager()->TakeResourceOwnership(ret); } const char *prefix = Descriptor.ArraySize > 1 ? "2D TextureArray" : "2D Texture"; @@ -163,10 +161,6 @@ HRESULT WrappedID3D11Device::CreateTexture2D1(const D3D11_TEXTURE2D_DESC1 *pDesc record->AddChunk(chunk); record->SetDataPtr(chunk->GetData()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } *ppTexture2D = wrapped; } @@ -240,8 +234,6 @@ bool WrappedID3D11Device::Serialise_CreateTexture3D1(SerialiserType &ser, else { ret = new WrappedID3D11Texture3D1(pTexture, (ID3D11Texture3D1 *)ret, this, dispType); - - GetResourceManager()->TakeResourceOwnership(ret); } const char *prefix = "3D Texture"; @@ -302,10 +294,6 @@ HRESULT WrappedID3D11Device::CreateTexture3D1(const D3D11_TEXTURE3D_DESC1 *pDesc record->AddChunk(chunk); record->SetDataPtr(chunk->GetData()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } *ppTexture3D = wrapped; } @@ -386,8 +374,6 @@ bool WrappedID3D11Device::Serialise_CreateShaderResourceView1( else { ret = new WrappedID3D11ShaderResourceView1(pView, ret, pResource, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pView, ResourceType::View, "Shader Resource View"); @@ -525,8 +511,6 @@ bool WrappedID3D11Device::Serialise_CreateRenderTargetView1(SerialiserType &ser, else { ret = new WrappedID3D11RenderTargetView1(pView, ret, pResource, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pView, ResourceType::View, "Render Target View"); @@ -634,8 +618,6 @@ bool WrappedID3D11Device::Serialise_CreateUnorderedAccessView1( else { ret = new WrappedID3D11UnorderedAccessView1(pView, ret, pResource, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pView, ResourceType::View, "Unordered Access View"); @@ -757,14 +739,10 @@ bool WrappedID3D11Device::Serialise_CreateRasterizerState2( ret->Release(); ret = (ID3D11RasterizerState2 *)GetResourceManager()->GetWrapper(ret); ret->AddRef(); - - GetResourceManager()->TakeResourceOwnership(ret); } else { ret = new WrappedID3D11RasterizerState2(pState, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } } @@ -873,8 +851,6 @@ bool WrappedID3D11Device::Serialise_CreateQuery1(SerialiserType &ser, else { ret = new WrappedID3D11Query1(pQuery, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pQuery, ResourceType::Query, "Query"); diff --git a/renderdoc/driver/d3d11/d3d11_device_wrap.cpp b/renderdoc/driver/d3d11/d3d11_device_wrap.cpp index 85a4cea63..ebf8f5b4d 100644 --- a/renderdoc/driver/d3d11/d3d11_device_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_device_wrap.cpp @@ -126,8 +126,6 @@ bool WrappedID3D11Device::Serialise_CreateBuffer(SerialiserType &ser, const D3D1 else { ret = new WrappedID3D11Buffer(pBuffer, ret, Descriptor.ByteWidth, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pBuffer, ResourceType::Buffer, "Buffer"); @@ -243,10 +241,6 @@ HRESULT WrappedID3D11Device::CreateBuffer(const D3D11_BUFFER_DESC *pDesc, record->AddChunk(chunk); record->SetDataPtr(chunk->GetData()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } *ppBuffer = wrapped; } @@ -438,8 +432,6 @@ bool WrappedID3D11Device::Serialise_CreateTexture1D(SerialiserType &ser, else { ret = new WrappedID3D11Texture1D(pTexture, ret, this, dispType); - - GetResourceManager()->TakeResourceOwnership(ret); } const char *prefix = Descriptor.ArraySize > 1 ? "1D TextureArray" : "1D Texture"; @@ -498,10 +490,6 @@ HRESULT WrappedID3D11Device::CreateTexture1D(const D3D11_TEXTURE1D_DESC *pDesc, record->AddChunk(chunk); record->SetDataPtr(chunk->GetData()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } *ppTexture1D = wrapped; } @@ -575,8 +563,6 @@ bool WrappedID3D11Device::Serialise_CreateTexture2D(SerialiserType &ser, else { ret = new WrappedID3D11Texture2D1(pTexture, ret, this, dispType); - - GetResourceManager()->TakeResourceOwnership(ret); } const char *prefix = Descriptor.ArraySize > 1 ? "2D TextureArray" : "2D Texture"; @@ -639,10 +625,6 @@ HRESULT WrappedID3D11Device::CreateTexture2D(const D3D11_TEXTURE2D_DESC *pDesc, record->AddChunk(chunk); record->SetDataPtr(chunk->GetData()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } *ppTexture2D = wrapped; } @@ -715,8 +697,6 @@ bool WrappedID3D11Device::Serialise_CreateTexture3D(SerialiserType &ser, else { ret = new WrappedID3D11Texture3D1(pTexture, ret, this, dispType); - - GetResourceManager()->TakeResourceOwnership(ret); } const char *prefix = "3D Texture"; @@ -775,10 +755,6 @@ HRESULT WrappedID3D11Device::CreateTexture3D(const D3D11_TEXTURE3D_DESC *pDesc, record->AddChunk(chunk); record->SetDataPtr(chunk->GetData()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } *ppTexture3D = wrapped; } @@ -854,8 +830,6 @@ bool WrappedID3D11Device::Serialise_CreateShaderResourceView( else { ret = new WrappedID3D11ShaderResourceView1(pView, ret, pResource, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pView, ResourceType::View, "Shader Resource View"); @@ -982,8 +956,6 @@ bool WrappedID3D11Device::Serialise_CreateUnorderedAccessView( else { ret = new WrappedID3D11UnorderedAccessView1(pView, ret, pResource, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pView, ResourceType::View, "Unordered Access View"); @@ -1134,8 +1106,6 @@ bool WrappedID3D11Device::Serialise_CreateRenderTargetView(SerialiserType &ser, else { ret = new WrappedID3D11RenderTargetView1(pView, ret, pResource, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pView, ResourceType::View, "Render Target View"); @@ -1234,8 +1204,6 @@ bool WrappedID3D11Device::Serialise_CreateDepthStencilView( else { ret = new WrappedID3D11DepthStencilView(pView, ret, pResource, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pView, ResourceType::View, "Depth Stencil View"); @@ -1342,8 +1310,6 @@ bool WrappedID3D11Device::Serialise_CreateInputLayout( else { ret = new WrappedID3D11InputLayout(pInputLayout, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pInputLayout, ResourceType::StateObject, "Input Layout"); @@ -1442,8 +1408,6 @@ bool WrappedID3D11Device::Serialise_CreateVertexShader(SerialiserType &ser, { ret = new WrappedID3D11Shader(pShader, ret, (const byte *)pShaderBytecode, (size_t)BytecodeLength, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pShader, ResourceType::Shader, "Vertex Shader"); @@ -1531,8 +1495,6 @@ HRESULT WrappedID3D11Device::CreateVertexShader(const void *pShaderBytecode, SIZ if(m_GlobalEXTUAV != ~0U) w->SetShaderExtSlot(m_GlobalEXTUAV); - - GetResourceManager()->TakeResourceOwnership(wrapped); } *ppVertexShader = wrapped; @@ -1577,8 +1539,6 @@ bool WrappedID3D11Device::Serialise_CreateGeometryShader(SerialiserType &ser, { ret = new WrappedID3D11Shader( pShader, ret, (const byte *)pShaderBytecode, (size_t)BytecodeLength, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pShader, ResourceType::Shader, "Geometry Shader"); @@ -1669,8 +1629,6 @@ HRESULT WrappedID3D11Device::CreateGeometryShader(const void *pShaderBytecode, S if(m_GlobalEXTUAV != ~0U) w->SetShaderExtSlot(m_GlobalEXTUAV); - - GetResourceManager()->TakeResourceOwnership(wrapped); } *ppGeometryShader = wrapped; @@ -1721,8 +1679,6 @@ bool WrappedID3D11Device::Serialise_CreateGeometryShaderWithStreamOutput( { ret = new WrappedID3D11Shader( pShader, ret, (const byte *)pShaderBytecode, (size_t)BytecodeLength, this); - - GetResourceManager()->TakeResourceOwnership(ret); } D3D_PRIMITIVE_TOPOLOGY topo = @@ -1890,8 +1846,6 @@ HRESULT WrappedID3D11Device::CreateGeometryShaderWithStreamOutput( if(m_GlobalEXTUAV != ~0U) w->SetShaderExtSlot(m_GlobalEXTUAV); - - GetResourceManager()->TakeResourceOwnership(wrapped); } *ppGeometryShader = wrapped; @@ -1935,8 +1889,6 @@ bool WrappedID3D11Device::Serialise_CreatePixelShader(SerialiserType &ser, { ret = new WrappedID3D11Shader(pShader, ret, (const byte *)pShaderBytecode, (size_t)BytecodeLength, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pShader, ResourceType::Shader, "Pixel Shader"); @@ -2025,8 +1977,6 @@ HRESULT WrappedID3D11Device::CreatePixelShader(const void *pShaderBytecode, SIZE if(m_GlobalEXTUAV != ~0U) w->SetShaderExtSlot(m_GlobalEXTUAV); - - GetResourceManager()->TakeResourceOwnership(wrapped); } *ppPixelShader = wrapped; @@ -2069,8 +2019,6 @@ bool WrappedID3D11Device::Serialise_CreateHullShader(SerialiserType &ser, const { ret = new WrappedID3D11Shader(pShader, ret, (const byte *)pShaderBytecode, (size_t)BytecodeLength, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pShader, ResourceType::Shader, "Hull Shader"); @@ -2159,8 +2107,6 @@ HRESULT WrappedID3D11Device::CreateHullShader(const void *pShaderBytecode, SIZE_ if(m_GlobalEXTUAV != ~0U) w->SetShaderExtSlot(m_GlobalEXTUAV); - - GetResourceManager()->TakeResourceOwnership(wrapped); } *ppHullShader = wrapped; @@ -2205,8 +2151,6 @@ bool WrappedID3D11Device::Serialise_CreateDomainShader(SerialiserType &ser, { ret = new WrappedID3D11Shader(pShader, ret, (const byte *)pShaderBytecode, (size_t)BytecodeLength, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pShader, ResourceType::Shader, "Domain Shader"); @@ -2296,8 +2240,6 @@ HRESULT WrappedID3D11Device::CreateDomainShader(const void *pShaderBytecode, SIZ if(m_GlobalEXTUAV != ~0U) w->SetShaderExtSlot(m_GlobalEXTUAV); - - GetResourceManager()->TakeResourceOwnership(wrapped); } *ppDomainShader = wrapped; @@ -2342,8 +2284,6 @@ bool WrappedID3D11Device::Serialise_CreateComputeShader(SerialiserType &ser, { ret = new WrappedID3D11Shader( pShader, ret, (const byte *)pShaderBytecode, (size_t)BytecodeLength, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pShader, ResourceType::Shader, "Compute Shader"); @@ -2434,8 +2374,6 @@ HRESULT WrappedID3D11Device::CreateComputeShader(const void *pShaderBytecode, SI if(m_GlobalEXTUAV != ~0U) w->SetShaderExtSlot(m_GlobalEXTUAV); - - GetResourceManager()->TakeResourceOwnership(wrapped); } *ppComputeShader = wrapped; @@ -2488,8 +2426,6 @@ bool WrappedID3D11Device::Serialise_CreateClassInstance(SerialiserType &ser, LPC { FlushPendingDead(); wrapped = new WrappedID3D11ClassInstance(pInstance, real, pClassLinkage, this); - - GetResourceManager()->TakeResourceOwnership(wrapped); } AddResource(pInstance, ResourceType::ShaderBinding, "Class Instance"); @@ -2562,8 +2498,6 @@ bool WrappedID3D11Device::Serialise_GetClassInstance(SerialiserType &ser, LPCSTR { FlushPendingDead(); wrapped = new WrappedID3D11ClassInstance(pInstance, real, pClassLinkage, this); - - GetResourceManager()->TakeResourceOwnership(wrapped); } AddResource(pInstance, ResourceType::ShaderBinding, "Class Instance"); @@ -2627,8 +2561,6 @@ bool WrappedID3D11Device::Serialise_CreateClassLinkage(SerialiserType &ser, else { ret = new WrappedID3D11ClassLinkage(pLinkage, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pLinkage, ResourceType::ShaderBinding, "Class Linkage"); @@ -2702,14 +2634,10 @@ bool WrappedID3D11Device::Serialise_CreateBlendState(SerialiserType &ser, ret->Release(); ret = (ID3D11BlendState *)GetResourceManager()->GetWrapper(ret); ret->AddRef(); - - GetResourceManager()->TakeResourceOwnership(ret); } else { ret = new WrappedID3D11BlendState1(pState, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } } @@ -2817,14 +2745,10 @@ bool WrappedID3D11Device::Serialise_CreateDepthStencilState( ret->Release(); ret = (ID3D11DepthStencilState *)GetResourceManager()->GetWrapper(ret); ret->AddRef(); - - GetResourceManager()->TakeResourceOwnership(ret); } else { ret = new WrappedID3D11DepthStencilState(pState, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } } @@ -2930,14 +2854,10 @@ bool WrappedID3D11Device::Serialise_CreateRasterizerState(SerialiserType &ser, ret->Release(); ret = (ID3D11RasterizerState *)GetResourceManager()->GetWrapper(ret); ret->AddRef(); - - GetResourceManager()->TakeResourceOwnership(ret); } else { ret = new WrappedID3D11RasterizerState2(pState, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } } @@ -3043,14 +2963,10 @@ bool WrappedID3D11Device::Serialise_CreateSamplerState(SerialiserType &ser, ret->Release(); ret = (ID3D11SamplerState *)GetResourceManager()->GetWrapper(ret); ret->AddRef(); - - GetResourceManager()->TakeResourceOwnership(ret); } else { ret = new WrappedID3D11SamplerState(pState, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } } @@ -3151,8 +3067,6 @@ bool WrappedID3D11Device::Serialise_CreateQuery(SerialiserType &ser, else { ret = new WrappedID3D11Query1(pQuery, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pQuery, ResourceType::Query, "Query"); @@ -3236,8 +3150,6 @@ bool WrappedID3D11Device::Serialise_CreatePredicate(SerialiserType &ser, else { ret = new WrappedID3D11Predicate(pPredicate, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pPredicate, ResourceType::Query, "Predicate"); @@ -3329,8 +3241,6 @@ bool WrappedID3D11Device::Serialise_CreateCounter(SerialiserType &ser, else { ret = new WrappedID3D11Query1(pCounter, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pCounter, ResourceType::Query, "Counter"); @@ -3418,8 +3328,6 @@ bool WrappedID3D11Device::Serialise_CreateDeferredContext(SerialiserType &ser, ret = ctx; AddDeferredContext((WrappedID3D11DeviceContext *)ret); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pDeferredContext, ResourceType::CommandBuffer, "Deferred Context"); @@ -3545,8 +3453,6 @@ bool WrappedID3D11Device::Serialise_OpenSharedResource(SerialiserType &ser, HAND else { ret = new WrappedID3D11Buffer(pResource, ret, Descriptor.ByteWidth, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pResource, ResourceType::Buffer, "Shared Buffer"); @@ -3620,8 +3526,6 @@ bool WrappedID3D11Device::Serialise_OpenSharedResource(SerialiserType &ser, HAND else { ret = new WrappedID3D11Texture1D(pResource, ret, this, dispType); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pResource, ResourceType::Texture, "Shared 1D Texture"); @@ -3665,8 +3569,6 @@ bool WrappedID3D11Device::Serialise_OpenSharedResource(SerialiserType &ser, HAND else { ret = new WrappedID3D11Texture2D1(pResource, ret, this, dispType); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pResource, ResourceType::Texture, "Shared 2D Texture"); @@ -3710,8 +3612,6 @@ bool WrappedID3D11Device::Serialise_OpenSharedResource(SerialiserType &ser, HAND else { ret = new WrappedID3D11Texture3D1(pResource, ret, this, dispType); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pResource, ResourceType::Texture, "Shared 3D Texture"); diff --git a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp index 765cd7c39..e11adeed0 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp @@ -252,8 +252,6 @@ bool WrappedID3D12GraphicsCommandList::Serialise_Reset(SerialiserType &ser, // always create a version of this list even if we're not re-recording, so the serialisation // has an object to find m_Cmd->m_RerecordCmdList.push_back(list); - - GetResourceManager()->TakeResourceOwnership(list); } D3D12RenderState &state = m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].state; @@ -314,8 +312,6 @@ bool WrappedID3D12GraphicsCommandList::Serialise_Reset(SerialiserType &ser, m_pDevice->GetResourceDesc(BakedCommandList).SetCustomName(descr.name + " (Baked)"); } - GetResourceManager()->TakeResourceOwnership(list); - // whenever a command-building chunk asks for the command list, it // will get our baked version. if(GetResourceManager()->HasReplacement(CommandList)) diff --git a/renderdoc/driver/d3d12/d3d12_commands.cpp b/renderdoc/driver/d3d12/d3d12_commands.cpp index 4ece3c5e1..81b6c340c 100644 --- a/renderdoc/driver/d3d12/d3d12_commands.cpp +++ b/renderdoc/driver/d3d12/d3d12_commands.cpp @@ -558,8 +558,6 @@ WrappedID3D12CommandQueue::WrappedID3D12CommandQueue(ResourceId id, ID3D12Comman WrappedID3D12CommandQueue::~WrappedID3D12CommandQueue() { - SAFE_DELETE(m_ReplayList); - SAFE_DELETE(m_FrameReader); SAFE_RELEASE(m_RayFence); diff --git a/renderdoc/driver/d3d12/d3d12_device.cpp b/renderdoc/driver/d3d12/d3d12_device.cpp index 953dcee36..697b65607 100644 --- a/renderdoc/driver/d3d12/d3d12_device.cpp +++ b/renderdoc/driver/d3d12/d3d12_device.cpp @@ -1898,8 +1898,6 @@ bool WrappedID3D12Device::Serialise_WrapSwapchainBuffer(SerialiserType &ser, IDX fakeBB->SetName(L"Swap Chain Buffer"); - GetResourceManager()->TakeResourceOwnership(fakeBB); - m_BackbufferFormat[wrapped->GetResourceID()] = SwapbufferFormat; SubresourceStateVector &states = m_ResourceStates[wrapped->GetResourceID()]; @@ -1969,12 +1967,6 @@ IUnknown *WrappedID3D12Device::WrapSwapchainBuffer(IDXGISwapper *swapper, DXGI_F states = {D3D12ResourceLayout::FromStates(D3D12_RESOURCE_STATE_PRESENT)}; } } - else - { - WrappedID3D12Resource *wrapped = (WrappedID3D12Resource *)pRes; - - GetResourceManager()->TakeResourceOwnership(wrapped); - } } if(IsCaptureMode(m_State)) @@ -4089,8 +4081,6 @@ bool WrappedID3D12Device::Serialise_CreateAS(SerialiserType &ser, ID3D12Resource D3D12AccelerationStructure *accStructAtOffset = NULL; if(asbWrappedResource->CreateAccStruct(asId, resourceOffset, type, byteSize, &accStructAtOffset)) { - GetResourceManager()->TakeResourceOwnership(accStructAtOffset); - if(D3D12_Debug_RT_Auditing()) { RDCLOG("Creating %s AS %s at %s + %llu (%llu bytes): %llx remapped to %llx", @@ -4777,7 +4767,6 @@ ID3D12GraphicsCommandListX *WrappedID3D12Device::GetNewList() if(IsReplayMode(m_State)) { - GetResourceManager()->TakeResourceOwnership(ret); // add a reference here so that when we release our internal resources on destruction we don't // free this too soon before the resource manager can. We still want to have it tracked as a // resource in the manager though. diff --git a/renderdoc/driver/d3d12/d3d12_device_rescreate_wrap.cpp b/renderdoc/driver/d3d12/d3d12_device_rescreate_wrap.cpp index 0683aa280..accf6c20c 100644 --- a/renderdoc/driver/d3d12/d3d12_device_rescreate_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_rescreate_wrap.cpp @@ -261,8 +261,6 @@ bool WrappedID3D12Device::Serialise_CreateResource( default: break; } - GetResourceManager()->TakeResourceOwnership(ret); - if(desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS) m_ModResources.insert(GetResID(ret)); @@ -618,10 +616,6 @@ HRESULT WrappedID3D12Device::CreateResource( GetResourceManager()->AddPlacedResource(wrapped->GetResourceID(), GetResID(pHeap)); } } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } { SCOPED_LOCK(m_ResourceStatesLock); @@ -826,8 +820,6 @@ bool WrappedID3D12Device::Serialise_OpenSharedHandle(SerialiserType &ser, HANDLE else { ret = new WrappedID3D12Fence(resourceId, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(resourceId, ResourceType::Sync, "Fence"); @@ -898,8 +890,6 @@ bool WrappedID3D12Device::Serialise_OpenSharedHandle(SerialiserType &ser, HANDLE else { ret = new WrappedID3D12Heap(resourceId, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(resourceId, ResourceType::Memory, "Heap"); diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap.cpp index 1b8e3713a..024ed418c 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap.cpp @@ -118,8 +118,6 @@ bool WrappedID3D12Device::Serialise_CreateCommandQueue(SerialiserType &ser, ret = new WrappedID3D12CommandQueue(pCommandQueue, ret, this, m_State); - GetResourceManager()->TakeResourceOwnership(ret); - AddResource(pCommandQueue, ResourceType::Queue, "Command Queue"); WrappedID3D12CommandQueue *wrapped = (WrappedID3D12CommandQueue *)ret; @@ -175,10 +173,6 @@ HRESULT WrappedID3D12Device::CreateCommandQueue(const D3D12_COMMAND_QUEUE_DESC * wrapped->GetCreationRecord()->AddChunk(scope.Get()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } if(pDesc->Type == D3D12_COMMAND_LIST_TYPE_DIRECT && m_Queue == NULL) { @@ -251,8 +245,6 @@ bool WrappedID3D12Device::Serialise_CreateCommandAllocator(SerialiserType &ser, m_CommandAllocators.push_back(ret); - GetResourceManager()->TakeResourceOwnership(ret); - AddResource(pCommandAllocator, ResourceType::Pool, "Command Allocator"); } } @@ -297,10 +289,6 @@ HRESULT WrappedID3D12Device::CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE type record->AddChunk(scope.Get()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } *ppCommandAllocator = (ID3D12CommandAllocator *)wrapped; } @@ -353,8 +341,6 @@ bool WrappedID3D12Device::Serialise_CreateCommandList(SerialiserType &ser, UINT { // close it immediately, we don't want to tie up the allocator list->Close(); - - GetResourceManager()->TakeResourceOwnership(list); } AddResource(pCommandList, ResourceType::CommandBuffer, "Command List"); @@ -454,7 +440,7 @@ HRESULT WrappedID3D12Device::CreateCommandList(UINT nodeMask, D3D12_COMMAND_LIST wrapped->GetCreationRecord()->AddParent(GetRecord(pInitialState)); } - // during replay, the caller is responsible for calling AddLiveResource as this function + // during replay, the caller is responsible for calling AddResource as this function // can be called from ID3D12GraphicsCommandList::Reset serialising if(riid == __uuidof(ID3D12GraphicsCommandList)) @@ -680,7 +666,6 @@ bool WrappedID3D12Device::Serialise_CreateGraphicsPipelineState( .initialisationChunks.push_back((uint32_t)m_StructuredFile->chunks.size() - 2); m_GlobalEXTUAV = ~0U; } - GetResourceManager()->TakeResourceOwnership(wrapped); } return true; @@ -742,8 +727,6 @@ void WrappedID3D12Device::ProcessCreatedGraphicsPSO(ID3D12PipelineState *real, } else { - GetResourceManager()->TakeResourceOwnership(wrapped); - wrapped->graphics = new D3D12_EXPANDED_PIPELINE_STATE_STREAM_DESC(*pDesc); D3D12_SHADER_BYTECODE *shaders[] = { @@ -942,7 +925,6 @@ bool WrappedID3D12Device::Serialise_CreateComputePipelineState( .initialisationChunks.push_back((uint32_t)m_StructuredFile->chunks.size() - 2); m_GlobalEXTUAV = ~0U; } - GetResourceManager()->TakeResourceOwnership(wrapped); } return true; @@ -996,8 +978,6 @@ void WrappedID3D12Device::ProcessCreatedComputePSO(ID3D12PipelineState *real, ui } else { - GetResourceManager()->TakeResourceOwnership(wrapped); - wrapped->compute = new D3D12_EXPANDED_PIPELINE_STATE_STREAM_DESC(*pDesc); WrappedID3D12Shader *sh = @@ -1117,8 +1097,6 @@ bool WrappedID3D12Device::Serialise_CreateDescriptorHeap( ret = wrapped; - GetResourceManager()->TakeResourceOwnership(ret); - AddResource(pHeap, ResourceType::DescriptorStore, "Descriptor Heap"); DescriptorStoreDescription desc; @@ -1168,10 +1146,6 @@ HRESULT WrappedID3D12Device::CreateDescriptorHeap(const D3D12_DESCRIPTOR_HEAP_DE GetResourceManager()->MarkDirtyResource(wrapped->GetResourceID()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } *ppvHeap = (ID3D12DescriptorHeap *)wrapped; } @@ -1220,14 +1194,10 @@ bool WrappedID3D12Device::Serialise_CreateRootSignature(SerialiserType &ser, UIN ret->Release(); ret = (ID3D12RootSignature *)GetResourceManager()->GetWrapper(ret); ret->AddRef(); - - GetResourceManager()->TakeResourceOwnership(ret); } else { ret = new WrappedID3D12RootSignature(pRootSignature, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } WrappedID3D12RootSignature *wrapped = (WrappedID3D12RootSignature *)ret; @@ -1680,8 +1650,6 @@ bool WrappedID3D12Device::Serialise_CreateHeap(SerialiserType &ser, const D3D12_ else { ret = new WrappedID3D12Heap(pHeap, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pHeap, ResourceType::Memory, "Heap"); @@ -1730,10 +1698,6 @@ HRESULT WrappedID3D12Device::CreateHeap(const D3D12_HEAP_DESC *pDesc, REFIID rii record->AddChunk(scope.Get()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } *ppvHeap = (ID3D12Heap *)wrapped; } @@ -1777,8 +1741,6 @@ bool WrappedID3D12Device::Serialise_CreateFence(SerialiserType &ser, UINT64 Init else { ret = new WrappedID3D12Fence(pFence, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pFence, ResourceType::Sync, "Fence"); @@ -1825,10 +1787,6 @@ HRESULT WrappedID3D12Device::CreateFence(UINT64 InitialValue, D3D12_FENCE_FLAGS record->AddChunk(scope.Get()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } if(riid == __uuidof(ID3D12Fence)) *ppFence = (ID3D12Fence *)wrapped; @@ -1869,8 +1827,6 @@ bool WrappedID3D12Device::Serialise_CreateQueryHeap(SerialiserType &ser, else { ret = new WrappedID3D12QueryHeap(pQueryHeap, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pQueryHeap, ResourceType::Query, "Query Heap"); @@ -1910,10 +1866,6 @@ HRESULT WrappedID3D12Device::CreateQueryHeap(const D3D12_QUERY_HEAP_DESC *pDesc, record->AddChunk(scope.Get()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } *ppvHeap = (ID3D12QueryHeap *)wrapped; } @@ -1959,8 +1911,6 @@ bool WrappedID3D12Device::Serialise_CreateCommandSignature(SerialiserType &ser, ret = wrapped; - GetResourceManager()->TakeResourceOwnership(ret); - AddResource(pCommandSignature, ResourceType::ShaderBinding, "Command Signature"); if(pRootSignature) DerivedResource(pRootSignature, pCommandSignature); @@ -2021,10 +1971,6 @@ HRESULT WrappedID3D12Device::CreateCommandSignature(const D3D12_COMMAND_SIGNATUR record->AddParent(GetRecord(pRootSignature)); record->AddChunk(scope.Get()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } if(pDesc->pArgumentDescs[pDesc->NumArgumentDescs - 1].Type == D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH_RAYS) diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap13.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap13.cpp index c27d51b57..65e4f2261 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap13.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap13.cpp @@ -84,10 +84,6 @@ HRESULT WrappedID3D12Device::OpenExistingHeapFromAddress1(const void *pAddress, record->AddChunk(scope.Get()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } *ppvHeap = (ID3D12Heap *)wrapped; } diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap14.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap14.cpp index 9dbbb080f..7fb081b06 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap14.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap14.cpp @@ -113,14 +113,10 @@ bool WrappedID3D12Device::Serialise_CreateRootSignatureFromSubobjectInLibrary( ret->Release(); ret = (ID3D12RootSignature *)GetResourceManager()->GetWrapper(ret); ret->AddRef(); - - GetResourceManager()->TakeResourceOwnership(ret); } else { ret = new WrappedID3D12RootSignature(pRootSignature, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } WrappedID3D12RootSignature *wrapped = (WrappedID3D12RootSignature *)ret; diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap2.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap2.cpp index e91a357b3..7f6379cc7 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap2.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap2.cpp @@ -273,7 +273,6 @@ bool WrappedID3D12Device::Serialise_CreatePipelineState(SerialiserType &ser, .initialisationChunks.push_back((uint32_t)m_StructuredFile->chunks.size() - 2); m_GlobalEXTUAV = ~0U; } - GetResourceManager()->TakeResourceOwnership(wrapped); } return true; @@ -366,8 +365,6 @@ HRESULT WrappedID3D12Device::CreatePipelineState(const D3D12_PIPELINE_STATE_STRE } else { - GetResourceManager()->TakeResourceOwnership(wrapped); - D3D12_EXPANDED_PIPELINE_STATE_STREAM_DESC *storedDesc = new D3D12_EXPANDED_PIPELINE_STATE_STREAM_DESC(expandedDesc); diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap3.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap3.cpp index b52aed883..c84bfb2b3 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap3.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap3.cpp @@ -81,10 +81,6 @@ HRESULT WrappedID3D12Device::OpenExistingHeapFromAddress(const void *pAddress, R record->AddChunk(scope.Get()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } *ppvHeap = (ID3D12Heap *)wrapped; } @@ -150,10 +146,6 @@ HRESULT WrappedID3D12Device::OpenExistingHeapFromFileMapping(HANDLE hFileMapping record->AddChunk(scope.Get()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } *ppvHeap = (ID3D12Heap *)wrapped; } diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap4.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap4.cpp index e19f96a6f..5463340db 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap4.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap4.cpp @@ -72,11 +72,6 @@ bool WrappedID3D12Device::Serialise_CreateCommandList1(SerialiserType &ser, UINT "Failed creating command list, HRESULT: %s", ToStr(hr).c_str()); return false; } - else if(list) - { - // don't have to close it, as there's no implicit reset - GetResourceManager()->TakeResourceOwnership(list); - } AddResource(pCommandList, ResourceType::CommandBuffer, "Command List"); } @@ -162,7 +157,7 @@ HRESULT WrappedID3D12Device::CreateCommandList1(UINT nodeMask, D3D12_COMMAND_LIS } } - // during replay, the caller is responsible for calling AddLiveResource as this function + // during replay, the caller is responsible for calling AddResource as this function // can be called from ID3D12GraphicsCommandList::Reset serialising if(riid == __uuidof(ID3D12GraphicsCommandList)) @@ -278,8 +273,6 @@ bool WrappedID3D12Device::Serialise_CreateHeap1(SerialiserType &ser, const D3D12 else { ret = new WrappedID3D12Heap(pHeap, ret, this); - - GetResourceManager()->TakeResourceOwnership(ret); } AddResource(pHeap, ResourceType::Memory, "Heap"); @@ -331,10 +324,6 @@ HRESULT WrappedID3D12Device::CreateHeap1(const D3D12_HEAP_DESC *pDesc, record->AddChunk(scope.Get()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } *ppvHeap = (ID3D12Heap *)wrapped; } diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap5.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap5.cpp index eec31b4a3..1ac4b702c 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap5.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap5.cpp @@ -239,7 +239,6 @@ bool WrappedID3D12Device::Serialise_CreateStateObject(SerialiserType &ser, .initialisationChunks.push_back((uint32_t)m_StructuredFile->chunks.size() - 2); m_GlobalEXTUAV = ~0U; } - GetResourceManager()->TakeResourceOwnership(wrapped); } return true; @@ -320,10 +319,6 @@ WrappedID3D12Device::CreateStateObject(const D3D12_STATE_OBJECT_DESC *pDesc, REF record->AddChunk(vendorChunk); record->AddChunk(scope.Get()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } *ppStateObject = (ID3D12StateObject *)wrapped; } diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap7.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap7.cpp index a16781ec6..09597e88c 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap7.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap7.cpp @@ -200,7 +200,6 @@ bool WrappedID3D12Device::Serialise_AddToStateObject(SerialiserType &ser, .initialisationChunks.push_back((uint32_t)m_StructuredFile->chunks.size() - 2); m_GlobalEXTUAV = ~0U; } - GetResourceManager()->TakeResourceOwnership(wrapped); } return true; @@ -287,10 +286,6 @@ HRESULT STDMETHODCALLTYPE WrappedID3D12Device::AddToStateObject( record->AddChunk(vendorChunk); record->AddChunk(scope.Get()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } *ppNewStateObject = (ID3D12StateObject *)wrapped; } diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap9.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap9.cpp index 8bbdd130c..9d38c5ee2 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap9.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap9.cpp @@ -101,8 +101,6 @@ bool WrappedID3D12Device::Serialise_CreateCommandQueue1(SerialiserType &ser, ret = new WrappedID3D12CommandQueue(pCommandQueue, ret, this, m_State); - GetResourceManager()->TakeResourceOwnership(ret); - AddResource(pCommandQueue, ResourceType::Queue, "Command Queue"); WrappedID3D12CommandQueue *wrapped = (WrappedID3D12CommandQueue *)ret; @@ -158,10 +156,6 @@ HRESULT WrappedID3D12Device::CreateCommandQueue1(const D3D12_COMMAND_QUEUE_DESC wrapped->GetCreationRecord()->AddChunk(scope.Get()); } - else - { - GetResourceManager()->TakeResourceOwnership(wrapped); - } if(pDesc->Type == D3D12_COMMAND_LIST_TYPE_DIRECT && m_Queue == NULL) { diff --git a/renderdoc/driver/d3d12/d3d12_resources.h b/renderdoc/driver/d3d12/d3d12_resources.h index 226d15425..caad2c3a2 100644 --- a/renderdoc/driver/d3d12/d3d12_resources.h +++ b/renderdoc/driver/d3d12/d3d12_resources.h @@ -889,8 +889,6 @@ public: m_DXBCFile = NULL; m_Details = new ShaderReflection; - device->GetResourceManager()->TakeResourceOwnership(this); - if(!m_InternalResources) { device->AddResource(GetResourceID(), ResourceType::Shader, "Shader"); diff --git a/renderdoc/driver/gl/gl_driver.cpp b/renderdoc/driver/gl/gl_driver.cpp index 70290fdd3..132eec72b 100644 --- a/renderdoc/driver/gl/gl_driver.cpp +++ b/renderdoc/driver/gl/gl_driver.cpp @@ -702,9 +702,6 @@ WrappedOpenGL::WrappedOpenGL(GLPlatform &platform) m_DescriptorsID = GetResourceManager()->RegisterResource( ResourceId(), GLResource(NULL, eResSpecial, eSpecialResDescriptorStorage)); - GetResourceManager()->TakeResourceOwnership( - GLResource(NULL, eResSpecial, eSpecialResDescriptorStorage)); - AddResource(m_DescriptorsID, ResourceType::DescriptorStore, ""); GetReplay()->GetResourceDesc(m_DescriptorsID).SetCustomName("Context Bindings"); GetReplay()->GetResourceDesc(m_DescriptorsID).initialisationChunks.clear(); @@ -887,7 +884,6 @@ void WrappedOpenGL::CreateReplayBackbuffer(const GLInitParams ¶ms, ResourceI if(params.depthBits > 0 || params.stencilBits > 0) drv.glClearBufferfi(eGL_DEPTH_STENCIL, 0, 1.0f, 0); - GetResourceManager()->TakeResourceOwnership(FramebufferRes(GetCtx(), fbo)); AddResource(fboId, ResourceType::SwapchainImage, ""); GetReplay()->GetResourceDesc(fboId).SetCustomName(bbname + " FBO"); @@ -1716,8 +1712,6 @@ void WrappedOpenGL::ReplaceResource(ResourceId from, ResourceId to) shadDetails.ProcessCompilation(*this, targetId, 0); - GetResourceManager()->TakeResourceOwnership(toresource); - // finally since programs have state (sigh) we have to copy that across as well. GLuint progsrc = fromresource.name; GLuint progdst = toresource.name; @@ -3650,10 +3644,8 @@ bool WrappedOpenGL::ProcessChunk(ReadSerialiser &ser, GLChunk chunk) GL.glGenVertexArrays(1, &m_Global_VAO0); GetResourceManager()->RegisterResource(vao, VertexArrayRes(GetCtx(), m_Global_VAO0)); - GetResourceManager()->TakeResourceOwnership(VertexArrayRes(GetCtx(), m_Global_VAO0)); glBindVertexArray(m_Global_VAO0); - GetResourceManager()->TakeResourceOwnership(VertexArrayRes(GetCtx(), m_Global_VAO0)); AddResource(vao, ResourceType::StateObject, "Vertex Array"); GetReplay()->GetResourceDesc(vao).SetCustomName("Default VAO"); diff --git a/renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp index 98cc50e9b..2254657c6 100644 --- a/renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp @@ -86,7 +86,6 @@ bool WrappedOpenGL::Serialise_glGenBuffers(SerialiserType &ser, GLsizei n, GLuin GLResource res = BufferRes(GetCtx(), real); ResourceId live = m_ResourceManager->RegisterResource(buffer, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(buffer, ResourceType::Buffer, "Buffer"); @@ -126,7 +125,6 @@ void WrappedOpenGL::glGenBuffers(GLsizei n, GLuint *buffers) } else { - GetResourceManager()->TakeResourceOwnership(res); m_Buffers[id].resource = res; m_Buffers[id].curType = eGL_NONE; m_Buffers[id].creationFlags = BufferCategory::NoFlags; @@ -151,7 +149,6 @@ bool WrappedOpenGL::Serialise_glCreateBuffers(SerialiserType &ser, GLsizei n, GL GLResource res = BufferRes(GetCtx(), real); ResourceId live = m_ResourceManager->RegisterResource(buffer, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(buffer, ResourceType::Buffer, "Buffer"); @@ -191,7 +188,6 @@ void WrappedOpenGL::glCreateBuffers(GLsizei n, GLuint *buffers) } else { - GetResourceManager()->TakeResourceOwnership(res); m_Buffers[id].resource = res; m_Buffers[id].curType = eGL_NONE; m_Buffers[id].creationFlags = BufferCategory::NoFlags; @@ -3119,7 +3115,6 @@ bool WrappedOpenGL::Serialise_glGenTransformFeedbacks(SerialiserType &ser, GLsiz GLResource res = FeedbackRes(GetCtx(), real); m_ResourceManager->RegisterResource(feedback, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(feedback, ResourceType::StateObject, "Transform Feedback"); } @@ -3153,10 +3148,6 @@ void WrappedOpenGL::glGenTransformFeedbacks(GLsizei n, GLuint *ids) record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } } } @@ -3177,7 +3168,6 @@ bool WrappedOpenGL::Serialise_glCreateTransformFeedbacks(SerialiserType &ser, GL GLResource res = FeedbackRes(GetCtx(), real); m_ResourceManager->RegisterResource(feedback, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(feedback, ResourceType::StateObject, "Transform Feedback"); } @@ -3211,10 +3201,6 @@ void WrappedOpenGL::glCreateTransformFeedbacks(GLsizei n, GLuint *ids) record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } } } @@ -4554,7 +4540,6 @@ bool WrappedOpenGL::Serialise_glGenVertexArrays(SerialiserType &ser, GLsizei n, GLResource res = VertexArrayRes(GetCtx(), real); m_ResourceManager->RegisterResource(array, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(array, ResourceType::StateObject, "Vertex Array"); } @@ -4588,10 +4573,6 @@ void WrappedOpenGL::glGenVertexArrays(GLsizei n, GLuint *arrays) record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } } } @@ -4612,7 +4593,6 @@ bool WrappedOpenGL::Serialise_glCreateVertexArrays(SerialiserType &ser, GLsizei GLResource res = VertexArrayRes(GetCtx(), real); m_ResourceManager->RegisterResource(array, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(array, ResourceType::StateObject, "Vertex Array"); } @@ -4646,10 +4626,6 @@ void WrappedOpenGL::glCreateVertexArrays(GLsizei n, GLuint *arrays) record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } } } diff --git a/renderdoc/driver/gl/wrappers/gl_framebuffer_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_framebuffer_funcs.cpp index 312a31cc9..4376936bb 100644 --- a/renderdoc/driver/gl/wrappers/gl_framebuffer_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_framebuffer_funcs.cpp @@ -72,7 +72,6 @@ bool WrappedOpenGL::Serialise_glGenFramebuffers(SerialiserType &ser, GLsizei n, GLResource res = FramebufferRes(GetCtx(), real); ResourceId live = m_ResourceManager->RegisterResource(framebuffer, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(framebuffer, ResourceType::RenderPass, "Framebuffer"); } @@ -106,10 +105,6 @@ void WrappedOpenGL::glGenFramebuffers(GLsizei n, GLuint *framebuffers) record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } } } @@ -132,7 +127,6 @@ bool WrappedOpenGL::Serialise_glCreateFramebuffers(SerialiserType &ser, GLsizei GLResource res = FramebufferRes(GetCtx(), real); ResourceId live = m_ResourceManager->RegisterResource(framebuffer, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(framebuffer, ResourceType::RenderPass, "Framebuffer"); } @@ -166,10 +160,6 @@ void WrappedOpenGL::glCreateFramebuffers(GLsizei n, GLuint *framebuffers) record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } } } @@ -2409,7 +2399,6 @@ bool WrappedOpenGL::Serialise_glGenRenderbuffers(SerialiserType &ser, GLsizei n, GLResource res = RenderbufferRes(GetCtx(), real); ResourceId live = m_ResourceManager->RegisterResource(renderbuffer, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(renderbuffer, ResourceType::Texture, "Renderbuffer"); @@ -2446,10 +2435,6 @@ void WrappedOpenGL::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers) record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } } } @@ -2473,7 +2458,6 @@ bool WrappedOpenGL::Serialise_glCreateRenderbuffers(SerialiserType &ser, GLsizei GLResource res = RenderbufferRes(GetCtx(), real); ResourceId live = m_ResourceManager->RegisterResource(renderbuffer, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(renderbuffer, ResourceType::Texture, "Renderbuffer"); @@ -2510,10 +2494,6 @@ void WrappedOpenGL::glCreateRenderbuffers(GLsizei n, GLuint *renderbuffers) record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } } } diff --git a/renderdoc/driver/gl/wrappers/gl_interop_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_interop_funcs.cpp index 7131369a6..88360a88b 100644 --- a/renderdoc/driver/gl/wrappers/gl_interop_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_interop_funcs.cpp @@ -560,7 +560,6 @@ bool WrappedOpenGL::Serialise_glCreateMemoryObjectsEXT(SerialiserType &ser, GLsi GLResource res = ExtMemRes(GetCtx(), real); ResourceId live = m_ResourceManager->RegisterResource(memory, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(memory, ResourceType::Memory, "Memory Object"); } @@ -594,10 +593,6 @@ void WrappedOpenGL::glCreateMemoryObjectsEXT(GLsizei n, GLuint *memoryObjects) record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } } } @@ -835,7 +830,6 @@ bool WrappedOpenGL::Serialise_glGenSemaphoresEXT(SerialiserType &ser, GLsizei n, GLResource res = ExtSemRes(GetCtx(), real); ResourceId live = m_ResourceManager->RegisterResource(semaphore, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(semaphore, ResourceType::Sync, "Semaphore"); } @@ -869,10 +863,6 @@ void WrappedOpenGL::glGenSemaphoresEXT(GLsizei n, GLuint *semaphores) record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } } } diff --git a/renderdoc/driver/gl/wrappers/gl_query_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_query_funcs.cpp index 049952cdc..58dbdbdd3 100644 --- a/renderdoc/driver/gl/wrappers/gl_query_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_query_funcs.cpp @@ -78,8 +78,6 @@ bool WrappedOpenGL::Serialise_glFenceSync(SerialiserType &ser, GLsync real, GLen GLResource res = SyncRes(GetCtx(), name); - GetResourceManager()->TakeResourceOwnership(res); - AddResource(sync, ResourceType::Sync, "Sync"); } @@ -109,10 +107,6 @@ GLsync WrappedOpenGL::glFenceSync(GLenum condition, GLbitfield flags) GetContextRecord()->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } return sync; } @@ -213,7 +207,6 @@ bool WrappedOpenGL::Serialise_glGenQueries(SerialiserType &ser, GLsizei n, GLuin GLResource res = QueryRes(GetCtx(), real); ResourceId live = m_ResourceManager->RegisterResource(query, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(query, ResourceType::Query, "Query"); } @@ -247,10 +240,6 @@ void WrappedOpenGL::glGenQueries(GLsizei count, GLuint *ids) record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } } } @@ -273,7 +262,6 @@ bool WrappedOpenGL::Serialise_glCreateQueries(SerialiserType &ser, GLenum target GLResource res = QueryRes(GetCtx(), real); ResourceId live = m_ResourceManager->RegisterResource(query, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(query, ResourceType::Query, "Query"); } @@ -307,10 +295,6 @@ void WrappedOpenGL::glCreateQueries(GLenum target, GLsizei count, GLuint *ids) record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } } } diff --git a/renderdoc/driver/gl/wrappers/gl_sampler_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_sampler_funcs.cpp index 7f8340cdd..bdf7394ee 100644 --- a/renderdoc/driver/gl/wrappers/gl_sampler_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_sampler_funcs.cpp @@ -51,7 +51,6 @@ bool WrappedOpenGL::Serialise_glGenSamplers(SerialiserType &ser, GLsizei n, GLui GLResource res = SamplerRes(GetCtx(), real); ResourceId live = m_ResourceManager->RegisterResource(sampler, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(sampler, ResourceType::Sampler, "Sampler"); } @@ -85,10 +84,6 @@ void WrappedOpenGL::glGenSamplers(GLsizei count, GLuint *samplers) record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } } } @@ -109,7 +104,6 @@ bool WrappedOpenGL::Serialise_glCreateSamplers(SerialiserType &ser, GLsizei n, G GLResource res = SamplerRes(GetCtx(), real); ResourceId live = m_ResourceManager->RegisterResource(sampler, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(sampler, ResourceType::Sampler, "Sampler"); } @@ -143,10 +137,6 @@ void WrappedOpenGL::glCreateSamplers(GLsizei count, GLuint *samplers) record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } } } diff --git a/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp index 4c8fdd487..4f3bfe251 100644 --- a/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp @@ -614,7 +614,6 @@ bool WrappedOpenGL::Serialise_glCreateShader(SerialiserType &ser, GLenum type, G GLResource res = ShaderRes(GetCtx(), real); ResourceId id = GetResourceManager()->RegisterResource(Shader, res); - GetResourceManager()->TakeResourceOwnership(res); m_Shaders[id].type = type; @@ -649,10 +648,6 @@ GLuint WrappedOpenGL::glCreateShader(GLenum type) record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } m_Shaders[id].type = type; @@ -974,7 +969,6 @@ bool WrappedOpenGL::Serialise_glCreateShaderProgramv(SerialiserType &ser, GLenum GLResource res = ProgramRes(GetCtx(), real); ResourceId id = m_ResourceManager->RegisterResource(Program, res); - GetResourceManager()->TakeResourceOwnership(res); WrappedOpenGL::ProgramData &progDetails = m_Programs[id]; @@ -1060,7 +1054,6 @@ bool WrappedOpenGL::Serialise_glCreateProgram(SerialiserType &ser, GLuint progra GLResource res = ProgramRes(GetCtx(), real); ResourceId id = m_ResourceManager->RegisterResource(Program, res); - GetResourceManager()->TakeResourceOwnership(res); m_Programs[id].linked = false; @@ -1099,10 +1092,6 @@ GLuint WrappedOpenGL::glCreateProgram() record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } m_Programs[id].linked = false; @@ -1928,7 +1917,6 @@ bool WrappedOpenGL::Serialise_glGenProgramPipelines(SerialiserType &ser, GLsizei GLResource res = ProgramPipeRes(GetCtx(), real); ResourceId live = m_ResourceManager->RegisterResource(pipeline, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(pipeline, ResourceType::StateObject, "Pipeline"); } @@ -1962,10 +1950,6 @@ void WrappedOpenGL::glGenProgramPipelines(GLsizei n, GLuint *pipelines) record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } } } @@ -1988,7 +1972,6 @@ bool WrappedOpenGL::Serialise_glCreateProgramPipelines(SerialiserType &ser, GLsi GLResource res = ProgramPipeRes(GetCtx(), real); ResourceId live = m_ResourceManager->RegisterResource(pipeline, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(pipeline, ResourceType::StateObject, "Pipeline"); } @@ -2022,10 +2005,6 @@ void WrappedOpenGL::glCreateProgramPipelines(GLsizei n, GLuint *pipelines) record->AddChunk(chunk); } - else - { - GetResourceManager()->TakeResourceOwnership(res); - } } } diff --git a/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp index da0f53524..944b312f6 100644 --- a/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp @@ -103,7 +103,6 @@ bool WrappedOpenGL::Serialise_glGenTextures(SerialiserType &ser, GLsizei n, GLui GLResource res = TextureRes(GetCtx(), real); ResourceId live = m_ResourceManager->RegisterResource(texture, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(texture, ResourceType::Texture, "Texture"); @@ -142,7 +141,6 @@ void WrappedOpenGL::glGenTextures(GLsizei n, GLuint *textures) } else { - GetResourceManager()->TakeResourceOwnership(res); m_Textures[id].resource = res; m_Textures[id].curType = eGL_NONE; } @@ -168,7 +166,6 @@ bool WrappedOpenGL::Serialise_glCreateTextures(SerialiserType &ser, GLenum targe GLResource res = TextureRes(GetCtx(), real); ResourceId live = m_ResourceManager->RegisterResource(texture, res); - GetResourceManager()->TakeResourceOwnership(res); AddResource(texture, ResourceType::Texture, "Texture"); @@ -212,7 +209,6 @@ void WrappedOpenGL::glCreateTextures(GLenum target, GLsizei n, GLuint *textures) } else { - GetResourceManager()->TakeResourceOwnership(res); m_Textures[id].resource = res; m_Textures[id].curType = TextureTarget(target); m_Textures[id].creationFlags |= TextureCategory::ShaderRead; diff --git a/renderdoc/driver/vulkan/vk_core.cpp b/renderdoc/driver/vulkan/vk_core.cpp index a06eb6028..a40df28c3 100644 --- a/renderdoc/driver/vulkan/vk_core.cpp +++ b/renderdoc/driver/vulkan/vk_core.cpp @@ -3591,7 +3591,6 @@ RDResult WrappedVulkan::ReadLogInitialisation(RDCFile *rdc, bool storeStructured ResourceId id = ResourceIDGen::GetNewUniqueID(); GetResourceManager()->WrapResource(id, Unwrap(m_Device), m_Queue); - GetResourceManager()->AddLiveResource(id, m_Queue); m_ExternalQueues[m_QueueFamilyIdx].queue = m_Queue; } @@ -4045,7 +4044,6 @@ void WrappedVulkan::ApplyInitialContents() ResourceId id = ResourceIDGen::GetNewUniqueID(); GetResourceManager()->WrapResource(id, Unwrap(m_Device), queue); - GetResourceManager()->AddLiveResource(id, queue); m_ExternalQueues[i].queue = queue; } diff --git a/renderdoc/driver/vulkan/vk_info.cpp b/renderdoc/driver/vulkan/vk_info.cpp index 15b56ae10..27b8ec40b 100644 --- a/renderdoc/driver/vulkan/vk_info.cpp +++ b/renderdoc/driver/vulkan/vk_info.cpp @@ -2985,9 +2985,6 @@ void VulkanCreationInfo::DescSetPool::CreateOverflow(VkDevice device, ResourceId poolid = resourceMan->WrapResource(ResourceId(), Unwrap(device), pool); - // register as a live-only resource, so it is cleaned up properly - resourceMan->AddLiveResource(poolid, pool); - overflow.push_back(pool); } diff --git a/renderdoc/driver/vulkan/vk_manager.h b/renderdoc/driver/vulkan/vk_manager.h index dc4256a8f..5ff0d7023 100644 --- a/renderdoc/driver/vulkan/vk_manager.h +++ b/renderdoc/driver/vulkan/vk_manager.h @@ -177,25 +177,17 @@ public: // if any objects leaked past, it's no longer safe to delete them as we would // be calling Shutdown() after the device that owns them is destroyed. Instead // we just have to leak ourselves. - RDCASSERT(m_OwnedResources.empty()); RDCASSERT(m_InitialContents.empty()); RDCASSERT(m_ResourceRecords.empty()); RDCASSERT(m_ResourceMap.empty()); RDCASSERT(m_WrapperMap.empty()); - m_OwnedResources.clear(); m_InitialContents.clear(); m_ResourceRecords.clear(); m_ResourceMap.clear(); m_WrapperMap.clear(); } - template - void AddLiveResource(ResourceId id, realtype obj) - { - ResourceManager::TakeResourceOwnership(GetWrapped(obj)); - } - using ResourceManager::AddResourceRecord; template diff --git a/renderdoc/driver/vulkan/vk_shader_cache.cpp b/renderdoc/driver/vulkan/vk_shader_cache.cpp index bb91ad8bc..a9c775133 100644 --- a/renderdoc/driver/vulkan/vk_shader_cache.cpp +++ b/renderdoc/driver/vulkan/vk_shader_cache.cpp @@ -459,10 +459,6 @@ VulkanShaderCache::VulkanShaderCache(WrappedVulkan *driver) { m_pDriver->GetResourceManager()->AddResourceRecord(m_PipelineCache); } - else - { - m_pDriver->GetResourceManager()->AddLiveResource(id, m_PipelineCache); - } } } diff --git a/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp index 8e4be54da..c0d83a4d8 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp @@ -1236,7 +1236,6 @@ bool WrappedVulkan::Serialise_vkCreateCommandPool(SerialiserType &ser, VkDevice else { ResourceId live = GetResourceManager()->WrapResource(CmdPool, Unwrap(device), pool); - GetResourceManager()->AddLiveResource(CmdPool, pool); } AddResource(CmdPool, ResourceType::Pool, "Command Pool"); @@ -1280,10 +1279,6 @@ VkResult WrappedVulkan::vkCreateCommandPool(VkDevice device, record->cmdPoolInfo->queueFamilyIndex = pCreateInfo->queueFamilyIndex; record->AddChunk(chunk); } - else - { - GetResourceManager()->AddLiveResource(id, *pCmdPool); - } } return ret; @@ -1355,7 +1350,6 @@ bool WrappedVulkan::Serialise_vkAllocateCommandBuffers(SerialiserType &ser, VkDe else { ResourceId live = GetResourceManager()->WrapResource(CommandBuffer, Unwrap(device), cmd); - GetResourceManager()->AddLiveResource(CommandBuffer, cmd); ResourceId poolId = GetResID(AllocateInfo.commandPool); auto cmdQueueFamilyIt = m_commandQueueFamilies.find(poolId); if(cmdQueueFamilyIt == m_commandQueueFamilies.end()) @@ -1466,10 +1460,6 @@ VkResult WrappedVulkan::vkAllocateCommandBuffers(VkDevice device, record->cmdInfo->beginCapture = false; record->cmdInfo->endCapture = false; } - else - { - GetResourceManager()->AddLiveResource(id, pCommandBuffers[i]); - } } } @@ -1534,7 +1524,6 @@ bool WrappedVulkan::Serialise_vkBeginCommandBuffer(SerialiserType &ser, VkComman VkDescriptorSet descset = MakeFakePushDescSet(); ResourceId id = GetResourceManager()->WrapResource(ResourceId(), Unwrap(device), descset); m_BakedCmdBufferInfo[BakedCommandBuffer].pushDescriptorID[p][i] = id; - GetResourceManager()->AddLiveResource(id, descset); } } } @@ -1663,7 +1652,6 @@ bool WrappedVulkan::Serialise_vkBeginCommandBuffer(SerialiserType &ser, VkComman else { GetResourceManager()->WrapResource(BakedCommandBuffer, Unwrap(device), cmd); - GetResourceManager()->AddLiveResource(BakedCommandBuffer, cmd); } #if ENABLED(VERBOSE_PARTIAL_REPLAY) @@ -1745,7 +1733,6 @@ bool WrappedVulkan::Serialise_vkBeginCommandBuffer(SerialiserType &ser, VkComman { ResourceId live = GetResourceManager()->WrapResource(BakedCommandBuffer, Unwrap(device), cmd); - GetResourceManager()->AddLiveResource(BakedCommandBuffer, cmd); } AddResource(BakedCommandBuffer, ResourceType::CommandBuffer, "Baked Command Buffer"); diff --git a/renderdoc/driver/vulkan/wrappers/vk_descriptor_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_descriptor_funcs.cpp index 8ba95f2d2..12f8f8c26 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_descriptor_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_descriptor_funcs.cpp @@ -1668,7 +1668,6 @@ bool WrappedVulkan::Serialise_vkCreateDescriptorPool(SerialiserType &ser, VkDevi else { ResourceId live = GetResourceManager()->WrapResource(DescriptorPool, Unwrap(device), pool); - GetResourceManager()->AddLiveResource(DescriptorPool, pool); m_CreationInfo.m_DescSetPool[live].Init(GetResourceManager(), m_CreationInfo, &CreateInfo); } @@ -1712,10 +1711,6 @@ VkResult WrappedVulkan::vkCreateDescriptorPool(VkDevice device, record->descPoolInfo = new DescPoolInfo; } - else - { - GetResourceManager()->AddLiveResource(id, *pDescriptorPool); - } } return ret; @@ -1791,7 +1786,6 @@ bool WrappedVulkan::Serialise_vkCreateDescriptorSetLayout( else { live = GetResourceManager()->WrapResource(SetLayout, Unwrap(device), layout); - GetResourceManager()->AddLiveResource(SetLayout, layout); m_CreationInfo.m_DescSetLayout[live].Init(GetResourceManager(), m_CreationInfo, live, &CreateInfo); @@ -1900,8 +1894,6 @@ VkResult WrappedVulkan::vkCreateDescriptorSetLayout(VkDevice device, } else { - GetResourceManager()->AddLiveResource(id, *pSetLayout); - m_CreationInfo.m_DescSetLayout[id].Init(GetResourceManager(), m_CreationInfo, id, pCreateInfo); } } @@ -1977,7 +1969,6 @@ bool WrappedVulkan::Serialise_vkAllocateDescriptorSets(SerialiserType &ser, VkDe { ResourceId live = GetResourceManager()->WrapResource(DescriptorSet, Unwrap(device), descset); - GetResourceManager()->AddLiveResource(DescriptorSet, descset); // this is stored in the resource record on capture, we need to be able to look to up m_DescriptorSetState[live].layout = layoutId; @@ -2173,8 +2164,6 @@ VkResult WrappedVulkan::vkAllocateDescriptorSets(VkDevice device, } else { - GetResourceManager()->AddLiveResource(id, pDescriptorSets[i]); - m_DescriptorSetState[id].layout = GetResID(pAllocateInfo->pSetLayouts[i]); } } @@ -3039,7 +3028,6 @@ bool WrappedVulkan::Serialise_vkCreateDescriptorUpdateTemplate( { ResourceId live = GetResourceManager()->WrapResource(DescriptorUpdateTemplate, Unwrap(device), templ); - GetResourceManager()->AddLiveResource(DescriptorUpdateTemplate, templ); m_CreationInfo.m_DescUpdateTemplate[live].Init(GetResourceManager(), m_CreationInfo, &CreateInfo); @@ -3097,8 +3085,6 @@ VkResult WrappedVulkan::vkCreateDescriptorUpdateTemplate( } else { - GetResourceManager()->AddLiveResource(id, *pDescriptorUpdateTemplate); - m_CreationInfo.m_DescUpdateTemplate[id].Init(GetResourceManager(), m_CreationInfo, pCreateInfo); } } diff --git a/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp index 2f91520af..61624456e 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp @@ -493,15 +493,9 @@ RDResult WrappedVulkan::Initialise(VkInitParams ¶ms, uint64_t sectionVersion // we'll add the chunk later when we re-process it. if(params.InstanceID != ResourceId()) { - GetResourceManager()->AddLiveResource(params.InstanceID, m_Instance); - AddResource(params.InstanceID, ResourceType::Device, "Instance"); GetReplay()->GetResourceDesc(params.InstanceID).initialisationChunks.clear(); } - else - { - GetResourceManager()->AddLiveResource(GetResID(m_Instance), m_Instance); - } InitInstanceExtensionTables(m_Instance, &m_EnabledExtensions); @@ -1451,6 +1445,10 @@ bool WrappedVulkan::Serialise_vkEnumeratePhysicalDevices(SerialiserType &ser, Vk pd = m_ReplayPhysicalDevices[bestIdx]; + // we want to preserve the separate physical devices until we actually need the real handle, + // so don't remap multiple capture-time physical devices to one replay-time physical device + // yet. See below in Serialise_vkCreateDevice where this is decoded. + // Note this allocation is pooled so we don't have to explicitly delete it. { VkPhysicalDevice fakeDevice = MakePhysicalDeviceHandleFromIndex(PhysicalDeviceIndex); @@ -1462,12 +1460,6 @@ bool WrappedVulkan::Serialise_vkEnumeratePhysicalDevices(SerialiserType &ser, Vk GetResourceManager()->AddWrapper(wrapped, ToTypedHandle(fakeDevice)); fakeDevice = (VkPhysicalDevice)wrapped; - - // we want to preserve the separate physical devices until we actually need the real handle, - // so don't remap multiple capture-time physical devices to one replay-time physical device - // yet. See below in Serialise_vkCreateDevice where this is decoded. - // Note this allocation is pooled so we don't have to explicitly delete it. - GetResourceManager()->AddLiveResource(PhysicalDevice, fakeDevice); } AddResource(PhysicalDevice, ResourceType::Device, "Physical Device"); @@ -4230,7 +4222,6 @@ bool WrappedVulkan::Serialise_vkCreateDevice(SerialiserType &ser, VkPhysicalDevi } GetResourceManager()->WrapResource(Device, device, device); - GetResourceManager()->AddLiveResource(Device, device); AddResource(Device, ResourceType::Device, "Device"); DerivedResource(origPhysDevice, Device); @@ -5008,10 +4999,6 @@ VkResult WrappedVulkan::vkCreateDevice(VkPhysicalDevice physicalDevice, InitDeviceExtensionTables(*pDevice, record->instDevInfo); } - else - { - GetResourceManager()->AddLiveResource(id, *pDevice); - } VkDevice device = *pDevice; diff --git a/renderdoc/driver/vulkan/wrappers/vk_misc_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_misc_funcs.cpp index 8ade7c74b..9d01b3e2a 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_misc_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_misc_funcs.cpp @@ -734,7 +734,6 @@ bool WrappedVulkan::Serialise_vkCreateSampler(SerialiserType &ser, VkDevice devi else { live = GetResourceManager()->WrapResource(Sampler, Unwrap(device), samp); - GetResourceManager()->AddLiveResource(Sampler, samp); m_CreationInfo.m_Sampler[live].Init(GetResourceManager(), m_CreationInfo, &CreateInfo); } @@ -853,8 +852,6 @@ VkResult WrappedVulkan::vkCreateSampler(VkDevice device, const VkSamplerCreateIn } else { - GetResourceManager()->AddLiveResource(id, *pSampler); - m_CreationInfo.m_Sampler[id].Init(GetResourceManager(), m_CreationInfo, pCreateInfo); } } @@ -953,7 +950,6 @@ bool WrappedVulkan::Serialise_vkCreateFramebuffer(SerialiserType &ser, VkDevice else { live = GetResourceManager()->WrapResource(Framebuffer, Unwrap(device), fb); - GetResourceManager()->AddLiveResource(Framebuffer, fb); NameVulkanObject(fb, StringFormat::Fmt("Framebuffer %s", ToStr(Framebuffer).c_str())); @@ -989,9 +985,6 @@ bool WrappedVulkan::Serialise_vkCreateFramebuffer(SerialiserType &ser, VkDevice ResourceId loadFBid = GetResourceManager()->WrapResource(ResourceId(), Unwrap(device), fbinfo.loadFBs[s]); - // register as a live-only resource, so it is cleaned up properly - GetResourceManager()->AddLiveResource(loadFBid, fbinfo.loadFBs[s]); - NameVulkanObject(fbinfo.loadFBs[s], StringFormat::Fmt("Framebuffer %s loadFB %d", ToStr(Framebuffer).c_str(), s)); } @@ -1127,8 +1120,6 @@ VkResult WrappedVulkan::vkCreateFramebuffer(VkDevice device, } else { - GetResourceManager()->AddLiveResource(id, *pFramebuffer); - VulkanCreationInfo::Framebuffer fbinfo; fbinfo.Init(GetResourceManager(), m_CreationInfo, pCreateInfo); @@ -1148,9 +1139,6 @@ VkResult WrappedVulkan::vkCreateFramebuffer(VkDevice device, ResourceId loadFBid = GetResourceManager()->WrapResource(ResourceId(), Unwrap(device), fbinfo.loadFBs[s]); - - // register as a live-only resource, so it is cleaned up properly - GetResourceManager()->AddLiveResource(loadFBid, fbinfo.loadFBs[s]); } m_CreationInfo.m_Framebuffer[id] = fbinfo; @@ -1251,7 +1239,6 @@ bool WrappedVulkan::Serialise_vkCreateRenderPass(SerialiserType &ser, VkDevice d else { live = GetResourceManager()->WrapResource(RenderPass, Unwrap(device), rp); - GetResourceManager()->AddLiveResource(RenderPass, rp); bool badIndirectArgDep = false; @@ -1330,9 +1317,6 @@ bool WrappedVulkan::Serialise_vkCreateRenderPass(SerialiserType &ser, VkDevice d { ResourceId loadRPid = GetResourceManager()->WrapResource(ResourceId(), Unwrap(device), rpinfo.loadRPs[s]); - - // register as a live-only resource, so it is cleaned up properly - GetResourceManager()->AddLiveResource(loadRPid, rpinfo.loadRPs[s]); } } @@ -1396,8 +1380,6 @@ VkResult WrappedVulkan::vkCreateRenderPass(VkDevice device, const VkRenderPassCr } else { - GetResourceManager()->AddLiveResource(id, *pRenderPass); - VulkanCreationInfo::RenderPass rpinfo; rpinfo.Init(GetResourceManager(), m_CreationInfo, pCreateInfo); @@ -1443,9 +1425,6 @@ VkResult WrappedVulkan::vkCreateRenderPass(VkDevice device, const VkRenderPassCr ResourceId loadRPid = GetResourceManager()->WrapResource(ResourceId(), Unwrap(device), rpinfo.loadRPs[s]); - - // register as a live-only resource, so it is cleaned up properly - GetResourceManager()->AddLiveResource(loadRPid, rpinfo.loadRPs[s]); } m_CreationInfo.m_RenderPass[id] = rpinfo; @@ -1559,7 +1538,6 @@ bool WrappedVulkan::Serialise_vkCreateRenderPass2(SerialiserType &ser, VkDevice else { live = GetResourceManager()->WrapResource(RenderPass, Unwrap(device), rp); - GetResourceManager()->AddLiveResource(RenderPass, rp); // make a version of the render pass that loads from its attachments, // so it can be used for replaying a single draw after a render pass @@ -1608,9 +1586,6 @@ bool WrappedVulkan::Serialise_vkCreateRenderPass2(SerialiserType &ser, VkDevice { ResourceId loadRPid = GetResourceManager()->WrapResource(ResourceId(), Unwrap(device), rpinfo.loadRPs[s]); - - // register as a live-only resource, so it is cleaned up properly - GetResourceManager()->AddLiveResource(loadRPid, rpinfo.loadRPs[s]); } } @@ -1675,8 +1650,6 @@ VkResult WrappedVulkan::vkCreateRenderPass2(VkDevice device, } else { - GetResourceManager()->AddLiveResource(id, *pRenderPass); - VulkanCreationInfo::RenderPass rpinfo; rpinfo.Init(GetResourceManager(), m_CreationInfo, pCreateInfo); @@ -1722,9 +1695,6 @@ VkResult WrappedVulkan::vkCreateRenderPass2(VkDevice device, ResourceId loadRPid = GetResourceManager()->WrapResource(ResourceId(), Unwrap(device), rpinfo.loadRPs[s]); - - // register as a live-only resource, so it is cleaned up properly - GetResourceManager()->AddLiveResource(loadRPid, rpinfo.loadRPs[s]); } m_CreationInfo.m_RenderPass[id] = rpinfo; @@ -1770,7 +1740,6 @@ bool WrappedVulkan::Serialise_vkCreateQueryPool(SerialiserType &ser, VkDevice de else { ResourceId live = GetResourceManager()->WrapResource(QueryPool, Unwrap(device), pool); - GetResourceManager()->AddLiveResource(QueryPool, pool); m_CreationInfo.m_QueryPool[live].Init(GetResourceManager(), m_CreationInfo, &CreateInfo); @@ -1877,10 +1846,6 @@ VkResult WrappedVulkan::vkCreateQueryPool(VkDevice device, const VkQueryPoolCrea record->AddChunk(chunk); } - else - { - GetResourceManager()->AddLiveResource(id, *pQueryPool); - } } return ret; @@ -2303,7 +2268,6 @@ bool WrappedVulkan::Serialise_vkCreateSamplerYcbcrConversion( else { live = GetResourceManager()->WrapResource(ycbcrConversion, Unwrap(device), conv); - GetResourceManager()->AddLiveResource(ycbcrConversion, conv); m_CreationInfo.m_YCbCrSampler[live].Init(GetResourceManager(), m_CreationInfo, &CreateInfo); } @@ -2345,10 +2309,6 @@ VkResult WrappedVulkan::vkCreateSamplerYcbcrConversion( VkResourceRecord *record = GetResourceManager()->AddResourceRecord(*pYcbcrConversion); record->AddChunk(chunk); } - else - { - GetResourceManager()->AddLiveResource(id, *pYcbcrConversion); - } } return ret; diff --git a/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp index 51ac320d4..fa05e0346 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp @@ -65,7 +65,6 @@ bool WrappedVulkan::Serialise_vkGetDeviceQueue(SerialiserType &ser, VkDevice dev else { GetResourceManager()->WrapResource(Queue, Unwrap(device), queue); - GetResourceManager()->AddLiveResource(Queue, queue); } if(remapFamily == m_QueueFamilyIdx && m_Queue == VK_NULL_HANDLE) @@ -2247,7 +2246,6 @@ bool WrappedVulkan::Serialise_vkGetDeviceQueue2(SerialiserType &ser, VkDevice de ObjDisp(device)->GetDeviceQueue2(Unwrap(device), &QueueInfo, &queue); GetResourceManager()->WrapResource(Queue, Unwrap(device), queue); - GetResourceManager()->AddLiveResource(Queue, queue); if(remapFamily == m_QueueFamilyIdx && m_Queue == VK_NULL_HANDLE) { diff --git a/renderdoc/driver/vulkan/wrappers/vk_resource_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_resource_funcs.cpp index 1143bbdcb..90d0b128c 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_resource_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_resource_funcs.cpp @@ -365,7 +365,6 @@ bool WrappedVulkan::Serialise_vkAllocateMemory(SerialiserType &ser, VkDevice dev else { ResourceId live = GetResourceManager()->WrapResource(Memory, Unwrap(device), mem); - GetResourceManager()->AddLiveResource(Memory, mem); m_CreationInfo.m_Memory[live].Init(GetResourceManager(), m_CreationInfo, &AllocateInfo); @@ -471,9 +470,6 @@ bool WrappedVulkan::Serialise_vkAllocateMemory(SerialiserType &ser, VkDevice dev ObjDisp(device)->BindBufferMemory(Unwrap(device), Unwrap(buf), Unwrap(mem), 0); - // register as a live-only resource, so it is cleaned up properly - GetResourceManager()->AddLiveResource(bufid, buf); - m_CreationInfo.m_Memory[live].wholeMemBuf = buf; } else @@ -911,16 +907,8 @@ VkResult WrappedVulkan::vkAllocateMemory(VkDevice device, const VkMemoryAllocate } else { - GetResourceManager()->AddLiveResource(id, *pMemory); - m_CreationInfo.m_Memory[id].Init(GetResourceManager(), m_CreationInfo, &info); - if(dedicated == NULL && dedicatedNV == NULL && wholeMemBuf != VK_NULL_HANDLE) - { - // register as a live-only resource, so it is cleaned up properly - GetResourceManager()->AddLiveResource(bufid, wholeMemBuf); - } - m_CreationInfo.m_Memory[id].wholeMemBuf = wholeMemBuf; } } @@ -2066,7 +2054,6 @@ bool WrappedVulkan::Serialise_vkCreateBuffer(SerialiserType &ser, VkDevice devic else { ResourceId live = GetResourceManager()->WrapResource(Buffer, Unwrap(device), buf); - GetResourceManager()->AddLiveResource(Buffer, buf); m_CreationInfo.m_Buffer[live].Init(GetResourceManager(), m_CreationInfo, &CreateInfo, memoryRequirements); @@ -2361,8 +2348,6 @@ VkResult WrappedVulkan::vkCreateBuffer(VkDevice device, const VkBufferCreateInfo } else { - GetResourceManager()->AddLiveResource(id, *pBuffer); - m_CreationInfo.m_Buffer[id].Init(GetResourceManager(), m_CreationInfo, pCreateInfo, {}); } } @@ -2419,7 +2404,6 @@ bool WrappedVulkan::Serialise_vkCreateBufferView(SerialiserType &ser, VkDevice d else { live = GetResourceManager()->WrapResource(View, Unwrap(device), view); - GetResourceManager()->AddLiveResource(View, view); m_CreationInfo.m_BufferView[live].Init(GetResourceManager(), m_CreationInfo, &CreateInfo); } @@ -2478,8 +2462,6 @@ VkResult WrappedVulkan::vkCreateBufferView(VkDevice device, const VkBufferViewCr } else { - GetResourceManager()->AddLiveResource(id, *pView); - m_CreationInfo.m_BufferView[id].Init(GetResourceManager(), m_CreationInfo, pCreateInfo); } } @@ -2734,7 +2716,6 @@ bool WrappedVulkan::Serialise_vkCreateImage(SerialiserType &ser, VkDevice device else { ResourceId live = GetResourceManager()->WrapResource(Image, Unwrap(device), img); - GetResourceManager()->AddLiveResource(Image, img); NameVulkanObject(img, StringFormat::Fmt("Image %s", ToStr(Image).c_str())); @@ -3209,8 +3190,6 @@ VkResult WrappedVulkan::vkCreateImage(VkDevice device, const VkImageCreateInfo * } else { - GetResourceManager()->AddLiveResource(id, *pImage); - m_CreationInfo.m_Image[id].Init(GetResourceManager(), m_CreationInfo, pCreateInfo, {}); } @@ -3315,7 +3294,6 @@ bool WrappedVulkan::Serialise_vkCreateImageView(SerialiserType &ser, VkDevice de else { live = GetResourceManager()->WrapResource(View, Unwrap(device), view); - GetResourceManager()->AddLiveResource(View, view); m_CreationInfo.m_ImageView[live].Init(GetResourceManager(), m_CreationInfo, &CreateInfo); } @@ -3445,8 +3423,6 @@ VkResult WrappedVulkan::vkCreateImageView(VkDevice device, const VkImageViewCrea } else { - GetResourceManager()->AddLiveResource(id, *pView); - m_CreationInfo.m_ImageView[id].Init(GetResourceManager(), m_CreationInfo, pCreateInfo); } } @@ -3968,7 +3944,6 @@ bool WrappedVulkan::Serialise_vkCreateAccelerationStructureKHR( else { live = GetResourceManager()->WrapResource(AccelerationStructure, Unwrap(device), acc); - GetResourceManager()->AddLiveResource(AccelerationStructure, acc); m_CreationInfo.m_AccelerationStructure[live].Init(GetResourceManager(), m_CreationInfo, &CreateInfo); @@ -4105,8 +4080,6 @@ VkResult WrappedVulkan::vkCreateAccelerationStructureKHR( } else { - GetResourceManager()->AddLiveResource(id, *pAccelerationStructure); - m_CreationInfo.m_AccelerationStructure[id].Init(GetResourceManager(), m_CreationInfo, pCreateInfo); } diff --git a/renderdoc/driver/vulkan/wrappers/vk_shader_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_shader_funcs.cpp index 35aa86fea..3517a6233 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_shader_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_shader_funcs.cpp @@ -308,7 +308,6 @@ bool WrappedVulkan::Serialise_vkCreatePipelineLayout(SerialiserType &ser, VkDevi else { live = GetResourceManager()->WrapResource(PipelineLayout, Unwrap(device), layout); - GetResourceManager()->AddLiveResource(PipelineLayout, layout); m_CreationInfo.m_PipelineLayout[live].Init(GetResourceManager(), m_CreationInfo, &CreateInfo); } @@ -376,8 +375,6 @@ VkResult WrappedVulkan::vkCreatePipelineLayout(VkDevice device, } else { - GetResourceManager()->AddLiveResource(id, *pPipelineLayout); - m_CreationInfo.m_PipelineLayout[id].Init(GetResourceManager(), m_CreationInfo, pCreateInfo); } } @@ -434,7 +431,6 @@ bool WrappedVulkan::Serialise_vkCreateShaderModule(SerialiserType &ser, VkDevice else { live = GetResourceManager()->WrapResource(ShaderModule, Unwrap(device), sh); - GetResourceManager()->AddLiveResource(ShaderModule, sh); m_CreationInfo.m_ShaderModule[live].Init(GetResourceManager(), m_CreationInfo, &CreateInfo); } @@ -478,8 +474,6 @@ VkResult WrappedVulkan::vkCreateShaderModule(VkDevice device, } else { - GetResourceManager()->AddLiveResource(id, *pShaderModule); - m_CreationInfo.m_ShaderModule[id].Init(GetResourceManager(), m_CreationInfo, pCreateInfo); } } @@ -537,7 +531,6 @@ bool WrappedVulkan::Serialise_vkCreateShadersEXT(SerialiserType &ser, VkDevice d else { live = GetResourceManager()->WrapResource(Shader, Unwrap(device), sh); - GetResourceManager()->AddLiveResource(Shader, sh); m_CreationInfo.m_ShaderObject[live].Init(GetResourceManager(), m_CreationInfo, live, &CreateInfo); @@ -616,7 +609,6 @@ VkResult WrappedVulkan::vkCreateShadersEXT(VkDevice device, uint32_t createInfoC } else { - GetResourceManager()->AddLiveResource(id, pShaders[i]); m_CreationInfo.m_ShaderObject[id].Init(GetResourceManager(), m_CreationInfo, id, &pCreateInfos[i]); } @@ -655,8 +647,7 @@ bool WrappedVulkan::Serialise_vkCreatePipelineCache(SerialiserType &ser, VkDevic } else { - ResourceId live = GetResourceManager()->WrapResource(PipelineCache, Unwrap(device), cache); - GetResourceManager()->AddLiveResource(PipelineCache, cache); + GetResourceManager()->WrapResource(PipelineCache, Unwrap(device), cache); } AddResource(PipelineCache, ResourceType::Pool, "Pipeline Cache"); @@ -697,10 +688,6 @@ VkResult WrappedVulkan::vkCreatePipelineCache(VkDevice device, VkResourceRecord *record = GetResourceManager()->AddResourceRecord(*pPipelineCache); record->AddChunk(chunk); } - else - { - GetResourceManager()->AddLiveResource(id, *pPipelineCache); - } } return ret; @@ -722,7 +709,6 @@ VkShaderModule WrappedVulkan::CreateFakeInlineShaderModule(ResourceId id, VkDevi } GetResourceManager()->WrapResource(id, Unwrap(device), module); - GetResourceManager()->AddLiveResource(id, module); m_CreationInfo.m_ShaderModule[id].Init(GetResourceManager(), m_CreationInfo, pCreateInfo); @@ -811,7 +797,6 @@ bool WrappedVulkan::Serialise_vkCreateGraphicsPipelines( AddResource(Pipeline, ResourceType::PipelineState, "Graphics Pipeline"); ResourceId live = GetResourceManager()->WrapResource(Pipeline, Unwrap(device), pipe); - GetResourceManager()->AddLiveResource(Pipeline, pipe); pipelinesToCompile.push_back({OrigCreateInfo, pipe}); @@ -899,9 +884,6 @@ bool WrappedVulkan::Serialise_vkCreateGraphicsPipelines( ResourceId subpass0id = GetResourceManager()->WrapResource(ResourceId(), Unwrap(device), pipeInfo.subpass0pipe); - // register as a live-only resource, so it is cleaned up properly - GetResourceManager()->AddLiveResource(subpass0id, pipeInfo.subpass0pipe); - pipelinesToCompile.push_back({OrigCreateInfo, pipeInfo.subpass0pipe}); } @@ -1098,8 +1080,6 @@ VkResult WrappedVulkan::vkCreateGraphicsPipelines(VkDevice device, VkPipelineCac } else { - GetResourceManager()->AddLiveResource(id, pPipelines[i]); - m_CreationInfo.m_Pipeline[id].Init(GetResourceManager(), m_CreationInfo, id, &pCreateInfos[i]); } @@ -1180,7 +1160,6 @@ bool WrappedVulkan::Serialise_vkCreateComputePipelines(SerialiserType &ser, VkDe AddResource(Pipeline, ResourceType::PipelineState, "Compute Pipeline"); ResourceId live = GetResourceManager()->WrapResource(Pipeline, Unwrap(device), pipe); - GetResourceManager()->AddLiveResource(Pipeline, pipe); VkPipelineShaderStageCreateInfo shadInstantiated = OrigCreateInfo.stage; @@ -1345,8 +1324,6 @@ VkResult WrappedVulkan::vkCreateComputePipelines(VkDevice device, VkPipelineCach } else { - GetResourceManager()->AddLiveResource(id, pPipelines[i]); - m_CreationInfo.m_Pipeline[id].Init(GetResourceManager(), m_CreationInfo, id, &pCreateInfos[i]); } @@ -1454,7 +1431,6 @@ bool WrappedVulkan::Serialise_vkCreateRayTracingPipelinesKHR( AddResource(Pipeline, ResourceType::PipelineState, "RT Pipeline"); ResourceId live = GetResourceManager()->WrapResource(Pipeline, Unwrap(device), pipe); - GetResourceManager()->AddLiveResource(Pipeline, pipe); VulkanCreationInfo::Pipeline &pipeInfo = m_CreationInfo.m_Pipeline[live]; @@ -1650,8 +1626,6 @@ VkResult WrappedVulkan::vkCreateRayTracingPipelinesKHR( } else { - GetResourceManager()->AddLiveResource(id, pPipelines[i]); - m_CreationInfo.m_Pipeline[id].Init(GetResourceManager(), m_CreationInfo, id, &pCreateInfos[i]); } diff --git a/renderdoc/driver/vulkan/wrappers/vk_sync_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_sync_funcs.cpp index a6df3b811..ede0df5df 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_sync_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_sync_funcs.cpp @@ -129,8 +129,7 @@ bool WrappedVulkan::Serialise_vkCreateFence(SerialiserType &ser, VkDevice device } else { - ResourceId live = GetResourceManager()->WrapResource(Fence, Unwrap(device), fence); - GetResourceManager()->AddLiveResource(Fence, fence); + GetResourceManager()->WrapResource(Fence, Unwrap(device), fence); } AddResource(Fence, ResourceType::Sync, "Fence"); @@ -172,10 +171,6 @@ VkResult WrappedVulkan::vkCreateFence(VkDevice device, const VkFenceCreateInfo * VkResourceRecord *record = GetResourceManager()->AddResourceRecord(*pFence); record->AddChunk(chunk); } - else - { - GetResourceManager()->AddLiveResource(id, *pFence); - } } return ret; @@ -357,8 +352,7 @@ bool WrappedVulkan::Serialise_vkCreateEvent(SerialiserType &ser, VkDevice device } else { - ResourceId live = GetResourceManager()->WrapResource(Event, Unwrap(device), ev); - GetResourceManager()->AddLiveResource(Event, ev); + GetResourceManager()->WrapResource(Event, Unwrap(device), ev); } AddResource(Event, ResourceType::Sync, "Event"); @@ -394,10 +388,6 @@ VkResult WrappedVulkan::vkCreateEvent(VkDevice device, const VkEventCreateInfo * VkResourceRecord *record = GetResourceManager()->AddResourceRecord(*pEvent); record->AddChunk(chunk); } - else - { - GetResourceManager()->AddLiveResource(id, *pEvent); - } } return ret; @@ -583,7 +573,6 @@ bool WrappedVulkan::Serialise_vkCreateSemaphore(SerialiserType &ser, VkDevice de else { live = GetResourceManager()->WrapResource(Semaphore, Unwrap(device), sem); - GetResourceManager()->AddLiveResource(Semaphore, sem); } } @@ -626,10 +615,6 @@ VkResult WrappedVulkan::vkCreateSemaphore(VkDevice device, const VkSemaphoreCrea VkResourceRecord *record = GetResourceManager()->AddResourceRecord(*pSemaphore); record->AddChunk(chunk); } - else - { - GetResourceManager()->AddLiveResource(id, *pSemaphore); - } } return ret; diff --git a/renderdoc/driver/vulkan/wrappers/vk_wsi_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_wsi_funcs.cpp index 0ec863f1c..c0e70be19 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_wsi_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_wsi_funcs.cpp @@ -165,10 +165,6 @@ VkResult WrappedVulkan::vkRegisterDeviceEventEXT(VkDevice device, VkResourceRecord *record = GetResourceManager()->AddResourceRecord(*pFence); record->AddChunk(chunk); } - else - { - GetResourceManager()->AddLiveResource(id, *pFence); - } } return ret; @@ -210,10 +206,6 @@ VkResult WrappedVulkan::vkRegisterDisplayEventEXT(VkDevice device, VkDisplayKHR VkResourceRecord *record = GetResourceManager()->AddResourceRecord(*pFence); record->AddChunk(chunk); } - else - { - GetResourceManager()->AddLiveResource(id, *pFence); - } } return ret; @@ -251,8 +243,6 @@ bool WrappedVulkan::Serialise_vkGetSwapchainImagesKHR(SerialiserType &ser, VkDev RDCASSERT(SwapchainImageIndex < swapInfo.images.size(), SwapchainImageIndex, swapInfo.images.size()); - GetResourceManager()->AddLiveResource(SwapchainImage, - swapInfo.images[SwapchainImageIndex].userSwapImage); AddResource(SwapchainImage, ResourceType::SwapchainImage, "Swapchain Image"); DerivedResource(device, SwapchainImage); @@ -567,8 +557,6 @@ bool WrappedVulkan::Serialise_vkCreateSwapchainKHR(SerialiserType &ser, VkDevice } memid = GetResourceManager()->WrapResource(ResourceId(), Unwrap(device), mem); - // register as a live-only resource, so it is cleaned up properly - GetResourceManager()->AddLiveResource(memid, mem); } vkr = ObjDisp(device)->BindImageMemory(Unwrap(device), ims[i], Unwrap(mem), imageMemOffsets[i]); @@ -888,10 +876,6 @@ void WrappedVulkan::WrapAndProcessCreatedSwapchain(VkDevice device, } } } - else - { - GetResourceManager()->AddLiveResource(id, *pSwapChain); - } } VkResult WrappedVulkan::vkCreateSwapchainKHR(VkDevice device,