summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/SwapChain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/SwapChain.cpp')
-rw-r--r--Source/Core/VideoBackends/Vulkan/SwapChain.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/SwapChain.cpp b/Source/Core/VideoBackends/Vulkan/SwapChain.cpp
index c5b3791637..abcd38c94a 100644
--- a/Source/Core/VideoBackends/Vulkan/SwapChain.cpp
+++ b/Source/Core/VideoBackends/Vulkan/SwapChain.cpp
@@ -472,14 +472,27 @@ bool SwapChain::ResizeSwapChain()
return true;
}
+bool SwapChain::RecreateSwapChain()
+{
+ DestroySwapChainImages();
+ DestroySwapChain();
+ if (!CreateSwapChain() || !SetupSwapChainImages())
+ {
+ PanicAlert("Failed to re-configure swap chain images, this is fatal (for now)");
+ return false;
+ }
+
+ return true;
+}
+
bool SwapChain::SetVSync(bool enabled)
{
if (m_vsync_enabled == enabled)
return true;
- // Resizing recreates the swap chain with the new present mode.
+ // Recreate the swap chain with the new present mode.
m_vsync_enabled = enabled;
- return ResizeSwapChain();
+ return RecreateSwapChain();
}
bool SwapChain::RecreateSurface(void* native_handle)