diff --git a/vulkan/vulkan_swapchain.cpp b/vulkan/vulkan_swapchain.cpp index b9aa9008..4da40b74 100644 --- a/vulkan/vulkan_swapchain.cpp +++ b/vulkan/vulkan_swapchain.cpp @@ -205,14 +205,14 @@ bool Swapchain::begin_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) { - printf("Failed fence\n"); + printf("Timed out waiting for fence.\n"); 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 || result_value.result == vk::Result::eSuboptimalKHR) { @@ -221,6 +221,12 @@ bool Swapchain::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) { printf("Unable to acquire swapchain image: %s\n", vk::to_string(result_value.result).c_str());