Merge pull request #634 from hevrard/triangle_present

Be robust to queuePresent returning VK_SUBOPTIMAL_KHR
This commit is contained in:
Sascha Willems 2020-01-16 20:19:16 +01:00 committed by GitHub
commit 339986642f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -355,7 +355,11 @@ public:
// Present the current buffer to the swap chain // 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 // 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 // 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 // Prepare vertex and index buffers for an indexed triangle