From 36e906aad6d0520db00cc5112fd015497465bc87 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 8 Jul 2009 14:14:03 -0600 Subject: [PATCH 1/4] docs: document glMaterial/glShadeModel display list optimization --- docs/relnotes-7.5.html | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/relnotes-7.5.html b/docs/relnotes-7.5.html index 045692113df..541a0f802a1 100644 --- a/docs/relnotes-7.5.html +++ b/docs/relnotes-7.5.html @@ -70,6 +70,7 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0
  • Initial support for separate compilation units in GLSL compiler.
  • Increased max number of generic GLSL varying variables to 16 (formerly 8).
  • GLSL linker now detects when too many varying variables are used. +
  • Optimize-out redundant glMaterial and glShadeModel calls in display lists From abdb0fdcc05eb9ec87b3d5a3226c3c190e1fbbcd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Jul 2009 07:57:29 -0600 Subject: [PATCH 2/4] glsl: fix incorrect indexing for gl_TextureMatrix[i][j] The two indexes were mixed up when accessing a row of a matrix in an array of matrices. --- src/mesa/shader/slang/slang_builtin.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c index 154609c26e7..289d94644f0 100644 --- a/src/mesa/shader/slang/slang_builtin.c +++ b/src/mesa/shader/slang/slang_builtin.c @@ -111,10 +111,9 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field, if (isMatrix) { if (tokens[0] == STATE_TEXTURE_MATRIX) { - if (index1 >= 0) { - tokens[1] = index1; /* which texture matrix */ - index1 = 0; /* prevent extra addition at end of function */ - } + /* texture_matrix[index1][index2] */ + tokens[1] = index1 >= 0 ? index1 : 0; /* which texture matrix */ + index1 = index2; /* move matrix row value to index1 */ } if (index1 < 0) { /* index1 is unused: prevent extra addition at end of function */ @@ -682,7 +681,9 @@ _slang_alloc_statevar(slang_ir_node *n, if (n->Opcode == IR_ELEMENT) { /* XXX can only handle constant indexes for now */ if (n->Children[1]->Opcode == IR_FLOAT) { - index2 = (GLint) n->Children[1]->Value[0]; + /* two-dimensional array index: mat[i][j] */ + index2 = index1; + index1 = (GLint) n->Children[1]->Value[0]; } else { *direct = GL_FALSE; From c86b0766681f986951e53ea852858eb8d6ce9e32 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Jul 2009 07:58:50 -0600 Subject: [PATCH 3/4] glsl: do const parameter optimization for array element actual parameters When a function parameter is const-qualified we can avoid making a copy of the actual parameter (we basically do a search/replace when inlining). This is now done for array element params too, resulting in better code (fewer MOV instructions). We should allow some other types of function arguments here but let's be conservative for the moment. --- src/mesa/shader/slang/slang_codegen.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 24e99523869..2b7e781f984 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -1417,8 +1417,9 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun, } else if (p->type.qualifier == SLANG_QUAL_CONST) { /* a constant input param */ - if (args[i].type == SLANG_OPER_IDENTIFIER || - args[i].type == SLANG_OPER_LITERAL_FLOAT) { + if (args[i].type == SLANG_OPER_IDENTIFIER || + args[i].type == SLANG_OPER_LITERAL_FLOAT || + args[i].type == SLANG_OPER_SUBSCRIPT) { /* replace all occurances of this parameter variable with the * actual argument variable or a literal. */ From 78af70be3727945d2d81a07b99d5a794f1114c05 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Jul 2009 08:04:07 -0600 Subject: [PATCH 4/4] docs: document gl_TextureMatrix[i][j] array indexing bug fix --- docs/relnotes-7.5.html | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/relnotes-7.5.html b/docs/relnotes-7.5.html index 541a0f802a1..5a67d3fb528 100644 --- a/docs/relnotes-7.5.html +++ b/docs/relnotes-7.5.html @@ -71,6 +71,7 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0
  • Increased max number of generic GLSL varying variables to 16 (formerly 8).
  • GLSL linker now detects when too many varying variables are used.
  • Optimize-out redundant glMaterial and glShadeModel calls in display lists +
  • Fixed gl_TextureMatrix[i][j] array indexing bug in GLSL compiler.