diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2008-05-14 16:01:31 -0600 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2008-05-14 16:01:31 -0600 |
commit | f84005c0a114837a0c7209a3c598e02fb5f47da1 (patch) | |
tree | 3872ef3fdfa15f74f6a800246e7aa93a89bb238c /src/mesa | |
parent | d791386b09682dbccc68cc3803b6d71a0362124e (diff) |
mesa: glUniform(location==-1) is not an error
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/shader/shader_api.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 2b3dbff7a0..d0512b8ed1 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1151,6 +1151,10 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, return; } + if (location == -1) + return; /* The standard specifies this as a no-op */ + + if (location < 0 || location >= (GLint) shProg->Uniforms->NumUniforms) { _mesa_error(ctx, GL_INVALID_VALUE, "glUniform(location)"); return; @@ -1246,11 +1250,16 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows, GLboolean transpose, const GLfloat *values) { struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; + if (!shProg || !shProg->LinkStatus) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUniformMatrix(program not linked)"); return; } + + if (location == -1) + return; /* The standard specifies this as a no-op */ + if (location < 0 || location >= shProg->Uniforms->NumUniforms) { _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix(location)"); return; |