summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-07-09 07:57:29 -0600
committerBrian Paul <brianp@vmware.com>2009-07-09 07:57:29 -0600
commitabdb0fdcc05eb9ec87b3d5a3226c3c190e1fbbcd (patch)
tree93a81bcb557232d341d754cbc1728280694ca7d9 /src/mesa
parent36e906aad6d0520db00cc5112fd015497465bc87 (diff)
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.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/shader/slang/slang_builtin.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c
index 154609c26e..289d94644f 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;