GS: Invalidate CLUT by page

Some games (We Love Katamari) write offset inside the CLUT, and one block is only 32 colours (in 32bit) anyway, so by block is insufficient.

Also add check for CLUT invalidation from Z writes, because it *could* happen, weirder things have been done in games.
This commit is contained in:
refractionpcsx2 2022-07-10 06:24:49 +01:00
parent 6511d4c21c
commit 156484ac80
2 changed files with 8 additions and 2 deletions

View File

@ -108,9 +108,11 @@ void GSClut::Invalidate()
m_write.dirty = true;
}
// This checks the whole page! Some games (like We Love Katamari) have the CLUT 1 block ahead of the DBP during a transfer.
// Safer to check if the whole page is being written anyway since it could modify only part of the CLUT.
void GSClut::Invalidate(u32 block)
{
if (block == m_write.TEX0.CBP)
if (!((block ^ m_write.TEX0.CBP) & ~0x1F))
{
m_write.dirty = true;
}

View File

@ -710,8 +710,12 @@ __inline void GSState::CheckFlushes()
Flush();
}
}
if (m_index.tail > 0 && (m_context->FRAME.FBMSK & GSLocalMemory::m_psm[m_context->FRAME.PSM].fmsk) != GSLocalMemory::m_psm[m_context->FRAME.PSM].fmsk)
if ((m_context->FRAME.FBMSK & GSLocalMemory::m_psm[m_context->FRAME.PSM].fmsk) != GSLocalMemory::m_psm[m_context->FRAME.PSM].fmsk)
m_mem.m_clut.Invalidate(m_context->FRAME.Block());
// Hey, why not check? I mean devs have done crazier things..
if(!m_context->ZBUF.ZMSK)
m_mem.m_clut.Invalidate(m_context->ZBUF.Block());
}
void GSState::GIFPackedRegHandlerNull(const GIFPackedReg* RESTRICT r)