rice: avoid redundant gl calls
[mupen64plus-pandora.git] / source / gles2rice / src / OGLRender.cpp
index 5f25f16..c63a86e 100755 (executable)
@@ -198,7 +198,13 @@ void OGLRender::Initialize(void)
         glVertexAttribPointer(VS_TEXCOORD0,2,GL_FLOAT,GL_FALSE, sizeof( TLITVERTEX ), &(g_vtxBuffer[0].tcord[0].u));
         OPENGL_CHECK_ERRORS;
     }
-
+       
+       if (m_bSupportFogCoordExt)
+       {
+           glVertexAttribPointer(VS_FOG,1,GL_FLOAT,GL_FALSE,sizeof(float)*5,&(g_vtxProjected5[0][4]));
+           OPENGL_CHECK_ERRORS;
+       }
+       
     glVertexAttribPointer(VS_COLOR, 4, GL_UNSIGNED_BYTE,GL_TRUE, sizeof(uint8)*4, &(g_oglVtxColors[0][0]) );
     OPENGL_CHECK_ERRORS;
 #endif
@@ -344,9 +350,14 @@ void OGLRender::SetZUpdate(BOOL bZUpdate)
 
 void OGLRender::ApplyZBias(int bias)
 {
+    static int old_bias;
     float f1 = bias > 0 ? -3.0f : 0.0f;  // z offset = -3.0 * max(abs(dz/dx),abs(dz/dy)) per pixel delta z slope
     float f2 = bias > 0 ? -3.0f : 0.0f;  // z offset += -3.0 * 1 bit
 
+    if (bias == old_bias)
+        return;
+    old_bias = bias;
+
 #ifdef PAULSCODE
 //    Android_JNI_GetPolygonOffset(hardwareType, bias, &f1, &f2);
 //     glPolygonOffset(0.2f, 0.2f);
@@ -980,6 +991,7 @@ void OGLRender::DrawSimpleRect(int nX0, int nY0, int nX1, int nY1, uint32 dwColo
     OPENGL_CHECK_ERRORS;
 }
 
+#if 0
 void OGLRender::InitCombinerBlenderForSimpleRectDraw(uint32 tile)
 {
     //glEnable(GL_CULL_FACE);
@@ -991,6 +1003,7 @@ void OGLRender::InitCombinerBlenderForSimpleRectDraw(uint32 tile)
     OPENGL_CHECK_ERRORS;
     //glEnable(GL_ALPHA_TEST);
 }
+#endif
 
 COLOR OGLRender::PostProcessDiffuseColor(COLOR curDiffuseColor)
 {