[Mesa-dev] [PATCH] radeonsi/nir: fix scanning of bindless images

Marek Olšák maraeo at gmail.com
Tue Apr 16 14:31:03 UTC 2019


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Tue, Apr 16, 2019 at 12:33 AM Timothy Arceri <tarceri at itsqueeze.com>
wrote:

> Fixes: d62d434fe920 ("ac/nir_to_llvm: add image bindless support")
> ---
>  src/gallium/drivers/radeonsi/si_shader_nir.c | 75 ++++++++++----------
>  1 file changed, 37 insertions(+), 38 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c
> b/src/gallium/drivers/radeonsi/si_shader_nir.c
> index 938b0efcb76..5a925f19e09 100644
> --- a/src/gallium/drivers/radeonsi/si_shader_nir.c
> +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
> @@ -181,39 +181,48 @@ static void scan_instruction(const struct nir_shader
> *nir,
>                 case nir_intrinsic_load_tess_level_outer:
>                         info->reads_tess_factors = true;
>                         break;
> -               case nir_intrinsic_image_deref_load: {
> -                       nir_variable *var = intrinsic_get_var(intr);
> -                       if (var->data.bindless) {
> -                               info->uses_bindless_images = true;
> +               case nir_intrinsic_bindless_image_load:
> +                       info->uses_bindless_images = true;
>
> -                               if (glsl_get_sampler_dim(var->type) ==
> GLSL_SAMPLER_DIM_BUF)
> -                                       info->uses_bindless_buffer_load =
> true;
> -                               else
> -                                       info->uses_bindless_image_load =
> true;
> -                       }
> +                       if (nir_intrinsic_image_dim(intr) ==
> GLSL_SAMPLER_DIM_BUF)
> +                               info->uses_bindless_buffer_load = true;
> +                       else
> +                               info->uses_bindless_image_load = true;
>                         break;
> -               }
> -               case nir_intrinsic_image_deref_size:
> -               case nir_intrinsic_image_deref_samples: {
> -                       nir_variable *var = intrinsic_get_var(intr);
> -                       if (var->data.bindless)
> -                               info->uses_bindless_images = true;
> +               case nir_intrinsic_bindless_image_size:
> +               case nir_intrinsic_bindless_image_samples:
> +                       info->uses_bindless_images = true;
>                         break;
> -               }
> -               case nir_intrinsic_image_deref_store: {
> -                       const nir_deref_instr *image_deref =
> nir_instr_as_deref(intr->src[0].ssa->parent_instr);
> -                       nir_variable *var = intrinsic_get_var(intr);
> -                       if (var->data.bindless) {
> -                               info->uses_bindless_images = true;
> +               case nir_intrinsic_bindless_image_store:
> +                       info->uses_bindless_images = true;
> +
> +                       if (nir_intrinsic_image_dim(intr) ==
> GLSL_SAMPLER_DIM_BUF)
> +                               info->uses_bindless_buffer_store = true;
> +                       else
> +                               info->uses_bindless_image_store = true;
> +
> +                       info->writes_memory = true;
> +                       break;
> +               case nir_intrinsic_image_deref_store:
> +                       info->writes_memory = true;
> +                       break;
> +               case nir_intrinsic_bindless_image_atomic_add:
> +               case nir_intrinsic_bindless_image_atomic_min:
> +               case nir_intrinsic_bindless_image_atomic_max:
> +               case nir_intrinsic_bindless_image_atomic_and:
> +               case nir_intrinsic_bindless_image_atomic_or:
> +               case nir_intrinsic_bindless_image_atomic_xor:
> +               case nir_intrinsic_bindless_image_atomic_exchange:
> +               case nir_intrinsic_bindless_image_atomic_comp_swap:
> +                       info->uses_bindless_images = true;
> +
> +                       if (nir_intrinsic_image_dim(intr) ==
> GLSL_SAMPLER_DIM_BUF)
> +                               info->uses_bindless_buffer_atomic = true;
> +                       else
> +                               info->uses_bindless_image_atomic = true;
>
> -                               if
> (glsl_get_sampler_dim(image_deref->type) == GLSL_SAMPLER_DIM_BUF)
> -                                       info->uses_bindless_buffer_store =
> true;
> -                               else
> -                                       info->uses_bindless_image_store =
> true;
> -                       }
>                         info->writes_memory = true;
>                         break;
> -               }
>                 case nir_intrinsic_image_deref_atomic_add:
>                 case nir_intrinsic_image_deref_atomic_min:
>                 case nir_intrinsic_image_deref_atomic_max:
> @@ -221,19 +230,9 @@ static void scan_instruction(const struct nir_shader
> *nir,
>                 case nir_intrinsic_image_deref_atomic_or:
>                 case nir_intrinsic_image_deref_atomic_xor:
>                 case nir_intrinsic_image_deref_atomic_exchange:
> -               case nir_intrinsic_image_deref_atomic_comp_swap: {
> -                       nir_variable *var = intrinsic_get_var(intr);
> -                       if (var->data.bindless) {
> -                               info->uses_bindless_images = true;
> -
> -                               if (glsl_get_sampler_dim(var->type) ==
> GLSL_SAMPLER_DIM_BUF)
> -                                       info->uses_bindless_buffer_atomic
> = true;
> -                               else
> -                                       info->uses_bindless_image_atomic =
> true;
> -                       }
> +               case nir_intrinsic_image_deref_atomic_comp_swap:
>                         info->writes_memory = true;
>                         break;
> -               }
>                 case nir_intrinsic_store_ssbo:
>                 case nir_intrinsic_ssbo_atomic_add:
>                 case nir_intrinsic_ssbo_atomic_imin:
> --
> 2.20.1
>
> _______________________________________________
> 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/20190416/0f90c8e9/attachment.html>


More information about the mesa-dev mailing list