From 4c0250716d5c1e9328c42552ce8bae4cf2322fff Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 4 Jul 2024 21:54:44 +1000 Subject: [PATCH] GPU/HW: Ensure buffers are freed prior to recreating --- src/core/gpu_hw.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/gpu_hw.cpp b/src/core/gpu_hw.cpp index a9b9bef32..56630fb68 100644 --- a/src/core/gpu_hw.cpp +++ b/src/core/gpu_hw.cpp @@ -472,6 +472,11 @@ void GPU_HW::UpdateSettings(const Settings& old_settings) if (framebuffer_changed) { + // When using very high upscaling, it's possible that we don't have enough VRAM for two sets of buffers. + // Purge the pool, and idle the GPU so that all video memory is freed prior to creating the new buffers. + g_gpu_device->PurgeTexturePool(); + g_gpu_device->ExecuteAndWaitForGPUIdle(); + if (!CreateBuffers()) Panic("Failed to recreate buffers.");