Currenty the RenderShaderPasses and FillDepthBuffer function are enabling vertex array attrib 1 and 5 for every drawn surface. Due to the fact that each of these surfaces need at least attrib 1 and 5 it makes sense to enable them once, draw all the surfs and disabling them afterwards.
Please have a look at following patch, it will drop a lot of redundant state changes and gain some performance:
Currenty the RenderShaderPasses and FillDepthBuffer function are enabling vertex array attrib 1 and 5 for every drawn surface. Due to the fact that each of these surfaces need at least attrib 1 and 5 it makes sense to enable them once, draw all the surfs and disabling them afterwards. Please have a look at following patch, it will drop a lot of redundant state changes and gain some performance:
diff --git a/neo/renderer/draw_common.cpp b/neo/renderer/draw_common.cpp index 40aba8c..33b25ca 100644 --- a/neo/renderer/draw_common.cpp +++ b/neo/renderer/draw_common.cpp @@ -409,9 +409,7 @@ void RB_T_FillDepthBuffer(const drawSurf_t *surf) }
@@ -492,9 +490,6 @@ void RB_T_FillDepthBuffer(const drawSurf_t *surf) if (shader->GetSort() == SS_SUBVIEW) { GL_State(GLS_DEPTHFUNC_LESS);
}
}
/* @@ -530,7 +525,8 @@ void RB_STD_FillDepthBuffer(drawSurf_t **drawSurfs, int numDrawSurfs)
@@ -555,6 +551,7 @@ void RB_STD_FillDepthBuffer(drawSurf_t **drawSurfs, int numDrawSurfs)
endif
} @@ -738,8 +735,6 @@ void RB_STD_T_RenderShaderPasses(const drawSurf_t *surf) }
@@ -916,9 +911,6 @@ void RB_STD_T_RenderShaderPasses(const drawSurf_t *surf) } }
- GL_DisableVertexAttribArray(offsetof(shaderProgram_t, attr_TexCoord));
@@ -970,6 +962,7 @@ int RB_STD_DrawShaderPasses(drawSurf_t **drawSurfs, int numDrawSurfs) globalImages->BindNull();
@@ -1005,6 +998,7 @@ int RB_STD_DrawShaderPasses(drawSurf_t **drawSurfs, int numDrawSurfs)
endif