}
-static void
-detach_shader(struct gl_context *ctx, GLuint program, GLuint shader)
+static ALWAYS_INLINE void
+detach_shader(struct gl_context *ctx, GLuint program, GLuint shader,
+ bool no_error)
{
struct gl_shader_program *shProg;
GLuint n;
GLuint i, j;
- shProg = _mesa_lookup_shader_program_err(ctx, program, "glDetachShader");
- if (!shProg)
- return;
+ if (!no_error) {
+ shProg = _mesa_lookup_shader_program_err(ctx, program, "glDetachShader");
+ if (!shProg)
+ return;
+ } else {
+ shProg = _mesa_lookup_shader_program(ctx, program);
+ }
n = shProg->NumShaders;
}
/* not found */
- {
+ if (!no_error) {
GLenum err;
if (is_shader(ctx, shader) || is_program(ctx, shader))
err = GL_INVALID_OPERATION;
}
+static void
+detach_shader_error(struct gl_context *ctx, GLuint program, GLuint shader)
+{
+ detach_shader(ctx, program, shader, false);
+}
+
+
/**
* Return list of shaders attached to shader program.
*/
_mesa_DetachObjectARB(GLhandleARB program, GLhandleARB shader)
{
GET_CURRENT_CONTEXT(ctx);
- detach_shader(ctx, program, shader);
+ detach_shader_error(ctx, program, shader);
}
_mesa_DetachShader(GLuint program, GLuint shader)
{
GET_CURRENT_CONTEXT(ctx);
- detach_shader(ctx, program, shader);
+ detach_shader_error(ctx, program, shader);
}
if (compiled) {
attach_shader_err(ctx, program, shader, "glCreateShaderProgramv");
_mesa_link_program(ctx, shProg);
- detach_shader(ctx, program, shader);
+ detach_shader_error(ctx, program, shader);
#if 0
/* Possibly... */