diff --git a/Common/GPU/Vulkan/VulkanRenderManager.cpp b/Common/GPU/Vulkan/VulkanRenderManager.cpp index f271dabcbec6..a425e46c7f21 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.cpp +++ b/Common/GPU/Vulkan/VulkanRenderManager.cpp @@ -415,6 +415,11 @@ void VulkanRenderManager::DestroyBackbuffers() { VulkanRenderManager::~VulkanRenderManager() { INFO_LOG(G3D, "VulkanRenderManager destructor"); + { + std::unique_lock lock(compileMutex_); + _assert_(compileQueue_.empty()); + } + if (useRenderThread_) { _dbg_assert_(!renderThread_.joinable()); } @@ -439,9 +444,6 @@ void VulkanRenderManager::CompileThreadFunc() { std::vector toCompile; { std::unique_lock lock(compileMutex_); - // TODO: Should this be while? - // It may be beneficial also to unlock and wait a little bit to see if we get some more shaders - // so we can do a better job of thread-sorting them. if (compileQueue_.empty() && runCompileThread_) { compileCond_.wait(lock); } @@ -496,6 +498,9 @@ void VulkanRenderManager::CompileThreadFunc() { // Hold off just a bit before we check again, to allow bunches of pipelines to collect. sleep_ms(1); } + + std::unique_lock lock(compileMutex_); + _assert_(compileQueue_.empty()); } void VulkanRenderManager::RenderThreadFunc() { diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index 95b9ede53fad..4b2211c5f18f 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -173,7 +173,7 @@ GPU_Vulkan::~GPU_Vulkan() { SaveCache(shaderCachePath_); - // Super important to delete pipeline manager FIRST, before clearing shaders, so we wait for all pending pipelines to finish compiling. + // StopThreads should have ensured that no pipelines are queued to compile at this point. So we can tear it down. delete pipelineManager_; pipelineManager_ = nullptr;