Browse Source

Examples: Vulkan: Fix 7b968b098eeb1e162504d42183ca6618568e859c

omar 7 years ago
parent
commit
e0f283cfcb
2 changed files with 4 additions and 4 deletions
  1. 1 2
      examples/sdl_vulkan_example/main.cpp
  2. 3 2
      examples/vulkan_example/main.cpp

+ 1 - 2
examples/sdl_vulkan_example/main.cpp

@@ -528,8 +528,6 @@ static void frame_present()
     info.pImageIndices = &fd->BackbufferIndex;
     err = vkQueuePresentKHR(g_Queue, &info);
     check_vk_result(err);
-
-    g_FrameIndex = (g_FrameIndex + 1) % IMGUI_VK_QUEUED_FRAMES;
 }
 
 int main(int, char**)
@@ -699,6 +697,7 @@ int main(int, char**)
         frame_present();
 #endif
         swap_chain_has_at_least_one_image = true;
+        g_FrameIndex = (g_FrameIndex + 1) % IMGUI_VK_QUEUED_FRAMES;
     }
 
     // Cleanup

+ 3 - 2
examples/vulkan_example/main.cpp

@@ -533,8 +533,6 @@ static void frame_present()
     info.pImageIndices = &fd->BackbufferIndex;
     err = vkQueuePresentKHR(g_Queue, &info);
     check_vk_result(err);
-
-    g_FrameIndex = (g_FrameIndex + 1) % IMGUI_VK_QUEUED_FRAMES;
 }
 
 static void glfw_error_callback(int error, const char* description)
@@ -699,7 +697,10 @@ int main(int, char**)
 #else
         frame_present();
 #endif
+        swap_chain_has_at_least_one_image = true;
+        g_FrameIndex = (g_FrameIndex + 1) % IMGUI_VK_QUEUED_FRAMES;
 
+        // FIXME-PLATFORM
         ImGui::UpdatePlatformWindows();
         ImGui::RenderPlatformWindows();
     }