summaryrefslogtreecommitdiff
path: root/src/mesa/shader
diff options
context:
space:
mode:
authorBruce Merry <bmerry@users.sourceforge.net>2007-12-21 15:20:17 +0200
committerBrian <brian.paul@tungstengraphics.com>2008-01-01 09:58:15 -0700
commit89b80327ae9d74729f7eb57f338f6b20837ceb05 (patch)
treebf95fce63d9fc1f79abf603e42f29bfe8a1a02b1 /src/mesa/shader
parenteeb03faadc7e677f69aaf82aef2786c39faa4b76 (diff)
More fixes to shader_api
- return GL_INVALID_OPERATION instead of GL_INVALID_VALUE if location is bad - correct the type-checking of uniforms from my previous commit - accept location of -1 in _mesa_uniform_matrix
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/shader_api.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 4e039cba42..75fb918236 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -1152,18 +1152,21 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
if (location == -1)
return; /* The standard specifies this as a no-op */
+ /* The spec says this is GL_INVALID_OPERATION, although it seems like it
+ * ought to be GL_INVALID_VALUE
+ */
if (location < 0 || location >= (GLint) shProg->Uniforms->NumParameters) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glUniform(location)");
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(location)");
return;
}
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
- uType = shProg->Uniforms->Parameters[location].Type;
+ uType = shProg->Uniforms->Parameters[location].DataType;
/*
* If we're setting a sampler, we must use glUniformi1()!
*/
- if (uType == PROGRAM_SAMPLER) {
+ if (shProg->Uniforms->Parameters[location].Type == PROGRAM_SAMPLER) {
GLint unit;
if (type != GL_INT || count != 1) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -1216,14 +1219,15 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
case GL_BOOL_VEC2:
case GL_BOOL_VEC3:
case GL_BOOL_VEC4:
- if (elems != sizeof_glsl_type(shProg->Uniforms->Parameters[location].DataType)) {
+ if (elems != sizeof_glsl_type(uType)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(count mismatch)");
}
break;
case PROGRAM_SAMPLER:
break;
default:
- if (uType != type) {
+ if (shProg->Uniforms->Parameters[location].Type != PROGRAM_SAMPLER
+ && uType != type) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(type mismatch)");
}
break;
@@ -1280,8 +1284,13 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
"glUniformMatrix(program not linked)");
return;
}
- if (location < 0 || location >= shProg->Uniforms->NumParameters) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix(location)");
+ if (location == -1)
+ return; /* The standard specifies this as a no-op */
+ /* The spec says this is GL_INVALID_OPERATION, although it seems like it
+ * ought to be GL_INVALID_VALUE
+ */
+ if (location < 0 || location >= (GLint) shProg->Uniforms->NumParameters) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glUniformMatrix(location)");
return;
}
if (values == NULL) {