Can VkSurfaceCapabilitiesKHR imagecounts change?

I use currentExtent, minImageExtent and maxImageExtent to determine the extent for the swapchain.

When I recreate the swapchain because of a window resize, I have to retrieve VkSurfaceCapabilitiesKHR again, because currentExtent is a value that can change between different calls to vkGetPhysicalDeviceSurfaceCapabilitiesKHR.

From the same VkSurfaceCapabilitiesKHR, I use minImageCount and maxImageCount to determine the amount of swapchain images to create. That’s important further down the line again, as e.g. a 3D model’s transform matrix needs one uniform buffer (+ descriptor set) per swapchain image.

As a window resize can happen anytime, there’s a bunch of boilerplate code for always being ready to recreate all these descriptor sets. However, a window resize changes neither their structure nor their content. So if I could rely on minImageCount and maxImageCount staying the same, I could avoid all that.

Can I rely on that, though?

Last time I checked, it is somewhat inconclusive.

1 Like

One would not expect it to change under normal circumastances.

Nevertheless, the surface query does not determine the amount of swapchain images. It is the actual amount vkGetSwapchainImages returns that determines it.