summaryrefslogtreecommitdiff
path: root/src/mesa/shader/prog_parameter.c
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-02-20 08:04:40 -0700
committerBrian <brian@yutani.localnet.net>2007-02-20 08:04:40 -0700
commit3d001b81c23dc1981cd5f4b0885d935d2c9a098b (patch)
tree7fbfcea0358a7c4cad634860d9bf8342e0782055 /src/mesa/shader/prog_parameter.c
parentd434019633ccc537f07ec4e7d409bc93134367c8 (diff)
parent9449a4d8945de684609663468b96b7ed3aa884b9 (diff)
Merge branch 'glsl-compiler-1' of git+ssh://brianp@git.freedesktop.org/git/mesa/mesa into glsl-compiler-1
Diffstat (limited to 'src/mesa/shader/prog_parameter.c')
-rw-r--r--src/mesa/shader/prog_parameter.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c
index a87dafc598..3ebd559119 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/shader/prog_parameter.c
@@ -131,6 +131,10 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList,
COPY_4V(paramList->ParameterValues[oldNum + i], values);
values += 4;
}
+ else {
+ /* silence valgrind */
+ ASSIGN_4V(paramList->ParameterValues[oldNum + i], 0, 0, 0, 0);
+ }
size -= 4;
}
@@ -493,17 +497,28 @@ _mesa_lookup_parameter_constant(const struct gl_program_parameter_list *list,
}
}
}
- else if (list->Parameters[i].Size >= vSize) {
- /* see if we can match this constant */
- GLuint match = 0, j;
+ else if (vSize <= list->Parameters[i].Size) {
+ /* see if we can match this constant (with a swizzle) */
+ GLuint swz[4];
+ GLuint match = 0, j, k;
for (j = 0; j < vSize; j++) {
- if (list->ParameterValues[i][j] == v[j]) {
+ if (v[j] == list->ParameterValues[i][j]) {
+ swz[j] = j;
match++;
}
+ else {
+ for (k = 0; k < list->Parameters[i].Size; k++) {
+ if (v[j] == list->ParameterValues[i][k]) {
+ swz[j] = k;
+ match++;
+ break;
+ }
+ }
+ }
}
if (match == vSize) {
*posOut = i;
- *swizzleOut = SWIZZLE_NOOP;
+ *swizzleOut = MAKE_SWIZZLE4(swz[0], swz[1], swz[2], swz[3]);
return GL_TRUE;
}
}