Vulkan: Smoothly recreate the swapchain using oldSwapchain on "resize" on Windows

This commit is contained in:
Henrik Rydgård committed 2025-10-20 15:42:34 +02:00
1 parent 84aeec7148
commit 6338832015
5 files changed
+27 -6

No files matched your search

+5 -2
View File
@@ -120,13 +120,16 @@ void AndroidVulkanContext::Shutdown() {
void AndroidVulkanContext::Resize() {
INFO_LOG(Log::G3D, "AndroidVulkanContext::Resize begin (oldsize: %dx%d)", g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight());
VulkanContext::CreateInfo info{};
InitVulkanCreateInfoFromConfig(&info);
draw_->HandleEvent(Draw::Event::LOST_BACKBUFFER, g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight());
g_Vulkan->DestroySwapchain();
// TODO: We should only destroy the surface here if the window changed. We can track this inside g_Vulkan.
g_Vulkan->DestroySurface();
VulkanContext::CreateInfo info{};
InitVulkanCreateInfoFromConfig(&info);
g_Vulkan->UpdateCreateInfo(info);
g_Vulkan->ReinitSurface();