mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Changed command buffers to be handled properly as pooled objects
This commit is contained in:
@@ -169,6 +169,12 @@ class VulkanResourceManager : public ResourceManager<WrappedVkRes*, TypedRealHan
|
||||
// though that the pool isn't going to be destroyed while
|
||||
// either allocation or freeing happens, so we only need to
|
||||
// lock against concurrent allocs or deletes of children.
|
||||
|
||||
if(record && record->bakedCommands)
|
||||
{
|
||||
record->bakedCommands->Delete(this);
|
||||
record->bakedCommands = NULL;
|
||||
}
|
||||
|
||||
if(record->pool)
|
||||
{
|
||||
|
||||
@@ -239,7 +239,14 @@ VkResult WrappedVulkan::vkAllocateCommandBuffers(
|
||||
|
||||
record->bakedCommands = NULL;
|
||||
|
||||
record->AddParent(GetRecord(pAllocateInfo->commandPool));
|
||||
record->pool = GetRecord(pAllocateInfo->commandPool);
|
||||
record->AddParent(record->pool);
|
||||
|
||||
{
|
||||
record->pool->LockChunks();
|
||||
record->pool->pooledChildren.push_back(record);
|
||||
record->pool->UnlockChunks();
|
||||
}
|
||||
|
||||
// we don't serialise this as we never create this command buffer directly.
|
||||
// Instead we create a command buffer for each baked list that we find.
|
||||
|
||||
@@ -103,17 +103,6 @@ void WrappedVulkan::vkFreeCommandBuffers(VkDevice device, VkCommandPool commandP
|
||||
{
|
||||
WrappedVkDispRes *wrapped = (WrappedVkDispRes *)GetWrapped(pCommandBuffers[c]);
|
||||
|
||||
if(wrapped->record)
|
||||
{
|
||||
if(wrapped->record->bakedCommands)
|
||||
{
|
||||
wrapped->record->bakedCommands->Delete(GetResourceManager());
|
||||
wrapped->record->bakedCommands = NULL;
|
||||
}
|
||||
wrapped->record->Delete(GetResourceManager());
|
||||
wrapped->record = NULL;
|
||||
}
|
||||
|
||||
VkCommandBuffer unwrapped = wrapped->real.As<VkCommandBuffer>();
|
||||
|
||||
GetResourceManager()->ReleaseWrappedResource(pCommandBuffers[c]);
|
||||
|
||||
Reference in New Issue
Block a user