Priority: P2: Important
Affects Version/s: 5.15.0
Component/s: GUI: Vulkan
Environment:Operating System: Manjaro Linux
KDE Plasma Version: 5.19.3
KDE Frameworks Version: 5.72.0
Qt Version: 5.15.0
Kernel Version: 5.7.9-1-MANJARO
OS Type: 64-bit
Processors: 4 × Intel® Core™ i7-6600U CPU @ 2.60GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 520
Commits:2c3fabfafd6064e0678e52d211da4364e996ad13 (qt/qtbase/6.0) f6cb24f4c0f1f48f9010ba78670577ff5643132f (qt/qtbase/dev) 87ce625b2bb845e41ebb766f43b801d448fed8b5 (qt/tqtc-qtbase/tqtc/lts-5.15)
When enabling the VK_LAYER_KHRONOS_validation layer when compiling the hellovulkantriangle example, the following validation error is printed:
vkDebug: Validation: 0: Validation Error: [ VUID-VkSwapchainCreateInfoKHR-minImageCount-01271 ] Object 0: handle = 0x557dcbbd89d0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xe18476f3 | vkCreateSwapchainKHR() called with minImageCount = 2, which is outside the bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR() (i.e. minImageCount = 3, maxImageCount = 0). The Vulkan spec states: minImageCount must be greater than or equal to the value returned in the minImageCount member of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://github.com/KhronosGroup/Vulkan-Docs/search?q=)VUID-VkSwapchainCreateInfoKHR-minImageCount-01271)
Looking at the creation of the vulkan swapchain in qvulkanwindow.cpp , I can see that qt uses a qBound to determine a value between minImageCount, maxImageCount.
The problem is that it does not take into account the fact maxImageCount can have a value of 0, which means that there are no actual maximum limit the amount of swapchain images as explained in vulkan documentation .
However, the qt implementation of QVulkanWindow does not allow to manually change the amount of swapchain images.
Since this is the first time reporting a bug to qt, let me know if more information is needed.