forked from mirrors/0ad
Adds an option to destroy Vulkan old swapchain before
Now it's possible to destroy the old swapchain before creating a new one. It might make the swapchain creation a bit slower but with a lower memory peak.
This commit is contained in:
@@ -1039,6 +1039,13 @@ void CDevice::RecreateSwapChain()
|
||||
{
|
||||
vkDeviceWaitIdle(m_Device);
|
||||
|
||||
// It seems some drivers might not reuse the same swapchain memory. So
|
||||
// to avoid higher memory peaks destroy the old swapchain before.
|
||||
const bool destroyOldSwapchainBefore{
|
||||
g_ConfigDB.Get("renderer.backend.vulkan.destroyoldswapchainbefore", false)};
|
||||
if (destroyOldSwapchainBefore)
|
||||
m_SwapChain.reset();
|
||||
|
||||
m_BackbufferReadbackTexture.reset();
|
||||
|
||||
// Since we know there is no GPU work in progress we can free resources
|
||||
|
||||
Reference in New Issue
Block a user