mesa: skip glMultMatrix if the matrix is identity

This happens a lot with viewperf and it causes unnecessary constant buffer
updates.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
This commit is contained in:
Marek Olšák 2020-10-05 20:02:46 -04:00 committed by Marge Bot
parent 7b50332aef
commit b1982fd3d2

View file

@ -554,7 +554,12 @@ static void
matrix_mult(struct gl_matrix_stack *stack, const GLfloat *m, const char* caller)
{
GET_CURRENT_CONTEXT(ctx);
if (!m) return;
if (!m ||
(m[0] == 1 && m[1] == 0 && m[2] == 0 && m[3] == 0 &&
m[4] == 0 && m[5] == 1 && m[6] == 0 && m[7] == 0 &&
m[8] == 0 && m[9] == 0 && m[10] == 1 && m[11] == 0 &&
m[12] == 0 && m[13] == 0 && m[14] == 0 && m[15] == 1))
return;
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx,
"%s(%f %f %f %f, %f %f %f %f, %f %f %f %f, %f %f %f %f\n",