gsdx: move the validation of the texture format before the draw call

Avoid false positive when game write dummy stuff
This commit is contained in:
Gregory Hainaut 2016-10-03 21:51:27 +02:00
parent a0629587be
commit 6fd46eb36a
1 changed files with 25 additions and 18 deletions

View File

@ -827,27 +827,10 @@ template<int i> void GSState::ApplyTEX0(GIFRegTEX0& TEX0)
// Handle invalid PSM here // Handle invalid PSM here
switch (TEX0.PSM) { switch (TEX0.PSM) {
case PSM_PSMCT32:
case PSM_PSMCT24:
case PSM_PSMCT16:
case PSM_PSMCT16S:
case PSM_PSMT8:
case PSM_PSMT4:
case PSM_PSMT8H:
case PSM_PSMT4HL:
case PSM_PSMT4HH:
case PSM_PSMZ32:
case PSM_PSMZ24:
case PSM_PSMZ16:
case PSM_PSMZ16S:
break;
case 3: case 3:
TEX0.PSM = PSM_PSMT8; // International Star Soccer (menu) TEX0.PSM = PSM_PSMT8; // International Star Soccer (menu)
break; break;
default: default:
#ifdef ENABLE_OGL_DEBUG
fprintf(stderr, "%d:INVALID PSM 0x%x !!!\n", s_n, TEX0.PSM);
#endif
break; break;
} }
@ -1540,10 +1523,34 @@ void GSState::FlushPrim()
default: default:
__assume(0); __assume(0);
} }
ASSERT((int)unused < GSUtil::GetVertexCount(PRIM->PRIM)); ASSERT((int)unused < GSUtil::GetVertexCount(PRIM->PRIM));
} }
#ifdef ENABLE_OGL_DEBUG
// Validate PSM format
switch (m_context->TEX0.PSM) {
case PSM_PSMCT32:
case PSM_PSMCT24:
case PSM_PSMCT16:
case PSM_PSMCT16S:
case PSM_PSMT8:
case PSM_PSMT4:
case PSM_PSMT8H:
case PSM_PSMT4HL:
case PSM_PSMT4HH:
case PSM_PSMZ32:
case PSM_PSMZ24:
case PSM_PSMZ16:
case PSM_PSMZ16S:
break;
default:
fprintf(stderr, "%d:INVALID PSM 0x%x !!!\n", s_n, m_context->TEX0.PSM);
ASSERT(0);
break;
}
#endif
if(GSLocalMemory::m_psm[m_context->FRAME.PSM].fmt < 3 && GSLocalMemory::m_psm[m_context->ZBUF.PSM].fmt < 3) if(GSLocalMemory::m_psm[m_context->FRAME.PSM].fmt < 3 && GSLocalMemory::m_psm[m_context->ZBUF.PSM].fmt < 3)
{ {
// FIXME: berserk fpsm = 27 (8H) // FIXME: berserk fpsm = 27 (8H)