mesa: fix bug in GLSL built-in matrix state lookup
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 12 Nov 2008 23:44:47 +0000 (16:44 -0700)
committerBrian Paul <brian.paul@tungstengraphics.com>
Fri, 14 Nov 2008 01:19:12 +0000 (18:19 -0700)
src/mesa/shader/slang/slang_builtin.c

index ed6de40d4b6c8f44bbcf3abefdeaa0c0a6b0c323..fdcd3714a5c9cc553b7addb77ebbe71d40aab472 100644 (file)
@@ -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;