From 05bf2105f49795e0170bf7100969612fc4292d90 Mon Sep 17 00:00:00 2001 From: Hugues Evrard Date: Wed, 20 Nov 2019 18:42:30 -0800 Subject: [PATCH] Be robust to queuePresent returning VK_SUBOPTIMAL_KHR --- examples/triangle/triangle.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/triangle/triangle.cpp b/examples/triangle/triangle.cpp index 85cff06e..d08cf4c5 100644 --- a/examples/triangle/triangle.cpp +++ b/examples/triangle/triangle.cpp @@ -355,7 +355,11 @@ public: // Present the current buffer to the swap chain // Pass the semaphore signaled by the command buffer submission from the submit info as the wait semaphore for swap chain presentation // This ensures that the image is not presented to the windowing system until all commands have been submitted - VK_CHECK_RESULT(swapChain.queuePresent(queue, currentBuffer, renderCompleteSemaphore)); + VkResult present = swapChain.queuePresent(queue, currentBuffer, renderCompleteSemaphore); + if (!((present == VK_SUCCESS) || (present == VK_SUBOPTIMAL_KHR))) { + VK_CHECK_RESULT(present); + } + } // Prepare vertex and index buffers for an indexed triangle