summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/prog_parameter.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-07-21 13:58:50 -0600
committerBrian Paul <[email protected]>2008-07-29 17:16:17 -0600
commitffbc66bf614c5a2b9bc3a68a6fa7d027405a55b9 (patch)
tree4cbf99c92188da1cb3ae9f3ca77392517fa30d18 /src/mesa/shader/prog_parameter.c
parent74a19b0abd382574ff583eab81a374acead9254d (diff)
mesa: assorted glsl uniform/attribute fixes
Fix incorrect uniform/attribute size query results. Add missing error checking for glUniform, glUniformMatrix params Fix an array size/allocation error.
Diffstat (limited to 'src/mesa/shader/prog_parameter.c')
-rw-r--r--src/mesa/shader/prog_parameter.c29
1 files changed, 3 insertions, 26 deletions
diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c
index a5b85a9660d..e209bbf6c40 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/shader/prog_parameter.c
@@ -62,29 +62,6 @@ _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.
* Note that parameter values are usually 4-element GLfloat vectors.
@@ -294,7 +271,7 @@ _mesa_add_uniform(struct gl_program_parameter_list *paramList,
}
else {
i = _mesa_add_parameter(paramList, PROGRAM_UNIFORM, name,
- size * _mesa_fit_type_in_vec4(datatype), datatype, NULL, NULL);
+ size, datatype, NULL, NULL);
return i;
}
}
@@ -362,7 +339,7 @@ _mesa_add_varying(struct gl_program_parameter_list *paramList,
*/
GLint
_mesa_add_attribute(struct gl_program_parameter_list *paramList,
- const char *name, GLint size, GLint attrib)
+ const char *name, GLint size, GLenum datatype, GLint attrib)
{
GLint i = _mesa_lookup_parameter_index(paramList, -1, name);
if (i >= 0) {
@@ -378,7 +355,7 @@ _mesa_add_attribute(struct gl_program_parameter_list *paramList,
if (size < 0)
size = 4;
i = _mesa_add_parameter(paramList, PROGRAM_INPUT, name,
- size, GL_NONE, NULL, state);
+ size, datatype, NULL, state);
}
return i;
}