From: Marek Olšák Date: Tue, 23 Aug 2022 04:12:59 +0000 (-0400) Subject: mesa: use memcmp instead of floating-point comparisons in glMultMatrixf X-Git-Tag: upstream/22.3.5~2309 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0b00a158ad49b495bd5e6558e7eb0dd06b9ba7f4;p=platform%2Fupstream%2Fmesa.git mesa: use memcmp instead of floating-point comparisons in glMultMatrixf This is faster. Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index ca30ede..ac23e70 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -561,13 +561,17 @@ _mesa_MatrixLoadfEXT( GLenum matrixMode, const GLfloat *m ) static void matrix_mult(struct gl_matrix_stack *stack, const GLfloat *m, const char* caller) { + static float identity[16] = { + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }; + GET_CURRENT_CONTEXT(ctx); - 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)) + if (!m || !memcmp(m, identity, sizeof(identity))) 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",