summaryrefslogtreecommitdiff
path: root/src/mesa/program/prog_parameter.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/program/prog_parameter.c')
-rw-r--r--src/mesa/program/prog_parameter.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c
index aac488c79a..fa5deaf127 100644
--- a/src/mesa/program/prog_parameter.c
+++ b/src/mesa/program/prog_parameter.c
@@ -344,18 +344,19 @@ _mesa_use_uniform(struct gl_program_parameter_list *paramList,
*/
GLint
_mesa_add_sampler(struct gl_program_parameter_list *paramList,
- const char *name, GLenum datatype)
+ const char *name, GLenum datatype, int array_length)
{
GLint i = _mesa_lookup_parameter_index(paramList, -1, name);
if (i >= 0 && paramList->Parameters[i].Type == PROGRAM_SAMPLER) {
- ASSERT(paramList->Parameters[i].Size == 1);
+ ASSERT(paramList->Parameters[i].Size == 4 * array_length);
ASSERT(paramList->Parameters[i].DataType == datatype);
/* already in list */
return (GLint) paramList->ParameterValues[i][0];
}
else {
GLuint i;
- const GLint size = 1; /* a sampler is basically a texture unit number */
+ /* One integer texture unit number goes in each parameter location. */
+ const GLint size = 4 * array_length;
GLfloat value[4];
GLint numSamplers = 0;
for (i = 0; i < paramList->NumParameters; i++) {
@@ -591,7 +592,7 @@ _mesa_lookup_parameter_constant(const struct gl_program_parameter_list *list,
if (vSize == 1) {
/* look for v[0] anywhere within float[4] value */
GLuint j;
- for (j = 0; j < 4; j++) {
+ for (j = 0; j < list->Parameters[i].Size; j++) {
if (list->ParameterValues[i][j] == v[0]) {
/* found it */
*posOut = i;