Vulkan: Change timeouts to be more reasonable.

Report when timeout fails.
This commit is contained in:
BearOso 2023-06-27 15:39:30 -05:00
parent c13e4d8330
commit 7b6ba01760
1 changed files with 9 additions and 3 deletions

View File

@ -205,14 +205,14 @@ bool Swapchain::begin_frame()
auto &frame = frames[current_frame]; auto &frame = frames[current_frame];
auto result = device.waitForFences(frame.fence.get(), true, UINT64_MAX); auto result = device.waitForFences(frame.fence.get(), true, 33333333);
if (result != vk::Result::eSuccess) if (result != vk::Result::eSuccess)
{ {
printf("Failed fence\n"); printf("Timed out waiting for fence.\n");
return false; return false;
} }
auto result_value = device.acquireNextImageKHR(swapchain_object.get(), UINT64_MAX, frame.acquire.get()); auto result_value = device.acquireNextImageKHR(swapchain_object.get(), 33333333, frame.acquire.get());
if (result_value.result == vk::Result::eErrorOutOfDateKHR || if (result_value.result == vk::Result::eErrorOutOfDateKHR ||
result_value.result == vk::Result::eSuboptimalKHR) result_value.result == vk::Result::eSuboptimalKHR)
{ {
@ -221,6 +221,12 @@ bool Swapchain::begin_frame()
return begin_frame(); return begin_frame();
} }
if (result_value.result == vk::Result::eTimeout)
{
printf("Timed out waiting for swapchain.\n");
return false;
}
if (result_value.result != vk::Result::eSuccess) if (result_value.result != vk::Result::eSuccess)
{ {
printf("Unable to acquire swapchain image: %s\n", vk::to_string(result_value.result).c_str()); printf("Unable to acquire swapchain image: %s\n", vk::to_string(result_value.result).c_str());