glthread: skip glMultMatrixf if it's identity

This is common with viewperf and it helps.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18828>
This commit is contained in:
Marek Olšák 2022-08-23 00:12:09 -04:00 committed by Marge Bot
parent 2fa864b38a
commit 01c481335a
2 changed files with 15 additions and 1 deletions

View file

@ -2932,7 +2932,8 @@
<glx rop="179"/>
</function>
<function name="MultMatrixf" es1="1.0" deprecated="3.1" exec="dlist">
<function name="MultMatrixf" es1="1.0" deprecated="3.1" exec="dlist"
marshal_call_before="if (_mesa_matrix_is_identity(m)) return;">
<param name="m" type="const GLfloat *" count="16"/>
<glx rop="180"/>
</function>

View file

@ -441,6 +441,19 @@ _mesa_get_matrix_index(struct gl_context *ctx, GLenum mode)
return M_DUMMY;
}
static inline bool
_mesa_matrix_is_identity(const float *m)
{
static float identity[16] = {
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
};
return !memcmp(m, identity, sizeof(identity));
}
static inline void
_mesa_glthread_Enable(struct gl_context *ctx, GLenum cap)
{