diff --git a/Common/GPU/Vulkan/VulkanRenderManager.cpp b/Common/GPU/Vulkan/VulkanRenderManager.cpp index 3f45776672..ab98611c59 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.cpp +++ b/Common/GPU/Vulkan/VulkanRenderManager.cpp @@ -869,21 +869,26 @@ void VulkanRenderManager::EndCurRenderStep() { VkSampleCountFlagBits sampleCount = curRenderStep_->render.framebuffer ? curRenderStep_->render.framebuffer->sampleCount : VK_SAMPLE_COUNT_1_BIT; - compileQueueMutex_.lock(); bool needsCompile = false; for (VKRGraphicsPipeline *pipeline : pipelinesToCheck_) { if (!pipeline) { // Not good, but let's try not to crash. continue; } - std::lock_guard lock(pipeline->mutex_); + std::unique_lock lock(pipeline->mutex_); if (!pipeline->pipeline[(size_t)rpType]) { pipeline->pipeline[(size_t)rpType] = Promise::CreateEmpty(); + lock.unlock(); + _assert_(renderPass); + compileQueueMutex_.lock(); compileQueue_.emplace_back(pipeline, renderPass->Get(vulkan_, rpType, sampleCount), rpType, sampleCount); + compileQueueMutex_.unlock(); needsCompile = true; } } + + compileQueueMutex_.lock(); if (needsCompile) compileCond_.notify_one(); compileQueueMutex_.unlock();