[Mesa-dev] [PATCH] mesa: pass caller name to create_textures()

Anuj Phogat anuj.phogat at gmail.com
Tue Oct 13 13:22:58 PDT 2015


On Mon, Oct 12, 2015 at 7:44 PM, Brian Paul <brianp at vmware.com> wrote:
> Simpler than the dsa flag approach.
> ---
>  src/mesa/main/texobj.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
> index 60c55ae..b571b1b 100644
> --- a/src/mesa/main/texobj.c
> +++ b/src/mesa/main/texobj.c
> @@ -1205,17 +1205,16 @@ invalidate_tex_image_error_check(struct gl_context *ctx, GLuint texture,
>   */
>  static void
>  create_textures(struct gl_context *ctx, GLenum target,
> -                GLsizei n, GLuint *textures, bool dsa)
> +                GLsizei n, GLuint *textures, const char *caller)
>  {
>     GLuint first;
>     GLint i;
> -   const char *func = dsa ? "Create" : "Gen";
>
>     if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
> -      _mesa_debug(ctx, "gl%sTextures %d\n", func, n);
> +      _mesa_debug(ctx, "%s %d\n", caller, n);
>
>     if (n < 0) {
> -      _mesa_error( ctx, GL_INVALID_VALUE, "gl%sTextures(n < 0)", func );
> +      _mesa_error(ctx, GL_INVALID_VALUE, "%s(n < 0)", caller);
>        return;
>     }
>
> @@ -1236,7 +1235,7 @@ create_textures(struct gl_context *ctx, GLenum target,
>        texObj = ctx->Driver.NewTextureObject(ctx, name, target);
>        if (!texObj) {
>           mtx_unlock(&ctx->Shared->Mutex);
> -         _mesa_error(ctx, GL_OUT_OF_MEMORY, "gl%sTextures", func);
> +         _mesa_error(ctx, GL_OUT_OF_MEMORY, "gl%sTextures", caller);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", caller);

>           return;
>        }
>
> @@ -1273,7 +1272,7 @@ void GLAPIENTRY
>  _mesa_GenTextures(GLsizei n, GLuint *textures)
>  {
>     GET_CURRENT_CONTEXT(ctx);
> -   create_textures(ctx, 0, n, textures, false);
> +   create_textures(ctx, 0, n, textures, "glGenTextures");
>  }
>
>  /**
> @@ -1306,7 +1305,7 @@ _mesa_CreateTextures(GLenum target, GLsizei n, GLuint *textures)
>        return;
>     }
>
> -   create_textures(ctx, target, n, textures, true);
> +   create_textures(ctx, target, n, textures, "glCreateTextures");
>  }
>
>  /**
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

With the suggested change:
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the mesa-dev mailing list