[Mesa-dev] [PATCH 1/3] amd/common: scan which components of gl_WorkGroupID are used

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Thu Dec 14 19:32:54 UTC 2017


On Thu, Dec 14, 2017 at 4:48 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/amd/common/ac_shader_info.c | 8 ++++++++
>  src/amd/common/ac_shader_info.h | 1 +
>  2 files changed, 9 insertions(+)
>
> diff --git a/src/amd/common/ac_shader_info.c b/src/amd/common/ac_shader_info.c
> index 09dd4bbd55..01949770d6 100644
> --- a/src/amd/common/ac_shader_info.c
> +++ b/src/amd/common/ac_shader_info.c
> @@ -45,6 +45,14 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, struct ac_shader_info *info)
>         case nir_intrinsic_load_num_work_groups:
>                 info->cs.uses_grid_size = true;
>                 break;
> +       case nir_intrinsic_load_work_group_id: {
> +               unsigned mask = nir_ssa_def_components_read(&instr->dest.ssa);

Nice find that there is an utility function for this.

Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
> +               while (mask) {
> +                       unsigned i = u_bit_scan(&mask);
> +                       info->cs.uses_block_id[i] = true;
> +               }
> +               break;
> +       }
>         case nir_intrinsic_load_sample_id:
>                 info->ps.force_persample = true;
>                 break;
> diff --git a/src/amd/common/ac_shader_info.h b/src/amd/common/ac_shader_info.h
> index 3c809cce13..7beefd02ac 100644
> --- a/src/amd/common/ac_shader_info.h
> +++ b/src/amd/common/ac_shader_info.h
> @@ -43,6 +43,7 @@ struct ac_shader_info {
>         } ps;
>         struct {
>                 bool uses_grid_size;
> +               bool uses_block_id[3];
>         } cs;
>  };
>
> --
> 2.15.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list