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 <charmainel@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Brian Paul
2016-09-14 12:16:18 -06:00
parent 533b3530c1
commit 0d2eb8c14d
+5 -3
View File
@@ -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;
}
}