From ae05db37245ab67b0b601012bb08cd52c25bb7b7 Mon Sep 17 00:00:00 2001 From: ice <1391525377@qq.com> Date: Fri, 1 Aug 2025 00:45:15 +0800 Subject: [PATCH] fix: destroy PipelineCache --- src/pipelinecache.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pipelinecache.cpp b/src/pipelinecache.cpp index a3c602900..062336e66 100644 --- a/src/pipelinecache.cpp +++ b/src/pipelinecache.cpp @@ -138,7 +138,7 @@ public: mutable std::vector cache_digests; mutable std::vector cache_artifacts; - VkPipelineCache vk_pipeline_cache; + VkPipelineCache vk_pipeline_cache = 0; // VK_NULL_HANDLE mutable std::vector > > cache_spirv_module; // digest(index,opt) -> spirv data mutable Mutex cache_lock; @@ -259,6 +259,12 @@ void PipelineCache::clear() d->cache_digests.clear(); d->cache_artifacts.clear(); + + if (d->vk_pipeline_cache) + { + vkDestroyPipelineCache(vkdev->vkdevice(), d->vk_pipeline_cache, 0); + d->vk_pipeline_cache = 0; + } } int PipelineCache::get_pipeline(const uint32_t* spv_data, size_t spv_data_size, const std::vector& specializations,