Merge pull request #4441 from stenzek/vulkan-max-image-count

Vulkan: Handle maxImageCount of zero when creating swap chain
This commit is contained in:
Markus Wick 2016-11-13 14:12:32 +01:00 committed by GitHub
commit bc98ec77be
1 changed files with 5 additions and 2 deletions

View File

@ -290,8 +290,11 @@ bool SwapChain::CreateSwapChain()
return false; return false;
// Select number of images in swap chain, we prefer one buffer in the background to work on // Select number of images in swap chain, we prefer one buffer in the background to work on
uint32_t image_count = uint32_t image_count = surface_capabilities.minImageCount + 1;
std::min(surface_capabilities.minImageCount + 1, surface_capabilities.maxImageCount);
// 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 // Determine the dimensions of the swap chain. Values of -1 indicate the size we specify here
// determines window size? // determines window size?