Browse Source

Backends: Vulkan: vkQueuePresentKHR() returning VK_SUBOPTIMAL_KHR keeps moving forward. (#7825)

ocornut 6 months ago
parent
commit
507cdba44e
1 changed files with 3 additions and 7 deletions
  1. 3 7
      backends/imgui_impl_vulkan.cpp

+ 3 - 7
backends/imgui_impl_vulkan.cpp

@@ -1968,15 +1968,11 @@ static void ImGui_ImplVulkan_SwapBuffers(ImGuiViewport* viewport, void*)
     info.pImageIndices = &present_index;
     info.pImageIndices = &present_index;
     err = vkQueuePresentKHR(v->Queue, &info);
     err = vkQueuePresentKHR(v->Queue, &info);
     if (err == VK_ERROR_OUT_OF_DATE_KHR || err == VK_SUBOPTIMAL_KHR)
     if (err == VK_ERROR_OUT_OF_DATE_KHR || err == VK_SUBOPTIMAL_KHR)
-    {
         vd->SwapChainNeedRebuild = true;
         vd->SwapChainNeedRebuild = true;
-        if (err == VK_ERROR_OUT_OF_DATE_KHR)
-            return;
-    }
-    else
-    {
+    if (err == VK_ERROR_OUT_OF_DATE_KHR)
+        return;
+    if (err != VK_SUBOPTIMAL_KHR)
         check_vk_result(err);
         check_vk_result(err);
-    }
     wd->SemaphoreIndex = (wd->SemaphoreIndex + 1) % wd->SemaphoreCount; // Now we can use the next set of semaphores
     wd->SemaphoreIndex = (wd->SemaphoreIndex + 1) % wd->SemaphoreCount; // Now we can use the next set of semaphores
 }
 }