From 2eaba084c74eab2d21cb309c0ce83413c6710056 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Wed, 23 Feb 2022 21:10:06 +1000 Subject: [PATCH] GS/TextureCache: Fix target not getting invalidated in some cases This would happen when there was a source from local memory with the same pointer as the target. Fixes sky getting messed up in the Jak 3 menu when the hash cache is enabled. --- pcsx2/GS/Renderers/HW/GSTextureCache.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp index b399a98949..93a4139742 100644 --- a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp +++ b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp @@ -754,6 +754,10 @@ void GSTextureCache::InvalidateVideoMem(const GSOffset& off, const GSVector4i& r if (!s->m_target) { + found |= b; + + // No point keeping invalidated sources around when the hash cache is active, + // we can just re-hash and create a new source from the cached texture. if (s->m_from_hash_cache || (m_disable_partial_invalidation && s->m_repeating)) { m_src.RemoveAt(s); @@ -780,8 +784,6 @@ void GSTextureCache::InvalidateVideoMem(const GSOffset& off, const GSVector4i& r } s->m_complete_layers = 0; - - found |= b; } } else