summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-07-02 17:08:09 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-07-02 17:08:09 -0600
commit088c42c5c3cb34bac98fce95e4f3d08642834112 (patch)
tree79eb9c11032998204df1cf174062c970985d05a8
parent16caeeab4b495702b54963816ae45976b2563423 (diff)
mesa: fix error codes in _mesa_shader_source(), _mesa_get_shader_source()
If the 'shader' parameter is wrong, need to either generate GL_INVALID_VALUE or GL_INVALID_OPERATION. It depends on whether 'shader' actually names a 'program' or is a totally unknown ID. There might be other cases to fix... cherry-picked from master
-rw-r--r--src/mesa/shader/shader_api.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index a005c902e1..26d0b3d476 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -875,7 +875,12 @@ _mesa_get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength,
{
struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
if (!sh) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetShaderSource(shader)");
+ GLenum err;
+ if (_mesa_lookup_shader_program(ctx, shader))
+ err = GL_INVALID_OPERATION;
+ else
+ err = GL_INVALID_VALUE;
+ _mesa_error(ctx, err, "glGetShaderSource(shader)");
return;
}
copy_string(sourceOut, maxLength, length, sh->Source);
@@ -966,7 +971,12 @@ _mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source)
{
struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
if (!sh) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSource(shaderObj)");
+ GLenum err;
+ if (_mesa_lookup_shader_program(ctx, shader))
+ err = GL_INVALID_OPERATION;
+ else
+ err = GL_INVALID_VALUE;
+ _mesa_error(ctx, err, "glShaderSource(shaderObj)");
return;
}