mirror of https://github.com/cemu-project/Cemu.git
Properly handle resource clean up
This commit is contained in:
parent
e97493b2a1
commit
d59e17b105
|
@ -334,10 +334,12 @@ VKRBuffer* VKRBuffer::Create(VKR_BUFFER_TYPE bufferType, size_t bufferSize, VkMe
|
||||||
|
|
||||||
VKRBuffer::~VKRBuffer()
|
VKRBuffer::~VKRBuffer()
|
||||||
{
|
{
|
||||||
if(m_mappedMemory)
|
if (m_mappedMemory)
|
||||||
vkUnmapMemory(VulkanRenderer::GetInstance()->GetLogicalDevice(), m_bufferMemory);
|
vkUnmapMemory(VulkanRenderer::GetInstance()->GetLogicalDevice(), m_bufferMemory);
|
||||||
vkFreeMemory(VulkanRenderer::GetInstance()->GetLogicalDevice(), m_bufferMemory, nullptr);
|
if (m_bufferMemory != VK_NULL_HANDLE)
|
||||||
vkDestroyBuffer(VulkanRenderer::GetInstance()->GetLogicalDevice(), m_buffer, nullptr);
|
vkFreeMemory(VulkanRenderer::GetInstance()->GetLogicalDevice(), m_bufferMemory, nullptr);
|
||||||
|
if (m_buffer != VK_NULL_HANDLE)
|
||||||
|
vkDestroyBuffer(VulkanRenderer::GetInstance()->GetLogicalDevice(), m_buffer, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkBufferChunkedHeap::~VkBufferChunkedHeap()
|
VkBufferChunkedHeap::~VkBufferChunkedHeap()
|
||||||
|
|
|
@ -679,6 +679,9 @@ VulkanRenderer::~VulkanRenderer()
|
||||||
vkDestroyDebugUtilsMessengerEXT(m_instance, m_debugCallback, nullptr);
|
vkDestroyDebugUtilsMessengerEXT(m_instance, m_debugCallback, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// destroy memory manager
|
||||||
|
delete memoryManager;
|
||||||
|
|
||||||
// destroy instance, devices
|
// destroy instance, devices
|
||||||
if (m_instance != VK_NULL_HANDLE)
|
if (m_instance != VK_NULL_HANDLE)
|
||||||
{
|
{
|
||||||
|
@ -690,9 +693,6 @@ VulkanRenderer::~VulkanRenderer()
|
||||||
vkDestroyInstance(m_instance, nullptr);
|
vkDestroyInstance(m_instance, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// destroy memory manager
|
|
||||||
delete memoryManager;
|
|
||||||
|
|
||||||
// crashes?
|
// crashes?
|
||||||
//glslang::FinalizeProcess();
|
//glslang::FinalizeProcess();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue