Mesa (master): mesa: fix bug in GLSL built-in matrix state lookup

Brian Paul brianp at kemper.freedesktop.org
Fri Nov 14 01:21:23 UTC 2008


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

Author: Brian Paul <brian.paul at tungstengraphics.com>
Date:   Wed Nov 12 16:44:47 2008 -0700

mesa: fix bug in GLSL built-in matrix state lookup

---

 src/mesa/shader/slang/slang_builtin.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c
index ed6de40..fdcd371 100644
--- a/src/mesa/shader/slang/slang_builtin.c
+++ b/src/mesa/shader/slang/slang_builtin.c
@@ -109,10 +109,13 @@ 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;
-            index1 = 0; /* prevent extra addition at end of function */
+            tokens[1] = index1; /* which texture matrix */
          }
       }
+      if (index1 < 0) {
+         /* index1 is unused: prevent extra addition at end of function */
+         index1 = 0;
+      }
    }
    else if (strcmp(var, "gl_DepthRange") == 0) {
       tokens[0] = STATE_DEPTH_RANGE;




More information about the mesa-commit mailing list