* Attach shader to a shader program.
*/
static void
-attach_shader(struct gl_context *ctx, GLuint program, GLuint shader)
+attach_shader(struct gl_context *ctx, GLuint program, GLuint shader,
+ const char *caller)
{
struct gl_shader_program *shProg;
struct gl_shader *sh;
const bool same_type_disallowed = _mesa_is_gles(ctx);
- shProg = _mesa_lookup_shader_program_err(ctx, program, "glAttachShader");
+ shProg = _mesa_lookup_shader_program_err(ctx, program, caller);
if (!shProg)
return;
- sh = _mesa_lookup_shader_err(ctx, shader, "glAttachShader");
+ sh = _mesa_lookup_shader_err(ctx, shader, caller);
if (!sh) {
return;
}
* "The error INVALID_OPERATION is generated by AttachObjectARB
* if <obj> is already attached to <containerObj>."
*/
- _mesa_error(ctx, GL_INVALID_OPERATION, "glAttachShader");
+ _mesa_error(ctx, GL_INVALID_OPERATION, caller);
return;
} else if (same_type_disallowed &&
shProg->Shaders[i]->Stage == sh->Stage) {
* is generated if [...] another shader object of the same type
* as shader is already attached to program."
*/
- _mesa_error(ctx, GL_INVALID_OPERATION, "glAttachShader");
+ _mesa_error(ctx, GL_INVALID_OPERATION, caller);
return;
}
}
shProg->Shaders = realloc(shProg->Shaders,
(n + 1) * sizeof(struct gl_shader *));
if (!shProg->Shaders) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glAttachShader");
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, caller);
return;
}
_mesa_AttachObjectARB(GLhandleARB program, GLhandleARB shader)
{
GET_CURRENT_CONTEXT(ctx);
- attach_shader(ctx, program, shader);
+ attach_shader(ctx, program, shader, "glAttachObjectARB");
}
_mesa_AttachShader(GLuint program, GLuint shader)
{
GET_CURRENT_CONTEXT(ctx);
- attach_shader(ctx, program, shader);
+ attach_shader(ctx, program, shader, "glAttachShader");
}
get_shaderiv(ctx, shader, GL_COMPILE_STATUS, &compiled);
if (compiled) {
- attach_shader(ctx, program, shader);
+ attach_shader(ctx, program, shader, "glCreateShaderProgramv");
_mesa_link_program(ctx, shProg);
detach_shader(ctx, program, shader);