summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian <brian@nostromo.localnet.net>2007-02-08 20:39:42 -0700
committerBrian <brian@nostromo.localnet.net>2007-02-08 20:39:42 -0700
commit5e6908944bbc76be020a3f5306c2a674f944f42e (patch)
treefe8e6d365b6fd5a793d23e1eb3c795a7f9b5ee0b /src
parentbd9615bbc59b0ce626bb32e2a005fccec20e7331 (diff)
do full swizzled matching in _mesa_lookup_parameter_constant()
Diffstat (limited to 'src')
-rw-r--r--src/mesa/shader/prog_parameter.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c
index a87dafc598..870e826460 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/shader/prog_parameter.c
@@ -493,17 +493,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;
}
}