summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-11-12 16:44:47 -0700
committerBrian Paul <brian.paul@tungstengraphics.com>2008-11-13 18:19:12 -0700
commit47b883e42ba5f6948ce8050d5a3c7849ba2a1cec (patch)
treec1bb4980e57bf8af9b5e8a7c2ba48f45b61eca1f
parent557fde9531289b4388a3080b89c2ebaa38abeaee (diff)
mesa: fix bug in GLSL built-in matrix state lookup
-rw-r--r--src/mesa/shader/slang/slang_builtin.c7
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 ed6de40d4b..fdcd3714a5 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;