@@ -643,7 +643,7 @@ VulkanRenderer* VulkanRenderer::GetInstance()
643
643
return (VulkanRenderer*)g_renderer.get ();
644
644
}
645
645
646
- void VulkanRenderer::Initialize (const Vector2i& size, bool mainWindow)
646
+ void VulkanRenderer::InitializeSurface (const Vector2i& size, bool mainWindow)
647
647
{
648
648
auto & windowHandleInfo = mainWindow ? gui_getWindowInfo ().canvas_main : gui_getWindowInfo ().canvas_pad ;
649
649
@@ -2564,20 +2564,20 @@ void VulkanRenderer::RecreateSwapchain(bool mainWindow, bool skipCreate)
2564
2564
if (mainWindow)
2565
2565
{
2566
2566
ImGui_ImplVulkan_Shutdown ();
2567
- gui_getWindowSize (& size.x , & size.y );
2567
+ gui_getWindowPhysSize ( size.x , size.y );
2568
2568
}
2569
2569
else
2570
2570
{
2571
- gui_getPadWindowSize (& size.x , & size.y );
2571
+ gui_getPadWindowPhysSize ( size.x , size.y );
2572
2572
}
2573
2573
2574
+ chainInfo.swapchainImageIndex = -1 ;
2574
2575
chainInfo.Cleanup ();
2575
2576
chainInfo.m_desiredExtent = size;
2576
2577
if (!skipCreate)
2577
2578
{
2578
2579
chainInfo.Create (m_physicalDevice, m_logicalDevice);
2579
2580
}
2580
- chainInfo.swapchainImageIndex = -1 ;
2581
2581
2582
2582
if (mainWindow)
2583
2583
ImguiInit ();
@@ -2644,13 +2644,12 @@ void VulkanRenderer::SwapBuffer(bool mainWindow)
2644
2644
presentInfo.pWaitSemaphores = &presentSemaphore;
2645
2645
2646
2646
VkResult result = vkQueuePresentKHR (m_presentQueue, &presentInfo);
2647
- if (result != VK_SUCCESS )
2647
+ if (result < 0 && result != VK_ERROR_OUT_OF_DATE_KHR )
2648
2648
{
2649
- if (result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR)
2650
- chainInfo.m_shouldRecreate = true ;
2651
- else
2652
- throw std::runtime_error (fmt::format (" Failed to present image: {}" , result));
2649
+ throw std::runtime_error (fmt::format (" Failed to present image: {}" , result));
2653
2650
}
2651
+ if (result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR)
2652
+ chainInfo.m_shouldRecreate = true ;
2654
2653
2655
2654
chainInfo.hasDefinedSwapchainImage = false ;
2656
2655
0 commit comments