From 01c481335ad84f8bec29985e982ec0f20aadf522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 23 Aug 2022 00:12:09 -0400 Subject: [PATCH] glthread: skip glMultMatrixf if it's identity This is common with viewperf and it helps. Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/mapi/glapi/gen/gl_API.xml | 3 ++- src/mesa/main/glthread_marshal.h | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index fc69c152c0b..0d2c9aaf690 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -2932,7 +2932,8 @@ - + diff --git a/src/mesa/main/glthread_marshal.h b/src/mesa/main/glthread_marshal.h index f390cb9453c..05dbb106364 100644 --- a/src/mesa/main/glthread_marshal.h +++ b/src/mesa/main/glthread_marshal.h @@ -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) {