From 753f979a32cdbbe76dfacf95cbc3b43545a7d1ad Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 14 May 2008 16:20:28 -0600 Subject: rewrite some of the mat*mat, mat*vec intrinsics Also, remove obsolete matrix codegen code. cherry-picked from master --- src/mesa/shader/slang/slang_codegen.c | 44 ----------------------------------- 1 file changed, 44 deletions(-) (limited to 'src/mesa/shader/slang/slang_codegen.c') diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 15a0e3abcd..8ea6a8dcd9 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -2514,49 +2514,6 @@ _slang_gen_subscript(slang_assemble_ctx * A, slang_operation *oper) } -/** - * Look for expressions such as: gl_ModelviewMatrix * gl_Vertex - * and replace with this: gl_Vertex * gl_ModelviewMatrixTranpose - * Since matrices are stored in column-major order, the second form of - * multiplication is much more efficient (just 4 dot products). - */ -static void -_slang_check_matmul_optimization(slang_assemble_ctx *A, slang_operation *oper) -{ - static const struct { - const char *orig; - const char *tranpose; - } matrices[] = { - {"gl_ModelViewMatrix", "gl_ModelViewMatrixTranspose"}, - {"gl_ProjectionMatrix", "gl_ProjectionMatrixTranspose"}, - {"gl_ModelViewProjectionMatrix", "gl_ModelViewProjectionMatrixTranspose"}, - {"gl_TextureMatrix", "gl_TextureMatrixTranspose"}, - {"gl_NormalMatrix", "__NormalMatrixTranspose"}, - { NULL, NULL } - }; - - assert(oper->type == SLANG_OPER_MULTIPLY); - if (oper->children[0].type == SLANG_OPER_IDENTIFIER) { - GLuint i; - for (i = 0; matrices[i].orig; i++) { - if (oper->children[0].a_id - == slang_atom_pool_atom(A->atoms, matrices[i].orig)) { - /* - _mesa_printf("Replace %s with %s\n", - matrices[i].orig, matrices[i].tranpose); - */ - assert(oper->children[0].type == SLANG_OPER_IDENTIFIER); - oper->children[0].a_id - = slang_atom_pool_atom(A->atoms, matrices[i].tranpose); - /* finally, swap the operands */ - _slang_operation_swap(&oper->children[0], &oper->children[1]); - return; - } - } - } -} - - /** * Generate IR tree for a slang_operation (AST node) */ @@ -2690,7 +2647,6 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper) { slang_ir_node *n; assert(oper->num_children == 2); - _slang_check_matmul_optimization(A, oper); n = _slang_gen_function_call_name(A, "*", oper, NULL); return n; } -- cgit v1.2.3