From 7b6ba017608f892050519242dd7e2692378dcbd8 Mon Sep 17 00:00:00 2001 From: BearOso Date: Tue, 27 Jun 2023 15:39:30 -0500 Subject: [PATCH] Vulkan: Change timeouts to be more reasonable. Report when timeout fails. --- vulkan/vulkan_swapchain.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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());