From e212511047a145225c8225d148331c260bedd80e Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 29 Jul 2024 15:48:54 +0200 Subject: [PATCH] Backends: Vulkan: ImGui_ImplVulkan_SwapBuffers() still proceeds increasing counts on VK_SUBOPTIMAL_KHR. (#7825, #3881) Amend 085cff2f --- backends/imgui_impl_vulkan.cpp | 8 ++++++-- docs/CHANGELOG.txt | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/backends/imgui_impl_vulkan.cpp b/backends/imgui_impl_vulkan.cpp index 036307a85..cb54fa17a 100644 --- a/backends/imgui_impl_vulkan.cpp +++ b/backends/imgui_impl_vulkan.cpp @@ -1895,9 +1895,13 @@ static void ImGui_ImplVulkan_SwapBuffers(ImGuiViewport* viewport, void*) if (err == VK_ERROR_OUT_OF_DATE_KHR || err == VK_SUBOPTIMAL_KHR) { vd->SwapChainNeedRebuild = true; - return; + if (err == VK_ERROR_OUT_OF_DATE_KHR) + return; + } + else + { + check_vk_result(err); } - check_vk_result(err); wd->FrameIndex = (wd->FrameIndex + 1) % wd->ImageCount; // This is for the next vkWaitForFences() wd->SemaphoreIndex = (wd->SemaphoreIndex + 1) % wd->SemaphoreCount; // Now we can use the next set of semaphores diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index c20489eaf..ef5f020d5 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -182,6 +182,8 @@ Docking+Viewports Branch: usage. (#7814) [@YGXXD] - Backends: SDL3: Fixed a bug preventing ImGuiViewportFlags_NoFocusOnAppearing support from working (Windows only). +- Backends: Vulkan: ImGui_ImplVulkan_SwapBuffers() used by secondary viewports still proceeds + increasing frame counters on VK_SUBOPTIMAL_KHR. (#7825, #3881) [@NostraMagister] -----------------------------------------------------------------------