summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2016-09-14 12:16:18 -0600
committerBrian Paul <[email protected]>2016-09-15 12:00:12 -0600
commit0d2eb8c14d8c791603cb60cb56ed468ee49543ad (patch)
treeb8c63b96bba7e7d8e048bdd1f35c5f523735802c /src/mesa
parent533b3530c1292a39ea12437d1376c77bc7e584b9 (diff)
mesa: check for no matrix change in _mesa_LoadMatrixf()
Some apps issue redundant glLoadMatrixf() calls with the same matrix. Try to avoid setting dirty state in that situation. This reduces the number of constant buffer updates by about half in ET Quake Wars. Tested with Piglit, ETQW, Sauerbraten, Google Earth, etc. Reviewed-by: Charmaine Lee <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/matrix.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
index b30b983f14f..83f081e88e5 100644
--- a/src/mesa/main/matrix.c
+++ b/src/mesa/main/matrix.c
@@ -356,9 +356,11 @@ _mesa_LoadMatrixf( const GLfloat *m )
m[2], m[6], m[10], m[14],
m[3], m[7], m[11], m[15]);
- FLUSH_VERTICES(ctx, 0);
- _math_matrix_loadf( ctx->CurrentStack->Top, m );
- ctx->NewState |= ctx->CurrentStack->DirtyFlag;
+ if (memcmp(m, ctx->CurrentStack->Top->m, 16 * sizeof(GLfloat)) != 0) {
+ FLUSH_VERTICES(ctx, 0);
+ _math_matrix_loadf( ctx->CurrentStack->Top, m );
+ ctx->NewState |= ctx->CurrentStack->DirtyFlag;
+ }
}