[Mesa-dev] [PATCH 02/17] nir: Add a label to nir_shader_info

Pohjolainen, Topi topi.pohjolainen at intel.com
Thu Oct 8 23:56:01 PDT 2015


On Thu, Oct 08, 2015 at 05:22:34PM -0700, Jason Ekstrand wrote:
> ---
>  src/glsl/nir/glsl_to_nir.cpp | 2 ++
>  src/glsl/nir/nir.h           | 3 +++
>  src/glsl/nir/nir_sweep.c     | 2 ++
>  3 files changed, 7 insertions(+)

This is needed in patch 8 and is:

Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>

> 
> diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
> index efaa73e..cdae2d1 100644
> --- a/src/glsl/nir/glsl_to_nir.cpp
> +++ b/src/glsl/nir/glsl_to_nir.cpp
> @@ -151,6 +151,8 @@ glsl_to_nir(const struct gl_shader_program *shader_prog,
>           num_textures = i;
>  
>     shader->info.name = ralloc_asprintf(shader, "GLSL%d", sh->Name);
> +   if (shader_prog->Label)
> +      shader->info.label = ralloc_strdup(shader, shader_prog->Label);
>     shader->info.num_textures = num_textures;
>     shader->info.num_ubos = sh->NumUniformBlocks;
>     shader->info.num_abos = shader_prog->NumAtomicBuffers;
> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> index bde9f49..b9f549b 100644
> --- a/src/glsl/nir/nir.h
> +++ b/src/glsl/nir/nir.h
> @@ -1460,6 +1460,9 @@ typedef struct nir_shader_compiler_options {
>  typedef struct nir_shader_info {
>     const char *name;
>  
> +   /* Descriptive name provided by the client; may be NULL */
> +   const char *label;
> +
>     /* Number of textures used by this shader */
>     unsigned num_textures;
>     /* Number of uniform buffers used by this shader */
> diff --git a/src/glsl/nir/nir_sweep.c b/src/glsl/nir/nir_sweep.c
> index b6ce43b..5a22f50 100644
> --- a/src/glsl/nir/nir_sweep.c
> +++ b/src/glsl/nir/nir_sweep.c
> @@ -155,6 +155,8 @@ nir_sweep(nir_shader *nir)
>     ralloc_adopt(rubbish, nir);
>  
>     ralloc_steal(nir, (char *)nir->info.name);
> +   if (nir->info.label)
> +      ralloc_steal(nir, (char *)nir->info.label);
>  
>     /* Variables and registers are not dead.  Steal them back. */
>     steal_list(nir, nir_variable, &nir->uniforms);
> -- 
> 2.5.0.400.gff86faf
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list