Handle maxImageCount 0 in QVulkanWindow
Take the logic we use in QRhi's Vulkan backend. Fixes: QTBUG-85791 Change-Id: Ifdc2b3d351af71fbc86e20abcede902303e41fc4 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit f6cb24f4c0f1f48f9010ba78670577ff5643132f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
1176959b47
commit
2c3fabfafd
@ -1043,9 +1043,11 @@ void QVulkanWindowPrivate::recreateSwapChain()
|
||||
VkPhysicalDevice physDev = physDevs.at(physDevIndex);
|
||||
VkSurfaceCapabilitiesKHR surfaceCaps;
|
||||
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physDev, surface, &surfaceCaps);
|
||||
uint32_t reqBufferCount = swapChainBufferCount;
|
||||
if (surfaceCaps.maxImageCount)
|
||||
reqBufferCount = qBound(surfaceCaps.minImageCount, reqBufferCount, surfaceCaps.maxImageCount);
|
||||
uint32_t reqBufferCount;
|
||||
if (surfaceCaps.maxImageCount == 0)
|
||||
reqBufferCount = qMax<uint32_t>(2, surfaceCaps.minImageCount);
|
||||
else
|
||||
reqBufferCount = qMax(qMin<uint32_t>(surfaceCaps.maxImageCount, 3), surfaceCaps.minImageCount);
|
||||
|
||||
VkExtent2D bufferSize = surfaceCaps.currentExtent;
|
||||
if (bufferSize.width == uint32_t(-1)) {
|
||||
|
@ -132,7 +132,7 @@ public:
|
||||
// rendering thread will get throttled to the presentation rate (vsync).
|
||||
// This is in effect Example 5 from the VK_KHR_swapchain spec.
|
||||
VkPresentModeKHR presentMode = VK_PRESENT_MODE_FIFO_KHR;
|
||||
int swapChainBufferCount = 2;
|
||||
int swapChainBufferCount = 0;
|
||||
int frameLag = 2;
|
||||
|
||||
QSize swapChainImageSize;
|
||||
|
Loading…
x
Reference in New Issue
Block a user