From 966ac4458a2a7beb66cfa2ec7b6fccd1e144809a Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 18 May 2020 23:06:14 -0700 Subject: [PATCH] Vulkan: Fix leak and remove extra allocator. The leak was because we restored immediately after initializing, and therefore leaked several pipelines. This allocator isn't used right now, so just using up memory. --- GPU/Common/PresentationCommon.cpp | 1 + GPU/Vulkan/FramebufferVulkan.cpp | 17 +---------------- GPU/Vulkan/FramebufferVulkan.h | 1 - 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/GPU/Common/PresentationCommon.cpp b/GPU/Common/PresentationCommon.cpp index c8b638f3ce..796e4e694f 100644 --- a/GPU/Common/PresentationCommon.cpp +++ b/GPU/Common/PresentationCommon.cpp @@ -352,6 +352,7 @@ Draw::Pipeline *PresentationCommon::CreatePipeline(std::vectorCreateBuffer(sizeof(Vertex) * 8, BufferUsageFlag::DYNAMIC | BufferUsageFlag::VERTEXDATA); diff --git a/GPU/Vulkan/FramebufferVulkan.cpp b/GPU/Vulkan/FramebufferVulkan.cpp index d8829a4ea1..e2bf96a6c3 100644 --- a/GPU/Vulkan/FramebufferVulkan.cpp +++ b/GPU/Vulkan/FramebufferVulkan.cpp @@ -78,7 +78,7 @@ FramebufferManagerVulkan::FramebufferManagerVulkan(Draw::DrawContext *draw, Vulk vulkan_(vulkan) { presentation_->SetLanguage(GLSL_VULKAN); - DeviceRestore(vulkan, draw); + InitDeviceObjects(); // After a blit we do need to rebind for the VulkanRenderManager to know what to do. needGLESRebinds_ = true; @@ -410,17 +410,6 @@ void FramebufferManagerVulkan::DeviceLost() { DestroyAllFBOs(); DestroyDeviceObjects(); presentation_->DeviceLost(); - - if (allocator_) { - allocator_->Destroy(); - - // We have to delete on queue, so this can free its queued deletions. - vulkan_->Delete().QueueCallback([](void *ptr) { - auto allocator = static_cast(ptr); - delete allocator; - }, allocator_); - allocator_ = nullptr; - } } void FramebufferManagerVulkan::DeviceRestore(VulkanContext *vulkan, Draw::DrawContext *draw) { @@ -428,9 +417,5 @@ void FramebufferManagerVulkan::DeviceRestore(VulkanContext *vulkan, Draw::DrawCo draw_ = draw; presentation_->DeviceRestore(draw); - _assert_(!allocator_); - - allocator_ = new VulkanDeviceAllocator(vulkan_, 1 * 1024 * 1024, 8 * 1024 * 1024); - InitDeviceObjects(); } diff --git a/GPU/Vulkan/FramebufferVulkan.h b/GPU/Vulkan/FramebufferVulkan.h index bbd799e1d0..5ceec728eb 100644 --- a/GPU/Vulkan/FramebufferVulkan.h +++ b/GPU/Vulkan/FramebufferVulkan.h @@ -84,7 +84,6 @@ private: TextureCacheVulkan *textureCacheVulkan_ = nullptr; ShaderManagerVulkan *shaderManagerVulkan_ = nullptr; DrawEngineVulkan *drawEngineVulkan_ = nullptr; - VulkanDeviceAllocator *allocator_ = nullptr; VulkanPushBuffer *push_; enum {