In order to fix GL error messages.

Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
---
 src/mesa/main/shaderapi.c | 19 ++++++++++---------
 1 file 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);
 
-- 
2.13.2

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to