Browse Source

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
tags/mesa_20090313
Brian Paul 17 years ago
parent
commit
088c42c5c3
1 changed files with 12 additions and 2 deletions
  1. 12
    2
      src/mesa/shader/shader_api.c

+ 12
- 2
src/mesa/shader/shader_api.c View File

{ {
struct gl_shader *sh = _mesa_lookup_shader(ctx, shader); struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
if (!sh) { 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; return;
} }
copy_string(sourceOut, maxLength, length, sh->Source); copy_string(sourceOut, maxLength, length, sh->Source);
{ {
struct gl_shader *sh = _mesa_lookup_shader(ctx, shader); struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
if (!sh) { 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; return;
} }



Loading…
Cancel
Save