From de8172673e23bad1186553b91a7c22e65d93692a Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 8 Mar 2007 09:38:35 -0700 Subject: Rework matrix-related code. GLSL matrices are stored in column-major order while GL_ARB_vertex/fragment_program use row-major. So, need to use STATE_MATRIX_TRANSPOSE for built-in matrices. Unfortunately, this means that the expression M * V isn't very efficient since we need to extract the rows out of M. And that's the typical expression for vertex transformation: gl_ModelViewProjectionMatrix * gl_Position. Solve this inefficiency by looking for M*V expressions and replacing them with V*Transpose(M). Also, add support for GLSL 1.20's MatrixTranspose, Inverse and InverseTranspose matrices. --- src/mesa/shader/slang/slang_compile_operation.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/mesa/shader/slang/slang_compile_operation.c') diff --git a/src/mesa/shader/slang/slang_compile_operation.c b/src/mesa/shader/slang/slang_compile_operation.c index cf82080066..410d215a8d 100644 --- a/src/mesa/shader/slang/slang_compile_operation.c +++ b/src/mesa/shader/slang/slang_compile_operation.c @@ -212,3 +212,13 @@ slang_operation_insert(GLuint *numChildren, slang_operation **children, return NULL; } + +void +_slang_operation_swap(slang_operation *oper0, slang_operation *oper1) +{ + slang_operation tmp = *oper0; + *oper0 = *oper1; + *oper1 = tmp; +} + + -- cgit v1.2.3