mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-24 06:36:08 +00:00
Destroy framebuffer before recreating it, and don't leak loadRP/loadFBs
This commit is contained in:
@@ -838,6 +838,7 @@ void VulkanDebugManager::CreateCustomShaderTex(uint32_t width, uint32_t height,
|
||||
if(width == m_Custom.TexWidth && height == m_Custom.TexHeight)
|
||||
{
|
||||
// recreate framebuffer for this mip
|
||||
m_pDriver->vkDestroyFramebuffer(dev, m_Custom.TexFB, NULL);
|
||||
|
||||
// Create framebuffer rendering just to overlay image, no depth
|
||||
VkFramebufferCreateInfo fbinfo = {
|
||||
|
||||
@@ -175,13 +175,57 @@ DESTROY_IMPL(VkFence, DestroyFence)
|
||||
DESTROY_IMPL(VkEvent, DestroyEvent)
|
||||
DESTROY_IMPL(VkCommandPool, DestroyCommandPool)
|
||||
DESTROY_IMPL(VkQueryPool, DestroyQueryPool)
|
||||
DESTROY_IMPL(VkFramebuffer, DestroyFramebuffer)
|
||||
DESTROY_IMPL(VkRenderPass, DestroyRenderPass)
|
||||
DESTROY_IMPL(VkDescriptorUpdateTemplate, DestroyDescriptorUpdateTemplate)
|
||||
DESTROY_IMPL(VkSamplerYcbcrConversion, DestroySamplerYcbcrConversion)
|
||||
|
||||
#undef DESTROY_IMPL
|
||||
|
||||
void WrappedVulkan::vkDestroyFramebuffer(VkDevice device, VkFramebuffer obj,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if(obj == VK_NULL_HANDLE)
|
||||
return;
|
||||
VkFramebuffer unwrappedObj = Unwrap(obj);
|
||||
m_ForcedReferences.removeOne(GetRecord(obj));
|
||||
if(IsReplayMode(m_State))
|
||||
{
|
||||
const VulkanCreationInfo::Framebuffer &rpinfo = m_CreationInfo.m_Framebuffer[GetResID(obj)];
|
||||
|
||||
for(VkFramebuffer loadfb : rpinfo.loadFBs)
|
||||
{
|
||||
ObjDisp(device)->DestroyFramebuffer(Unwrap(device), Unwrap(loadfb), pAllocator);
|
||||
GetResourceManager()->ReleaseWrappedResource(loadfb, true);
|
||||
}
|
||||
|
||||
m_CreationInfo.erase(GetResID(obj));
|
||||
}
|
||||
GetResourceManager()->ReleaseWrappedResource(obj, true);
|
||||
ObjDisp(device)->DestroyFramebuffer(Unwrap(device), unwrappedObj, pAllocator);
|
||||
}
|
||||
|
||||
void WrappedVulkan::vkDestroyRenderPass(VkDevice device, VkRenderPass obj,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if(obj == VK_NULL_HANDLE)
|
||||
return;
|
||||
VkRenderPass unwrappedObj = Unwrap(obj);
|
||||
m_ForcedReferences.removeOne(GetRecord(obj));
|
||||
if(IsReplayMode(m_State))
|
||||
{
|
||||
const VulkanCreationInfo::RenderPass &rpinfo = m_CreationInfo.m_RenderPass[GetResID(obj)];
|
||||
|
||||
for(VkRenderPass loadrp : rpinfo.loadRPs)
|
||||
{
|
||||
ObjDisp(device)->DestroyRenderPass(Unwrap(device), Unwrap(loadrp), pAllocator);
|
||||
GetResourceManager()->ReleaseWrappedResource(loadrp, true);
|
||||
}
|
||||
|
||||
m_CreationInfo.erase(GetResID(obj));
|
||||
}
|
||||
GetResourceManager()->ReleaseWrappedResource(obj, true);
|
||||
ObjDisp(device)->DestroyRenderPass(Unwrap(device), unwrappedObj, pAllocator);
|
||||
}
|
||||
|
||||
void WrappedVulkan::vkDestroyBuffer(VkDevice device, VkBuffer buffer,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user