Mesa (master): asm: Fix x86 assembly for inverse matrix operations

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Dec 3 21:18:58 UTC 2020


Module: Mesa
Branch: master
Commit: 70762b826b6d2781de9e06f1dad5d5e741876704
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=70762b826b6d2781de9e06f1dad5d5e741876704

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Dec  2 14:38:07 2020 -0800

asm: Fix x86 assembly for inverse matrix operations

In commit 3175b63a0dfa290430f9f7eb651387788933a02b, Marek stopped
allocating the GLmatrix::inv field with malloc, instead embedding
it directly in the structure.  So, we need to drop a level of
indirection here and use (matrix pointer + MATRIX_INV) as the
inverse matrix array directly, rather than reading a pointer at
that offset and chasing it.

Fixes: 3175b63a0df ("mesa: don't allocate matrices with malloc")
Reviewed-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7889>

---

 src/mesa/x86/sse_normal.S | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/x86/sse_normal.S b/src/mesa/x86/sse_normal.S
index b04a77a7b2d..4a6573c6b7d 100644
--- a/src/mesa/x86/sse_normal.S
+++ b/src/mesa/x86/sse_normal.S
@@ -57,7 +57,7 @@ GLNAME(_mesa_sse_transform_rescale_normals_no_rot):
 	MOV_L	( ARG_DEST, EDI )			/* ptr to dest GLvector3f */
 
 	MOV_L	( ARG_MAT, EDX )			/* ptr to matrix */
-	MOV_L	( REGOFF(MATRIX_INV, EDX), EDX)		/* matrix->inv */
+	ADD_L	( CONST(MATRIX_INV), EDX )		/* matrix->inv */
 
 	MOV_L	( REGOFF(V4F_COUNT, ESI), ECX ) 	/* source count */
 
@@ -119,7 +119,7 @@ GLNAME(_mesa_sse_transform_rescale_normals):
 	MOV_L	( ARG_DEST, EDI )			/* ptr to dest GLvector3f */
 
 	MOV_L	( ARG_MAT, EDX )			/* ptr to matrix */
-	MOV_L	( REGOFF(MATRIX_INV, EDX), EDX)		/* matrix->inv */
+	ADD_L	( CONST(MATRIX_INV), EDX )		/* matrix->inv */
 
 	MOV_L	( REGOFF(V4F_COUNT, ESI), ECX ) 	/* source count */
 
@@ -212,7 +212,7 @@ GLNAME(_mesa_sse_transform_normals_no_rot):
 	MOV_L	( ARG_DEST, EDI )			/* ptr to dest GLvector3f */
 
 	MOV_L	( ARG_MAT, EDX )			/* ptr to matrix */
-	MOV_L	( REGOFF(MATRIX_INV, EDX), EDX)		/* matrix->inv */
+	ADD_L	( CONST(MATRIX_INV), EDX )		/* matrix->inv */
 
 	MOV_L	( REGOFF(V4F_COUNT, ESI), ECX ) 	/* source count */
 



More information about the mesa-commit mailing list