Mesa (mesa_7_4_branch): glsl: raise GL_INVALID_OPERATION for glUniform( location < -1)
Brian Paul
brianp at kemper.freedesktop.org
Tue Feb 17 03:46:47 UTC 2009
Module: Mesa
Branch: mesa_7_4_branch
Commit: 46f8b62d5f989b2f878383813c291e055af936fa
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=46f8b62d5f989b2f878383813c291e055af936fa
Author: Brian Paul <brianp at vmware.com>
Date: Mon Feb 16 20:30:06 2009 -0700
glsl: raise GL_INVALID_OPERATION for glUniform(location < -1)
location = -1 is silently ignored, but other negative values should raise
an error.
Another fix for bug 20056.
(cherry picked from master, commit 234f03e90ab718f5b16300a91bac477ccbabf36c)
---
src/mesa/shader/shader_api.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 692fa92..2c1a963 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -1663,6 +1663,11 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
if (location == -1)
return; /* The standard specifies this as a no-op */
+ if (location < -1) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(location)");
+ return;
+ }
+
split_location_offset(&location, &offset);
if (location < 0 || location >= (GLint) shProg->Uniforms->NumUniforms) {
@@ -1802,6 +1807,11 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
if (location == -1)
return; /* The standard specifies this as a no-op */
+ if (location < -1) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glUniformMatrix(location)");
+ return;
+ }
+
split_location_offset(&location, &offset);
if (location < 0 || location >= (GLint) shProg->Uniforms->NumUniforms) {
More information about the mesa-commit
mailing list