Module: Mesa
Branch: main
Commit: 5fb106c253e0db7c8f2c3a34a6de0787271d9170
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5fb106c253e0db7c8f2c3a34a6de0787271d9170

Author: Marek Olšák <[email protected]>
Date:   Sun Nov 26 22:24:23 2023 -0500

mesa: skip checking for identity matrix in glMultMatrixf with glthread

glMultMatrixf was doing it. glMatrixMultfEXT is the other user of
matrix_mult that needs to do it before we can skip it here.

Reviewed-by: Timothy Arceri <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26548>

---

 src/mapi/glapi/gen/EXT_direct_state_access.xml | 3 ++-
 src/mesa/main/matrix.c                         | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml 
b/src/mapi/glapi/gen/EXT_direct_state_access.xml
index 620a09b9613..e152f0139eb 100644
--- a/src/mapi/glapi/gen/EXT_direct_state_access.xml
+++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml
@@ -26,7 +26,8 @@
       <param name="matrixMode" type="GLenum" />
       <param name="m" type="const GLdouble *" count="16"/>
    </function>
-   <function name="MatrixMultfEXT" offset="assign" exec="dlist">
+   <function name="MatrixMultfEXT" offset="assign" exec="dlist"
+             marshal_call_before="if (_mesa_matrix_is_identity(m)) return;">
       <param name="matrixMode" type="GLenum" />
       <param name="m" type="const GLfloat *" count="16"/>
    </function>
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
index ec0df4dd9cf..aefd7658ba5 100644
--- a/src/mesa/main/matrix.c
+++ b/src/mesa/main/matrix.c
@@ -569,7 +569,9 @@ static void
 matrix_mult(struct gl_matrix_stack *stack, const GLfloat *m, const char* 
caller)
 {
    GET_CURRENT_CONTEXT(ctx);
-   if (!m || _mesa_matrix_is_identity(m))
+
+   /* glthread filters out identity matrices, so don't do it again. */
+   if (!m || (!ctx->GLThread.enabled && _mesa_matrix_is_identity(m)))
       return;
 
    if (MESA_VERBOSE & VERBOSE_API)

Reply via email to