nir: Add a label to nir_shader_info
authorJason Ekstrand <jason.ekstrand@intel.com>
Mon, 5 Oct 2015 23:54:36 +0000 (16:54 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 19 Oct 2015 15:45:14 +0000 (08:45 -0700)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/glsl/nir/glsl_to_nir.cpp
src/glsl/nir/nir.h
src/glsl/nir/nir_sweep.c

index cf5bb9360c8338e10983812db914aa86bcc8ecfc..edc6f5bd9b49f18cdae311f1e3e5716de2a9e921 100644 (file)
@@ -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", shader_prog->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;
index c867e6d9f1864825f6a8eb50b7991670d6653bd3..fb8d59038d83fa08db48d46969960101a13ec5bb 100644 (file)
@@ -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 */
index b6ce43b5224167a4344e6426f61f272f87069bd5..5a22f509f5048a7067a8861e7f114b8cdf03e118 100644 (file)
@@ -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);