diff --git a/GBI.cpp b/GBI.cpp index ac753c1f..c9998f5b 100644 --- a/GBI.cpp +++ b/GBI.cpp @@ -155,6 +155,8 @@ void GBIInfo::_makeCurrent(MicrocodeInfo * _pCurrent) RDP_Init(); + G_TRI2 = G_TRI4 = G_QUAD = G_RDPNOOP; // For correct work of gSPFlushTriangles() + switch (m_pCurrent->type) { case F3D: F3D_Init(); break; case F3DEX: F3DEX_Init(); break; diff --git a/gSP.cpp b/gSP.cpp index 2d62e4e2..1856d927 100644 --- a/gSP.cpp +++ b/gSP.cpp @@ -24,6 +24,22 @@ using namespace std; +inline void gSPFlushTriangles() +{ + if ((gSP.geometryMode & G_SHADING_SMOOTH) == 0) { + video().getRender().drawTriangles(); + return; + } + + if ( + (RSP.nextCmd != G_TRI1) && + (RSP.nextCmd != G_TRI2) && + (RSP.nextCmd != G_TRI4) && + (RSP.nextCmd != G_QUAD) + ) + video().getRender().drawTriangles(); +} + void gSPCombineMatrices() { MultMatrix(gSP.matrix.projection, gSP.matrix.modelView[gSP.matrix.modelViewi], gSP.matrix.combined); diff --git a/gSP.h b/gSP.h index c09c14d1..3c8787b5 100644 --- a/gSP.h +++ b/gSP.h @@ -15,41 +15,7 @@ #define CHANGED_CPU_FB_WRITE 0x80 #define CHANGED_TEXTURESCALE 0x100 -#if 1 // It causes geometry loss in WCW Backstage Assault. Performance drops in many games when disabled. -#define gSPFlushTriangles() \ -if \ -( \ - ( \ - (video().getRender().getTrianglesCount() > 1000) || \ - ((gSP.geometryMode & G_SHADING_SMOOTH) == 0) || \ - ( \ - (RSP.nextCmd != G_NOOP) && \ - (RSP.nextCmd != G_RDPNOOP) && \ - (RSP.nextCmd != G_MOVEMEM) && \ - (RSP.nextCmd != G_ENDDL) && \ - (RSP.nextCmd != G_DL) && \ - (RSP.nextCmd != G_VTXCOLORBASE) && \ - (RSP.nextCmd != G_TRI1) && \ - (RSP.nextCmd != G_TRI2) && \ - (RSP.nextCmd != G_TRI4) && \ - (RSP.nextCmd != G_QUAD) && \ - (RSP.nextCmd != G_VTX) && \ - (RSP.nextCmd != G_MTX) \ - ) \ - ) || \ - ( \ - (RSP.nextCmd != G_TRI1) && \ - (RSP.nextCmd != G_TRI2) && \ - (RSP.nextCmd != G_TRI4) && \ - (RSP.nextCmd != G_QUAD) \ - ) \ -) \ -{ \ - video().getRender().drawTriangles(); \ -} -#else -#define gSPFlushTriangles() video().getRender().drawTriangles(); -#endif +//void gSPFlushTriangles(); #define CLIP_X 0x03 #define CLIP_NEGX 0x01