Vulkan validation fixes (#2205)

When resizing the window, there's a race condition between the
validation of vkCreateSwapchainKHR's arguments and the actual
size of the window.
This ignores the validation warning when vkCreateSwapchainKHR succeeds.

On some graphic drivers vkAcquireNextImage and vkQueuePresentKHR
may return VK_SUBOPTIMAL_KHR. This is being handled as an error, which
leads to those frames being unnecessarily skipped.
This commit is contained in:
kingscallop 2020-08-17 05:08:32 +01:00 committed by GitHub
parent 1ca9f894d1
commit b297b48e88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -614,9 +614,13 @@ VK_IMPORT_DEVICE
, _userData
, s_debugReportObjectType
);
// For more info about 'VUID-VkSwapchainCreateInfoKHR-imageExtent-01274'
// check https://github.com/KhronosGroup/Vulkan-Docs/issues/1144
if (!bx::strFind(_message, "PointSizeMissing").isEmpty()
|| !bx::strFind(_message, "SwapchainTooManyImages").isEmpty()
|| !bx::strFind(_message, "SwapchainImageNotAcquired").isEmpty() )
|| !bx::strFind(_message, "SwapchainImageNotAcquired").isEmpty()
|| !bx::strFind(_message, "VUID-VkSwapchainCreateInfoKHR-imageExtent-01274").isEmpty() )
{
return VK_FALSE;
}
@ -2454,8 +2458,8 @@ VK_IMPORT_DEVICE
pi.pImageIndices = &m_backBufferColorIdx;
pi.pResults = NULL;
VkResult result = vkQueuePresentKHR(m_queueGraphics, &pi);
if (VK_ERROR_OUT_OF_DATE_KHR == result
|| VK_SUBOPTIMAL_KHR == result)
if (VK_ERROR_OUT_OF_DATE_KHR == result
|| VK_ERROR_VALIDATION_FAILED_EXT == result)
{
m_needToRefreshSwapchain = true;
}
@ -5963,8 +5967,8 @@ VK_DESTROY
, &m_backBufferColorIdx
);
if (VK_ERROR_OUT_OF_DATE_KHR == result
|| VK_SUBOPTIMAL_KHR == result)
if (VK_ERROR_OUT_OF_DATE_KHR == result
|| VK_ERROR_VALIDATION_FAILED_EXT == result)
{
m_needToRefreshSwapchain = true;
return;