From 7ed6801101e965a77cf45fc3d01d346979ad6be7 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 8 Mar 2024 14:21:14 +1000 Subject: [PATCH] VulkanDevice: Add additional semaphore on swap chain We don't actually need +1 semaphores, or, more than one really. But, the validation layer gets cranky if we don't fence wait before the next image acquire. So, add an additional semaphore to ensure that we're never acquiring before fence waiting. --- pcsx2/GS/Renderers/Vulkan/VKSwapChain.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pcsx2/GS/Renderers/Vulkan/VKSwapChain.cpp b/pcsx2/GS/Renderers/Vulkan/VKSwapChain.cpp index 02e31b4c9a..f0f3f05426 100644 --- a/pcsx2/GS/Renderers/Vulkan/VKSwapChain.cpp +++ b/pcsx2/GS/Renderers/Vulkan/VKSwapChain.cpp @@ -442,9 +442,13 @@ bool VKSwapChain::CreateSwapChain() m_images.push_back(std::move(texture)); } - m_semaphores.reserve(image_count); - m_current_semaphore = (image_count - 1); - for (u32 i = 0; i < image_count; i++) + // We don't actually need +1 semaphores, or, more than one really. + // But, the validation layer gets cranky if we don't fence wait before the next image acquire. + // So, add an additional semaphore to ensure that we're never acquiring before fence waiting. + const u32 semaphore_count = (image_count + 1); + m_semaphores.reserve(semaphore_count); + m_current_semaphore = 0; + for (u32 i = 0; i < semaphore_count; i++) { ImageSemaphores sema;