From f7ddc412f911e6fd80cf04b033a111ffe2c8d866 Mon Sep 17 00:00:00 2001 From: BearOso Date: Mon, 4 Sep 2023 18:57:35 -0500 Subject: [PATCH] Vulkan: Catch out-of-date exception on swapchain acquire. --- vulkan/vulkan_swapchain.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/vulkan/vulkan_swapchain.cpp b/vulkan/vulkan_swapchain.cpp index 3bf4b04d..9d3e6abe 100644 --- a/vulkan/vulkan_swapchain.cpp +++ b/vulkan/vulkan_swapchain.cpp @@ -267,7 +267,16 @@ bool Swapchain::begin_frame() return false; } - auto result_value = device.acquireNextImageKHR(swapchain_object.get(), 33333333, frame.acquire.get()); + vk::ResultValue result_value(vk::Result::eSuccess, 0); + try + { + result_value = device.acquireNextImageKHR(swapchain_object.get(), 33333333, frame.acquire.get()); + } + catch (vk::OutOfDateKHRError) + { + result_value.result = vk::Result::eErrorOutOfDateKHR; + } + if (result_value.result == vk::Result::eErrorOutOfDateKHR || result_value.result == vk::Result::eSuboptimalKHR) {