Browse Source

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.
kingscallop 5 years ago
parent
commit
b297b48e88
1 changed files with 9 additions and 5 deletions
  1. 9 5
      src/renderer_vk.cpp

+ 9 - 5
src/renderer_vk.cpp

@@ -614,9 +614,13 @@ VK_IMPORT_DEVICE
 			, _userData
 			, _userData
 			, s_debugReportObjectType
 			, 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()
 		if (!bx::strFind(_message, "PointSizeMissing").isEmpty()
 		||  !bx::strFind(_message, "SwapchainTooManyImages").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;
 			return VK_FALSE;
 		}
 		}
@@ -2454,8 +2458,8 @@ VK_IMPORT_DEVICE
 				pi.pImageIndices  = &m_backBufferColorIdx;
 				pi.pImageIndices  = &m_backBufferColorIdx;
 				pi.pResults       = NULL;
 				pi.pResults       = NULL;
 				VkResult result = vkQueuePresentKHR(m_queueGraphics, &pi);
 				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;
 					m_needToRefreshSwapchain = true;
 				}
 				}
@@ -5963,8 +5967,8 @@ VK_DESTROY
 			, &m_backBufferColorIdx
 			, &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;
 			m_needToRefreshSwapchain = true;
 			return;
 			return;