[Mesa-dev] [PATCH 1/3] glsl: build stageref mask using IR, not symbol table

Martin Peres martin.peres at linux.intel.com
Mon Jun 29 05:59:33 PDT 2015


On 29/06/15 15:35, Tapani Pälli wrote:
> Instead of using symbol table, build mask by inspecting IR. This
> change is required by further patches to move resource list creation
> to happen later when symbol table does not exist anymore.
>
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> ---
>   src/glsl/linker.cpp | 11 ++++++++---
>   1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index 4a726d4..9be48f0 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -2591,9 +2591,14 @@ build_stageref(struct gl_shader_program *shProg, const char *name)
>         struct gl_shader *sh = shProg->_LinkedShaders[i];
>         if (!sh)
>            continue;
> -      ir_variable *var = sh->symbols->get_variable(name);
> -      if (var)
> -         stages |= (1 << i);
> +

It would be nice to add a comment here to say why you are using the ir 
and not get_variable(). Something along the line:
/* A variable in sh->symbols->get_variable(name) may have been optimized 
away by a driver-specific optimisation pass, let's inspect the IR 
instead to avoid this problem. */

I am sure you can come up with a better comment :)

With a comment here, the whole series is:
Reviewed-by: Martin Peres <martin.peres at linux.intel.com>

> +      foreach_in_list(ir_instruction, node, sh->ir) {
> +         ir_variable *var = node->as_variable();
> +         if (var && strcmp(var->name, name) == 0) {
> +            stages |= (1 << i);
> +            break;
> +         }
> +      }
>      }
>      return stages;
>   }



More information about the mesa-dev mailing list