[Mesa-dev] [PATCH v3 024/104] nir: Support deref instructions in lower_system_values

Caio Marcelo de Oliveira Filho caio.oliveira at intel.com
Fri Apr 6 21:47:30 UTC 2018


On Tue, Apr 03, 2018 at 11:32:51AM -0700, Jason Ekstrand wrote:
> ---
>  src/compiler/nir/nir_lower_system_values.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c
> index fb560ee..104df51 100644
> --- a/src/compiler/nir/nir_lower_system_values.c
> +++ b/src/compiler/nir/nir_lower_system_values.c
> @@ -39,10 +39,15 @@ convert_block(nir_block *block, nir_builder *b)
>  
>        nir_intrinsic_instr *load_var = nir_instr_as_intrinsic(instr);
>  
> -      if (load_var->intrinsic != nir_intrinsic_load_var)
> -         continue;
> +      nir_variable *var;
> +      if (load_var->intrinsic == nir_intrinsic_load_var) {
> +         var = load_var->variables[0]->var;
> +      } else if (load_var->intrinsic == nir_intrinsic_load_deref) {
> +         var = nir_deref_instr_get_variable(nir_src_as_deref(load_var->src[0]));

Question: nir_deref_instr_get_variable will walk the deref instr
chain, but does it even make sense if there's a array or struct in
this deref chain? Should this be asserted?


Thanks,
Caio


More information about the mesa-dev mailing list