From 8d4fadb3c88b571a09873bc22009a771333a70ec Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Wed, 28 Sep 2016 20:00:56 +0200 Subject: [PATCH] Revert "gsdx state: TEX0 write behavior might depends on the context" This reverts commit b34243fa7bf7e7ce9643840e5ea75b0988ee0b1b. Unfortunately we have a regression on GT4. I'm doomed --- plugins/GSdx/GSState.cpp | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/plugins/GSdx/GSState.cpp b/plugins/GSdx/GSState.cpp index c1acc211bf..3bc7c31d4a 100644 --- a/plugins/GSdx/GSState.cpp +++ b/plugins/GSdx/GSState.cpp @@ -821,8 +821,7 @@ void GSState::GIFRegHandlerXYZ2(const GIFReg* RESTRICT r) template void GSState::ApplyTEX0(GIFRegTEX0& TEX0) { - // Mask invalid bit before any comparison - TEX0.CPSM &= 0xa; // 1010b + // even if TEX0 did not change, a new palette may have been uploaded and will overwrite the currently queued for drawing // Handle invalid PSM here switch (TEX0.PSM) { @@ -848,20 +847,6 @@ template void GSState::ApplyTEX0(GIFRegTEX0& TEX0) break; } - if (PRIM->CTXT != i) { - // Context isn't current. Only update the register value. - // Handling (real write of the clut buffer) will be done when ctxt will be switched - if((TEX0.u32[0] ^ m_env.CTXT[i].TEX0.u32[0]) & 0x3ffffff) // TBP0 TBW PSM - { - m_env.CTXT[i].offset.tex = m_mem.GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM); - } - - m_env.CTXT[i].TEX0 = (GSVector4i)TEX0; - return; - } - - // even if TEX0 did not change, a new palette may have been uploaded and will overwrite the currently queued for drawing - bool wt = m_mem.m_clut.WriteTest(TEX0, m_env.TEXCLUT); // clut loading already covered with WriteTest, for drawing only have to check CPSM and CSA (MGS3 intro skybox would be drawn piece by piece without this) @@ -873,6 +858,7 @@ template void GSState::ApplyTEX0(GIFRegTEX0& TEX0) Flush(); } + TEX0.CPSM &= 0xa; // 1010b if((TEX0.u32[0] ^ m_env.CTXT[i].TEX0.u32[0]) & 0x3ffffff) // TBP0 TBW PSM { @@ -2446,21 +2432,9 @@ void GSState::SetGameCRC(uint32 crc, int options) void GSState::UpdateContext() { - bool context_switch = (m_context != &m_env.CTXT[PRIM->CTXT]); - m_context = &m_env.CTXT[PRIM->CTXT]; UpdateScissor(); - - if (context_switch) { - // Harley davidson sets TEX0 register before the context. Re-apply it now - // so clut is properly loaded - if (m_context == &m_env.CTXT[1]) { - ApplyTEX0<1>(m_env.CTXT[PRIM->CTXT].TEX0); - } else { - ApplyTEX0<0>(m_env.CTXT[PRIM->CTXT].TEX0); - } - } } void GSState::UpdateScissor()