mirror of https://github.com/PCSX2/pcsx2.git
GS: Properly check load condition when reloading CLUT
This commit is contained in:
parent
f350f9905a
commit
bb9e1c5dbc
|
@ -168,10 +168,8 @@ bool GSClut::InvalidateRange(u32 start_block, u32 end_block, bool is_draw)
|
|||
return m_write.dirty;
|
||||
}
|
||||
|
||||
bool GSClut::WriteTest(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT)
|
||||
bool GSClut::CanLoadCLUT(const GIFRegTEX0& TEX0, const bool update_CBP)
|
||||
{
|
||||
// Check if PSM is an indexed format BEFORE the load condition, updating CBP0/1 on an invalid format is not allowed
|
||||
// and can break games. Corvette (NTSC) is a good example of this.
|
||||
if ((TEX0.PSM & 0x7) < 3)
|
||||
return false;
|
||||
|
||||
|
@ -182,20 +180,24 @@ bool GSClut::WriteTest(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT)
|
|||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
m_CBP[0] = TEX0.CBP;
|
||||
if (update_CBP)
|
||||
m_CBP[0] = TEX0.CBP;
|
||||
break;
|
||||
case 3:
|
||||
m_CBP[1] = TEX0.CBP;
|
||||
if (update_CBP)
|
||||
m_CBP[1] = TEX0.CBP;
|
||||
break;
|
||||
case 4:
|
||||
if (m_CBP[0] == TEX0.CBP)
|
||||
return false;
|
||||
m_CBP[0] = TEX0.CBP;
|
||||
if(update_CBP)
|
||||
m_CBP[0] = TEX0.CBP;
|
||||
break;
|
||||
case 5:
|
||||
if (m_CBP[1] == TEX0.CBP)
|
||||
return false;
|
||||
m_CBP[1] = TEX0.CBP;
|
||||
if (update_CBP)
|
||||
m_CBP[1] = TEX0.CBP;
|
||||
break;
|
||||
case 6:
|
||||
return false; // ffx2 menu.
|
||||
|
@ -205,6 +207,19 @@ bool GSClut::WriteTest(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT)
|
|||
__assume(0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GSClut::WriteTest(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT)
|
||||
{
|
||||
// Check if PSM is an indexed format BEFORE the load condition, updating CBP0/1 on an invalid format is not allowed
|
||||
// and can break games. Corvette (NTSC) is a good example of this.
|
||||
if ((TEX0.PSM & 0x7) < 3)
|
||||
return false;
|
||||
|
||||
if (!CanLoadCLUT(TEX0, true))
|
||||
return false;
|
||||
|
||||
// CLUT only reloads if PSM is a valid index type, avoid unnecessary flushes.
|
||||
return m_write.IsDirty(TEX0, TEXCLUT);
|
||||
}
|
||||
|
|
|
@ -114,6 +114,7 @@ public:
|
|||
u32 GetCLUTCBP();
|
||||
u32 GetCLUTCPSM();
|
||||
void SetNextCLUTTEX0(u64 CBP);
|
||||
bool CanLoadCLUT(const GIFRegTEX0& TEX0, const bool update_CBP = false);
|
||||
bool WriteTest(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT);
|
||||
void Write(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT);
|
||||
//void Read(const GIFRegTEX0& TEX0);
|
||||
|
|
|
@ -830,7 +830,7 @@ void GSState::ApplyTEX0(GIFRegTEX0& TEX0)
|
|||
|
||||
GL_REG("Apply TEX0_%d = 0x%x_%x", i, TEX0.U32[1], TEX0.U32[0]);
|
||||
|
||||
if ((TEX0.PSM & 0x7) >= 3 && TEX0.CLD)
|
||||
if ((TEX0.PSM & 0x7) >= 3 && m_mem.m_clut.CanLoadCLUT(TEX0))
|
||||
{
|
||||
m_mem.m_clut.ClearDrawInvalidity();
|
||||
m_mem.m_clut.SetNextCLUTTEX0(TEX0.U64);
|
||||
|
|
Loading…
Reference in New Issue