diff options
author | Brian <brian@yutani.localnet.net> | 2007-03-13 16:50:24 -0600 |
---|---|---|
committer | Brian <brian@yutani.localnet.net> | 2007-03-13 16:50:24 -0600 |
commit | 52363954bfe1f9f5aec6da504e191099f80578ee (patch) | |
tree | b387a46108ca8a9b4f282c39a6bf0e6381cf5aa9 /src/mesa/shader/shader_api.c | |
parent | 98650bdf897ee8dc1bcf32e28832c1d54acd0d79 (diff) |
more bug fixing, error checking
Diffstat (limited to 'src/mesa/shader/shader_api.c')
-rw-r--r-- | src/mesa/shader/shader_api.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index b916e75b93..aab522e292 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -912,6 +912,11 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, } } + if (count < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glUniform(count < 0)"); + return; + } + switch (type) { case GL_FLOAT: case GL_INT: @@ -945,13 +950,13 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, type == GL_INT_VEC2 || type == GL_INT_VEC3 || type == GL_INT_VEC4) { - const GLint *iValues = (const GLint *) values; + const GLint *iValues = ((const GLint *) values) + k * elems; for (i = 0; i < elems; i++) { uniformVal[i] = (GLfloat) iValues[i]; } } else { - const GLfloat *fValues = (const GLfloat *) values; + const GLfloat *fValues = ((const GLfloat *) values) + k * elems; for (i = 0; i < elems; i++) { uniformVal[i] = fValues[i]; } |