diff options
author | Samuel Pitoiset <[email protected]> | 2017-06-23 16:53:55 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-06-28 10:25:12 +0200 |
commit | 3ae7777d25504097050c0ed51afe6866dc10df7c (patch) | |
tree | cdd36de21c141aa8fe1fccdfaaaced1c443670f6 /src/mesa/main/shaderapi.c | |
parent | c26be2b2e920b9e79067c9ffa51cc6f122a08743 (diff) |
mesa: pass the 'caller' function to attach_shader()
In order to fix GL error messages.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main/shaderapi.c')
-rw-r--r-- | src/mesa/main/shaderapi.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 5a7124043bb..8d044d0fa39 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -244,7 +244,8 @@ is_shader(struct gl_context *ctx, GLuint name) * 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; @@ -252,11 +253,11 @@ attach_shader(struct gl_context *ctx, GLuint program, GLuint shader) 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; } @@ -270,7 +271,7 @@ attach_shader(struct gl_context *ctx, GLuint program, GLuint shader) * "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) { @@ -282,7 +283,7 @@ attach_shader(struct gl_context *ctx, GLuint program, GLuint shader) * 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; } } @@ -291,7 +292,7 @@ attach_shader(struct gl_context *ctx, GLuint program, GLuint shader) 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; } @@ -1330,7 +1331,7 @@ void GLAPIENTRY _mesa_AttachObjectARB(GLhandleARB program, GLhandleARB shader) { GET_CURRENT_CONTEXT(ctx); - attach_shader(ctx, program, shader); + attach_shader(ctx, program, shader, "glAttachObjectARB"); } @@ -1338,7 +1339,7 @@ void GLAPIENTRY _mesa_AttachShader(GLuint program, GLuint shader) { GET_CURRENT_CONTEXT(ctx); - attach_shader(ctx, program, shader); + attach_shader(ctx, program, shader, "glAttachShader"); } @@ -2262,7 +2263,7 @@ _mesa_CreateShaderProgramv(GLenum type, GLsizei count, 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); |