summaryrefslogtreecommitdiffstats
path: root/src/mesa/slang
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-07-08 18:35:08 -0600
committerBrian Paul <[email protected]>2010-07-08 18:42:45 -0600
commit41f66915ab3d052e0e2ef06000d6534eb7776ec6 (patch)
tree693008a10d2b62c5987d065c7d71ab2d6ca75b9f /src/mesa/slang
parent2168b87b51e70e8ad914e547c6c922fc33af3a89 (diff)
glsl: fix indirect addressing of gl_TextureMatrix[] arrays
The code to emit an array of OpenGL state vars lacked the code to handle the gl_TextureMatrix[] array. Fixes fd.o bug 28967 NOTE: this is a candidate for the 7.8 branch.
Diffstat (limited to 'src/mesa/slang')
-rw-r--r--src/mesa/slang/slang_builtin.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/mesa/slang/slang_builtin.c b/src/mesa/slang/slang_builtin.c
index bb6fd662ccc..e3ac7d38e2d 100644
--- a/src/mesa/slang/slang_builtin.c
+++ b/src/mesa/slang/slang_builtin.c
@@ -399,7 +399,7 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field,
}
if (isMatrix) {
- /* load all four columns of matrix */
+ /* load all four rows (or columns) of matrix */
GLint pos[4];
GLuint j;
for (j = 0; j < 4; j++) {
@@ -489,9 +489,26 @@ emit_statevars(const char *name, int array_len,
tokens[0] = STATE_TEXGEN;
tokens[2] = STATE_TEXGEN_OBJECT_Q;
}
+ else if (strcmp(name, "gl_TextureMatrix") == 0) {
+ tokens[0] = STATE_TEXTURE_MATRIX;
+ tokens[4] = STATE_MATRIX_TRANSPOSE;
+ }
+ else if (strcmp(name, "gl_TextureMatrixInverse") == 0) {
+ tokens[0] = STATE_TEXTURE_MATRIX;
+ tokens[4] = STATE_MATRIX_INVTRANS;
+ }
+ else if (strcmp(name, "gl_TextureMatrixTranspose") == 0) {
+ tokens[0] = STATE_TEXTURE_MATRIX;
+ tokens[4] = 0;
+ }
+ else if (strcmp(name, "gl_TextureMatrixInverseTranspose") == 0) {
+ tokens[0] = STATE_TEXTURE_MATRIX;
+ tokens[4] = STATE_MATRIX_INVERSE;
+ }
else {
return -1; /* invalid array name */
}
+ /* emit state vars for each array element */
for (i = 0; i < array_len; i++) {
GLint p;
tokens[1] = i;
@@ -513,6 +530,19 @@ emit_statevars(const char *name, int array_len,
}
return pos;
}
+ else if (type->type == SLANG_SPEC_MAT4) {
+ /* unroll/emit 4 array rows (or columns) */
+ slang_type_specifier vec4;
+ GLint i, p, pos = -1;
+ vec4.type = SLANG_SPEC_VEC4;
+ for (i = 0; i < 4; i++) {
+ tokens[2] = tokens[3] = i; /* row[i] (or column[i]) of matrix */
+ p = emit_statevars(NULL, 0, &vec4, tokens, paramList);
+ if (pos == -1)
+ pos = p;
+ }
+ return pos;
+ }
else {
GLint pos;
assert(type->type == SLANG_SPEC_VEC4 ||