diff --git a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp index e7f7045ba3..04461790aa 100644 --- a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp +++ b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp @@ -207,6 +207,7 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con auto& m = m_src.m_map[TEX0.TBP0 >> 5]; + const GSVector2i compare_lod(lod ? *lod : GSVector2i(0, 0)); for (auto i = m.begin(); i != m.end(); ++i) { Source* s = *i; @@ -227,6 +228,11 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con // the CPU. We need to check that TEXA is identical if (psm_s.pal == 0 && psm_s.fmt > 0 && s->m_TEXA.U64 != TEXA.U64) continue; + + // Same base mip texture, but we need to check that MXL was the same as well. + // When mipmapping is off, this will be 0,0 vs 0,0. + if (s->m_lod != compare_lod) + continue; } m.MoveFront(i.Index()); @@ -1556,6 +1562,8 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con { const GSLocalMemory::psm_t& psm = GSLocalMemory::m_psm[TEX0.PSM]; Source* src = new Source(TEX0, TEXA, false); + if (lod) + src->m_lod = *lod; int tw = 1 << TEX0.TW; int th = 1 << TEX0.TH; @@ -2276,6 +2284,7 @@ GSTextureCache::Source::Source(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, b : m_palette_obj(nullptr) , m_palette(nullptr) , m_valid_rect(0, 0) + , m_lod(0, 0) , m_target(false) , m_p2t(NULL) , m_from_target(NULL) diff --git a/pcsx2/GS/Renderers/HW/GSTextureCache.h b/pcsx2/GS/Renderers/HW/GSTextureCache.h index e15efdef51..8345495f2a 100644 --- a/pcsx2/GS/Renderers/HW/GSTextureCache.h +++ b/pcsx2/GS/Renderers/HW/GSTextureCache.h @@ -159,6 +159,7 @@ public: std::unique_ptr m_valid;// each u32 bits map to the 32 blocks of that page GSTexture* m_palette; GSVector4i m_valid_rect; + GSVector2i m_lod; u8 m_valid_hashes = 0; u8 m_complete_layers = 0; bool m_target;