Vulkan: Manage ownership of memory manager with unique_ptr

This commit is contained in:
goeiecool9999 2024-11-04 19:51:43 +01:00
parent 4581281a19
commit d6a5693aa0
2 changed files with 6 additions and 6 deletions

View File

@ -439,7 +439,7 @@ VulkanRenderer::VulkanRenderer()
GetDeviceFeatures();
// init memory manager
memoryManager = new VKRMemoryManager(this);
memoryManager.reset(new VKRMemoryManager(this));
try
{
@ -679,6 +679,9 @@ VulkanRenderer::~VulkanRenderer()
vkDestroyDebugUtilsMessengerEXT(m_instance, m_debugCallback, nullptr);
}
// destroy memory manager
memoryManager.reset();
// destroy instance, devices
if (m_instance != VK_NULL_HANDLE)
{
@ -690,9 +693,6 @@ VulkanRenderer::~VulkanRenderer()
vkDestroyInstance(m_instance, nullptr);
}
// destroy memory manager
delete memoryManager;
// crashes?
//glslang::FinalizeProcess();
}

View File

@ -137,8 +137,8 @@ class VulkanRenderer : public Renderer
public:
// memory management
VKRMemoryManager* memoryManager{};
VKRMemoryManager* GetMemoryManager() const { return memoryManager; };
std::unique_ptr<VKRMemoryManager> memoryManager;
const std::unique_ptr<VKRMemoryManager>& GetMemoryManager() const { return memoryManager; };
VkSupportedFormatInfo_t m_supportedFormatInfo;