From daee802bde29ff6c62940ae02dad260eb2c84a11 Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Fri, 10 Jul 2026 23:57:38 +0100 Subject: [PATCH] GS/TC: Don't clear valid flags if render target is only partially cleared --- pcsx2/GS/Renderers/HW/GSTextureCache.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp index 9d7fd37724..5615b94071 100644 --- a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp +++ b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp @@ -4543,10 +4543,13 @@ void GSTextureCache::InvalidateContainedTargets(u32 start_bp, u32 end_bp, u32 wr InvalidateSourcesFromTarget(t); - t->m_valid_alpha_low &= preserve_alpha; - t->m_valid_alpha_high &= preserve_alpha; - t->m_valid_rgb &= (fb_mask & 0x00FFFFFF) != 0; - t->m_was_dst_matched = false; + if (type == DepthStencil || start_bp == t->m_TEX0.TBP0 || (start_bp < t->m_TEX0.TBP0 && t->UnwrappedEndBlock() <= end_bp)) + { + t->m_valid_alpha_low &= preserve_alpha; + t->m_valid_alpha_high &= preserve_alpha; + t->m_valid_rgb &= (fb_mask & 0x00FFFFFF) != 0; + t->m_was_dst_matched = false; + } // Don't keep partial depth buffers around. if ((!t->m_valid_alpha_low && !t->m_valid_alpha_high && !t->m_valid_rgb) || type == DepthStencil)