[Mesa-dev] [PATCH 1/8] meta: Set some object labels on our meta shaders.

Ian Romanick idr at freedesktop.org
Fri Feb 21 17:13:10 PST 2014


I really like using the object label in logging.  Series is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 02/21/2014 11:32 AM, Eric Anholt wrote:
> ---
>   src/mesa/drivers/common/meta.c      | 6 ++++++
>   src/mesa/drivers/common/meta_blit.c | 8 ++++++++
>   2 files changed, 14 insertions(+)
>
> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
> index 2dec2c3..d415e61 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -52,6 +52,7 @@
>   #include "main/matrix.h"
>   #include "main/mipmap.h"
>   #include "main/multisample.h"
> +#include "main/objectlabel.h"
>   #include "main/pixel.h"
>   #include "main/pbo.h"
>   #include "main/polygon.h"
> @@ -178,6 +179,7 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx,
>      GLuint vs, fs;
>      void *const mem_ctx = ralloc_context(NULL);
>      struct blit_shader *shader = choose_blit_shader(target, table);
> +   char *name;
>
>      assert(shader != NULL);
>
> @@ -253,6 +255,8 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx,
>      _mesa_BindAttribLocation(shader->shader_prog, 0, "position");
>      _mesa_BindAttribLocation(shader->shader_prog, 1, "texcoords");
>      _mesa_meta_link_program_with_debug(ctx, shader->shader_prog);
> +   name = ralloc_asprintf(mem_ctx, "%s blit", shader->type);
> +   _mesa_ObjectLabel(GL_PROGRAM, shader->shader_prog, -1, name);
>      ralloc_free(mem_ctx);
>
>      _mesa_UseProgram(shader->shader_prog);
> @@ -1605,6 +1609,8 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
>          * BindFragDataLocation to 0.
>          */
>
> +      _mesa_ObjectLabel(GL_PROGRAM, clear->IntegerShaderProg, -1,
> +                        "integer clear");
>         _mesa_meta_link_program_with_debug(ctx, clear->IntegerShaderProg);
>
>         clear->IntegerColorLocation =
> diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
> index 34b58d9..43fa761 100644
> --- a/src/mesa/drivers/common/meta_blit.c
> +++ b/src/mesa/drivers/common/meta_blit.c
> @@ -36,6 +36,7 @@
>   #include "main/macros.h"
>   #include "main/matrix.h"
>   #include "main/multisample.h"
> +#include "main/objectlabel.h"
>   #include "main/readpix.h"
>   #include "main/shaderapi.h"
>   #include "main/texobj.h"
> @@ -104,6 +105,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
>      bool dst_is_msaa = false;
>      GLenum src_datatype;
>      const char *vec4_prefix;
> +   char *name;
>
>      if (src_rb) {
>         src_datatype = _mesa_get_format_datatype(src_rb->Format);
> @@ -180,6 +182,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
>         if (dst_is_msaa) {
>            arb_sample_shading_extension_string = "#extension GL_ARB_sample_shading : enable";
>            sample_index = "gl_SampleID";
> +         name = "depth MSAA copy";
>         } else {
>            /* Don't need that extension, since we're drawing to a single-sampled
>             * destination.
> @@ -196,6 +199,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
>             * We're slacking and instead of choosing centermost, we've got 0.
>             */
>            sample_index = "0";
> +         name = "depth MSAA resolve";
>         }
>
>         vs_source = ralloc_asprintf(mem_ctx,
> @@ -230,6 +234,9 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
>         char *sample_resolve;
>         const char *arb_sample_shading_extension_string;
>         const char *merge_function;
> +      name = ralloc_asprintf(mem_ctx, "%svec4 MSAA %s",
> +                             vec4_prefix,
> +                             dst_is_msaa ? "copy" : "resolve");
>
>         if (dst_is_msaa) {
>            arb_sample_shading_extension_string = "#extension GL_ARB_sample_shading : enable";
> @@ -332,6 +339,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
>      _mesa_BindAttribLocation(blit->msaa_shaders[shader_index], 0, "position");
>      _mesa_BindAttribLocation(blit->msaa_shaders[shader_index], 1, "texcoords");
>      _mesa_meta_link_program_with_debug(ctx, blit->msaa_shaders[shader_index]);
> +   _mesa_ObjectLabel(GL_PROGRAM, blit->msaa_shaders[shader_index], -1, name);
>      ralloc_free(mem_ctx);
>
>      _mesa_UseProgram(blit->msaa_shaders[shader_index]);
>



More information about the mesa-dev mailing list