From 2a2d39b39240bcbda90d1b9e5ece100bef5869c8 Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Tue, 28 Feb 2023 01:15:26 +0000 Subject: [PATCH] GS-TC: On invalidate of the alpha of 32bit, drop back to 24bit --- pcsx2/GS/Renderers/HW/GSTextureCache.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp index 95de4c7e1d..2668da7e87 100644 --- a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp +++ b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp @@ -1375,11 +1375,22 @@ void GSTextureCache::InvalidateVideoMem(const GSOffset& off, const GSVector4i& r if (can_erase) { - i = list.erase(j); - GL_CACHE("TC: Remove Target(%s) %d (0x%x)", to_string(type), - t->m_texture ? t->m_texture->GetID() : 0, - t->m_TEX0.TBP0); - delete t; + // If it's a 32bit value and only the alpha channel is being killed + // instead of losing the RGB data, drop it back to 24bit. + if (rgba._u32 == 0x8 && t->m_TEX0.PSM == PSM_PSMCT32) + { + t->m_TEX0.PSM = PSM_PSMCT24; + t->m_dirty_alpha = false; + ++i; + } + else + { + i = list.erase(j); + GL_CACHE("TC: Remove Target(%s) %d (0x%x)", to_string(type), + t->m_texture ? t->m_texture->GetID() : 0, + t->m_TEX0.TBP0); + delete t; + } } else {