Attempt to fix flicker on resize, don't recreate if image was already acquired. (#522)

This commit is contained in:
goeiecool9999 2022-11-21 19:06:35 +01:00 committed by GitHub
parent 3a94a276da
commit f4c2d16a3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2540,12 +2540,12 @@ bool VulkanRenderer::AcquireNextSwapchainImage(bool mainWindow)
auto& chainInfo = GetChainInfo(mainWindow); auto& chainInfo = GetChainInfo(mainWindow);
if (!UpdateSwapchainProperties(mainWindow))
return false;
if (chainInfo.swapchainImageIndex != -1) if (chainInfo.swapchainImageIndex != -1)
return true; // image already reserved return true; // image already reserved
if (!UpdateSwapchainProperties(mainWindow))
return false;
vkResetFences(m_logicalDevice, 1, &chainInfo.m_imageAvailableFence); vkResetFences(m_logicalDevice, 1, &chainInfo.m_imageAvailableFence);
VkResult result = vkAcquireNextImageKHR(m_logicalDevice, chainInfo.swapchain, std::numeric_limits<uint64_t>::max(), VK_NULL_HANDLE, chainInfo.m_imageAvailableFence, &chainInfo.swapchainImageIndex); VkResult result = vkAcquireNextImageKHR(m_logicalDevice, chainInfo.swapchain, std::numeric_limits<uint64_t>::max(), VK_NULL_HANDLE, chainInfo.m_imageAvailableFence, &chainInfo.swapchainImageIndex);
if (result != VK_SUCCESS) if (result != VK_SUCCESS)