mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
fix destroyed BDA buffers staying tracked
This commit is contained in:
committed by
Baldur Karlsson
parent
ef0d6737cc
commit
c71f3d504b
@@ -1038,7 +1038,6 @@ private:
|
||||
{
|
||||
rdcarray<VkDeviceMemory> DeadMemories;
|
||||
rdcarray<VkBuffer> DeadBuffers;
|
||||
rdcarray<ResourceId> IDs;
|
||||
|
||||
// with descriptor buffers, we also need to hold onto images and image views
|
||||
rdcarray<VkImage> DeadImages;
|
||||
|
||||
@@ -30,16 +30,10 @@ RDOC_CONFIG(bool, Vulkan_Debug_MemoryAllocationLogging, false,
|
||||
|
||||
GPUAddressRange WrappedVulkan::CreateAddressRange(VkDevice device, VkBuffer buffer)
|
||||
{
|
||||
bool isBDA = false;
|
||||
{
|
||||
SCOPED_LOCK(m_DeviceAddressResourcesLock);
|
||||
isBDA = m_DeviceAddressResources.IDs.contains(GetResID(buffer));
|
||||
}
|
||||
|
||||
if(!isBDA)
|
||||
VkResourceRecord *record = GetRecord(buffer);
|
||||
if(!record->hasBDA)
|
||||
return {};
|
||||
|
||||
VkResourceRecord *record = GetRecord(buffer);
|
||||
VkResourceRecord *memrecord = GetResourceManager()->GetResourceRecord(record->baseResourceMem);
|
||||
|
||||
const bool isSparse = record->resInfo && record->resInfo->IsSparse();
|
||||
|
||||
@@ -307,13 +307,12 @@ void WrappedVulkan::vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAl
|
||||
// opaque capture address isn't re-used before the capture completes
|
||||
{
|
||||
SCOPED_READLOCK(m_CapTransitionLock);
|
||||
SCOPED_LOCK(m_DeviceAddressResourcesLock);
|
||||
if(IsActiveCapturing(m_State) && m_DeviceAddressResources.IDs.contains(GetResID(buffer)))
|
||||
if(IsActiveCapturing(m_State) && GetRecord(buffer)->hasBDA)
|
||||
{
|
||||
SCOPED_LOCK(m_DeviceAddressResourcesLock);
|
||||
m_DeviceAddressResources.DeadBuffers.push_back(buffer);
|
||||
return;
|
||||
}
|
||||
m_DeviceAddressResources.IDs.removeOne(GetResID(buffer));
|
||||
}
|
||||
|
||||
if(IsCaptureMode(m_State))
|
||||
|
||||
@@ -842,10 +842,7 @@ VkResult WrappedVulkan::vkAllocateMemory(VkDevice device, const VkMemoryAllocate
|
||||
|
||||
memFlags->flags |= VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT;
|
||||
|
||||
{
|
||||
SCOPED_LOCK(m_DeviceAddressResourcesLock);
|
||||
m_DeviceAddressResources.IDs.push_back(record->GetResourceID());
|
||||
}
|
||||
record->hasBDA = true;
|
||||
}
|
||||
|
||||
{
|
||||
@@ -950,13 +947,12 @@ void WrappedVulkan::vkFreeMemory(VkDevice device, VkDeviceMemory memory, const V
|
||||
// opaque capture address isn't re-used before the capture completes
|
||||
{
|
||||
SCOPED_READLOCK(m_CapTransitionLock);
|
||||
SCOPED_LOCK(m_DeviceAddressResourcesLock);
|
||||
if(IsActiveCapturing(m_State) && m_DeviceAddressResources.IDs.contains(GetResID(memory)))
|
||||
if(IsActiveCapturing(m_State) && wrapped->record->hasBDA)
|
||||
{
|
||||
SCOPED_LOCK(m_DeviceAddressResourcesLock);
|
||||
m_DeviceAddressResources.DeadMemories.push_back(memory);
|
||||
return;
|
||||
}
|
||||
m_DeviceAddressResources.IDs.removeOne(GetResID(memory));
|
||||
}
|
||||
|
||||
MemMapState *memMapState = wrapped->record->memMapState;
|
||||
@@ -2066,11 +2062,6 @@ bool WrappedVulkan::Serialise_vkCreateBuffer(SerialiserType &ser, VkDevice devic
|
||||
}
|
||||
}
|
||||
|
||||
if(patchedusage & VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT)
|
||||
{
|
||||
m_DeviceAddressResources.IDs.push_back(GetResID(buf));
|
||||
}
|
||||
|
||||
if(patchedusage & VK_BUFFER_USAGE_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT)
|
||||
m_ResourceDescBuffers.push_back(GetResID(buf));
|
||||
|
||||
@@ -2231,10 +2222,7 @@ VkResult WrappedVulkan::vkCreateBuffer(VkDevice device, const VkBufferCreateInfo
|
||||
// address
|
||||
AddForcedReference(record);
|
||||
|
||||
{
|
||||
SCOPED_LOCK(m_DeviceAddressResourcesLock);
|
||||
m_DeviceAddressResources.IDs.push_back(record->GetResourceID());
|
||||
}
|
||||
record->hasBDA = true;
|
||||
|
||||
if(DescriptorBuffers())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user