[Mesa-dev] [PATCH 2/3] nir: move getting deref from var after we check deref type.
Jason Ekstrand
jason at jlekstrand.net
Mon Nov 19 19:30:34 UTC 2018
Patches 1 and 2 are
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
As I commented on IRC, I'd recommend we also review and land my emit
pointers on-the-fly patch. I don't know that it's strictly necessary but I
do think it's better.
On Sun, Nov 18, 2018 at 9:57 PM Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> I posted a load of hacks before to do this, Jason suggested this,
> just check the deref mode, not the variable mode and delay getting
> the variable until we know the type.
>
> avoids crashes when derefing shared memory pointers.
> ---
> src/compiler/nir/nir_gather_info.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/src/compiler/nir/nir_gather_info.c
> b/src/compiler/nir/nir_gather_info.c
> index 15d38f036b5..7eaa4c27c1f 100644
> --- a/src/compiler/nir/nir_gather_info.c
> +++ b/src/compiler/nir/nir_gather_info.c
> @@ -210,10 +210,9 @@ gather_intrinsic_info(nir_intrinsic_instr *instr,
> nir_shader *shader,
> case nir_intrinsic_load_deref:
> case nir_intrinsic_store_deref:{
> nir_deref_instr *deref = nir_src_as_deref(instr->src[0]);
> - nir_variable *var = nir_deref_instr_get_variable(deref);
> -
> - if (var->data.mode == nir_var_shader_in ||
> - var->data.mode == nir_var_shader_out) {
> + if (deref->mode == nir_var_shader_in ||
> + deref->mode == nir_var_shader_out) {
> + nir_variable *var = nir_deref_instr_get_variable(deref);
> bool is_output_read = false;
> if (var->data.mode == nir_var_shader_out &&
> instr->intrinsic == nir_intrinsic_load_deref)
> --
> 2.17.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181119/888fcd46/attachment-0001.html>
More information about the mesa-dev
mailing list