From 160fee67916c9cb7f6c4ceef04874c8efb051f76 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 11 Nov 2016 23:30:05 +1000 Subject: [PATCH] Vulkan: Handle maxImageCount of zero when creating swap chain anv seems to set this to zero, which is fine according to the spec, but we were using it as a maximum, which was resulting in a swap chain without any buffers being created. --- Source/Core/VideoBackends/Vulkan/SwapChain.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/Core/VideoBackends/Vulkan/SwapChain.cpp b/Source/Core/VideoBackends/Vulkan/SwapChain.cpp index 899f931c6d..e9d7e9cc5b 100644 --- a/Source/Core/VideoBackends/Vulkan/SwapChain.cpp +++ b/Source/Core/VideoBackends/Vulkan/SwapChain.cpp @@ -302,8 +302,11 @@ bool SwapChain::CreateSwapChain() return false; // Select number of images in swap chain, we prefer one buffer in the background to work on - uint32_t image_count = - std::min(surface_capabilities.minImageCount + 1, surface_capabilities.maxImageCount); + uint32_t image_count = surface_capabilities.minImageCount + 1; + + // maxImageCount can be zero, in which case there isn't an upper limit on the number of buffers. + if (surface_capabilities.maxImageCount > 0) + image_count = std::min(image_count, surface_capabilities.maxImageCount); // Determine the dimensions of the swap chain. Values of -1 indicate the size we specify here // determines window size?