Vulkan: Catch out-of-date on present that vulkan.hpp throws.

This commit is contained in:
BearOso 2023-09-04 14:00:03 -05:00
parent 02cb6dc319
commit 67b6d47c09
1 changed files with 10 additions and 2 deletions

View File

@ -320,11 +320,19 @@ bool Swapchain::swap()
.setSwapchains(swapchain_object.get())
.setImageIndices(current_swapchain_image);
auto result = queue.presentKHR(present_info);
vk::Result result;
try
{
result = queue.presentKHR(present_info);
}
catch (std::exception &e)
{
printf("%s\n", e.what());
}
current_frame = (current_frame + 1) % num_swapchain_images;
if (result != vk::Result::eSuccess)
if (result != vk::Result::eSuccess && result != vk::Result::eSuboptimalKHR)
return false;
return true;
}