From 666d7fbb991557c49e4ca3b9b582e261e8299c4d Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 13 Sep 2020 00:06:01 +1000 Subject: [PATCH] Vulkan/Context: Add pipeline destruction deferring --- src/common/vulkan/context.cpp | 6 ++++++ src/common/vulkan/context.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/common/vulkan/context.cpp b/src/common/vulkan/context.cpp index 9db2f5512..90959dd31 100644 --- a/src/common/vulkan/context.cpp +++ b/src/common/vulkan/context.cpp @@ -997,6 +997,12 @@ void Context::DeferImageViewDestruction(VkImageView object) resources.cleanup_resources.push_back([this, object]() { vkDestroyImageView(m_device, object, nullptr); }); } +void Context::DeferPipelineDestruction(VkPipeline pipeline) +{ + FrameResources& resources = m_frame_resources[m_current_frame]; + resources.cleanup_resources.push_back([this, pipeline]() { vkDestroyPipeline(m_device, pipeline, nullptr); }); +} + static VKAPI_ATTR VkBool32 VKAPI_CALL DebugReportCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, diff --git a/src/common/vulkan/context.h b/src/common/vulkan/context.h index 2d4780511..6fec69044 100644 --- a/src/common/vulkan/context.h +++ b/src/common/vulkan/context.h @@ -163,6 +163,7 @@ public: void DeferFramebufferDestruction(VkFramebuffer object); void DeferImageDestruction(VkImage object); void DeferImageViewDestruction(VkImageView object); + void DeferPipelineDestruction(VkPipeline pipeline); // Wait for a fence to be completed. // Also invokes callbacks for completion.