On Fri, Jun 1, 2018 at 3:39 PM, Jason Ekstrand <ja...@jlekstrand.net> wrote:
> If something uses get_variable, it's likely that it doesn't know what to
> do with casts.  If there are any casts in the chain, just return NULL.
> ---
>  src/compiler/nir/nir.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
> index 8b826d8..28a40c7 100644
> --- a/src/compiler/nir/nir.h
> +++ b/src/compiler/nir/nir.h
> @@ -1015,8 +1015,12 @@ nir_deref_instr_parent(const nir_deref_instr *instr)
>  static inline nir_variable *
>  nir_deref_instr_get_variable(const nir_deref_instr *instr)
>  {
> -   while (instr->deref_type != nir_deref_type_var)
> +   while (instr->deref_type != nir_deref_type_var) {
> +      if (!instr || instr->deref_type == nir_deref_type_cast)

the "while (instr->foo ...) { if (!instr || ...)" thing looks a bit suspicious..

BR,
-R


> +         return NULL;
> +
>        instr = nir_deref_instr_parent(instr);
> +   }
>
>     return instr->var;
>  }
> --
> 2.5.0.400.gff86faf
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to