From 79a48c7dbe8ecfa64561d583188fe2cbe8d46709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 2 Sep 2026 16:52:06 -0600 Subject: [PATCH] Vulkan: Fix crash when a replaced texture fails to allocate The out-of-VRAM retry path cleared plan.replaced but left plan.doReplace set. GetMipSize() dereferences plan.replaced when doReplace is true, so the fallback crashed instead of recovering. The common code sets both together. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01SGz54K3ZXa2Qzyc3aMEYyY --- GPU/Vulkan/TextureCacheVulkan.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GPU/Vulkan/TextureCacheVulkan.cpp b/GPU/Vulkan/TextureCacheVulkan.cpp index 68bc766fec..ff03cf67fd 100644 --- a/GPU/Vulkan/TextureCacheVulkan.cpp +++ b/GPU/Vulkan/TextureCacheVulkan.cpp @@ -740,8 +740,10 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) { g_OSD.Show(OSDType::MESSAGE_WARNING, err->T("Warning: Video memory FULL, switching to slow caching mode"), 2.0f); } - // Turn off texture replacement for this texture. + // Turn off texture replacement for this texture. Both of these need to be reset, GetMipSize + // dereferences plan.replaced if doReplace is still set. plan.replaced = nullptr; + plan.doReplace = false; plan.createW /= plan.scaleFactor; plan.createH /= plan.scaleFactor;