diff options
author | Zack Rusin <zack@tungstengraphics.com> | 2008-06-12 00:03:35 -0400 |
---|---|---|
committer | Zack Rusin <zack@tungstengraphics.com> | 2008-06-12 15:08:27 -0400 |
commit | 2542c59c55589bdeaf56b9cf91625b0adf75e3ab (patch) | |
tree | 9996b4a6a8cc14eb7731db1e21f9c1d16375535a /src/mesa/shader/prog_parameter.c | |
parent | 74964ff04d89be430944dd8106bf5c97a9933f85 (diff) | |
download | external_mesa3d-2542c59c55589bdeaf56b9cf91625b0adf75e3ab.zip external_mesa3d-2542c59c55589bdeaf56b9cf91625b0adf75e3ab.tar.gz external_mesa3d-2542c59c55589bdeaf56b9cf91625b0adf75e3ab.tar.bz2 |
shaders: fix allocation of arrays of parameters
Diffstat (limited to 'src/mesa/shader/prog_parameter.c')
-rw-r--r-- | src/mesa/shader/prog_parameter.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index 152bd79..afdd7e5 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -62,6 +62,28 @@ _mesa_free_parameter_list(struct gl_program_parameter_list *paramList) } +static GLint +_mesa_fit_type_in_vec4(GLenum type) +{ + switch (type) { + case GL_FLOAT: + case GL_INT: + return 4; + break; + case GL_FLOAT_VEC2: + case GL_INT_VEC2: + return 2; + break; + case GL_FLOAT_VEC3: + case GL_INT_VEC3: + return 1; + break; + case GL_FLOAT_VEC4: + case GL_INT_VEC4: + default: + return 1; + } +} /** * Add a new parameter to a parameter list. @@ -272,7 +294,7 @@ _mesa_add_uniform(struct gl_program_parameter_list *paramList, } else { i = _mesa_add_parameter(paramList, PROGRAM_UNIFORM, name, - size, datatype, NULL, NULL); + size * _mesa_fit_type_in_vec4(datatype), datatype, NULL, NULL); return i; } } |