From 943ec798592e20446ae3661cb76c44a20c8a30ec Mon Sep 17 00:00:00 2001 From: qarmin Date: Wed, 15 Apr 2020 10:27:57 +0200 Subject: Fixes leaks in ResourceCache, Vulkan and X11 --- drivers/vulkan/rendering_device_vulkan.cpp | 5 +++++ drivers/vulkan/vulkan_context.cpp | 9 +++++++++ 2 files changed, 14 insertions(+) (limited to 'drivers') diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index 4de2c88008..2769469838 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -7274,6 +7274,11 @@ void RenderingDeviceVulkan::finalize() { vertex_formats.erase(temp); } + for (int i = 0; i < framebuffer_formats.size(); i++) { + vkDestroyRenderPass(device, framebuffer_formats[i].render_pass, nullptr); + } + framebuffer_formats.clear(); + //all these should be clear at this point ERR_FAIL_COND(descriptor_pools.size()); ERR_FAIL_COND(dependency_map.size()); diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp index 16227367ab..0ce9ccce4c 100644 --- a/drivers/vulkan/vulkan_context.cpp +++ b/drivers/vulkan/vulkan_context.cpp @@ -1503,6 +1503,15 @@ VulkanContext::~VulkanContext() { if (queue_props) { free(queue_props); } + for (uint32_t i = 0; i < FRAME_LAG; i++) { + vkDestroyFence(device, fences[i], nullptr); + vkDestroySemaphore(device, image_acquired_semaphores[i], nullptr); + vkDestroySemaphore(device, draw_complete_semaphores[i], nullptr); + if (separate_present_queue) { + vkDestroySemaphore(device, image_ownership_semaphores[i], nullptr); + } + } + DestroyDebugUtilsMessengerEXT(inst, dbg_messenger, nullptr); vkDestroyDevice(device, nullptr); vkDestroyInstance(inst, nullptr); } -- cgit v1.2.3