From 3d74542d24eb9c559bbeb633781ad43fb0eb1f37 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Wed, 3 Apr 2019 12:24:33 +0700 Subject: [PATCH] Correct geometry mode update for Turbo3D. Fixed glitches in Dark Rift, #2033 --- src/RSP.cpp | 5 +++-- src/gDP.cpp | 3 --- src/uCodes/Turbo3D.cpp | 7 ++----- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/RSP.cpp b/src/RSP.cpp index b5336e232..0ffca3fdb 100644 --- a/src/RSP.cpp +++ b/src/RSP.cpp @@ -136,7 +136,8 @@ void RSP_ProcessDList() gSP.matrix.stackSize = 32; gSP.matrix.modelViewi = 0; gSP.status[0] = gSP.status[1] = gSP.status[2] = gSP.status[3] = 0; - gSP.changed |= CHANGED_MATRIX | CHANGED_LIGHT | CHANGED_LOOKAT; + gSP.geometryMode = 0U; + gSP.changed |= CHANGED_MATRIX | CHANGED_LIGHT | CHANGED_LOOKAT | CHANGED_GEOMETRYMODE; gSP.tri_num = 0; gSP.cbfd.advancedLighting = false; gDP.changed &= ~CHANGED_CPU_FB_WRITE; @@ -180,7 +181,7 @@ void RSP_ProcessDList() break; } - if(RSP.infloop && REG.SP_STATUS) { + if (RSP.infloop && REG.SP_STATUS) { *REG.SP_STATUS &= ~(SP_STATUS_TASKDONE | SP_STATUS_HALT | SP_STATUS_BROKE); return; } diff --git a/src/gDP.cpp b/src/gDP.cpp index 8153e83d0..0aeaa2fc8 100644 --- a/src/gDP.cpp +++ b/src/gDP.cpp @@ -903,9 +903,6 @@ void gDPFullSync() FrameBuffer_CopyDepthBuffer(gDP.colorImage.address); } - gSP.geometryMode = 0U; - gSP.changed |= CHANGED_GEOMETRYMODE; - *REG.MI_INTR |= MI_INTR_DP; CheckInterrupts(); diff --git a/src/uCodes/Turbo3D.cpp b/src/uCodes/Turbo3D.cpp index 74fe33be7..2b3363735 100644 --- a/src/uCodes/Turbo3D.cpp +++ b/src/uCodes/Turbo3D.cpp @@ -134,14 +134,11 @@ void Turbo3D_LoadObject(u32 pstate, u32 pvtx, u32 ptri) gDPSetOtherMode( _SHIFTR( w0, 0, 24 ), // mode0 w1 ); // mode1 - gSPSetGeometryMode(ostate->renderState); - if (ostate->flag != GT_FLAG_NOMTX) gSPForceMatrix(pstate + sizeof(T3DState)); - gSPClearGeometryMode(G_LIGHTING); - gSPClearGeometryMode(G_FOG); - gSPSetGeometryMode(G_SHADING_SMOOTH); + gSPClearGeometryMode(G_LIGHTING | G_FOG); + gSPSetGeometryMode(ostate->renderState | G_SHADING_SMOOTH | G_SHADE | G_ZBUFFER | G_CULL_BACK); if (pvtx != 0) gSPVertex(pvtx, ostate->vtxCount, ostate->vtxV0);