[Mesa-dev] [Mesa-dev, 2/4] nir: Add gl_WorkGroupID system variable

Kristian Høgsberg krh at bitplanet.net
Thu Sep 10 12:19:21 PDT 2015


Jordan Justen <jordan.l.justen at intel.com> writes:

> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
>
> ---
> src/glsl/nir/nir_intrinsics.h          | 1 +
>  src/glsl/nir/nir_lower_system_values.c | 3 +++
>  2 files changed, 4 insertions(+)
>
> diff --git a/src/glsl/nir/nir_intrinsics.h b/src/glsl/nir/nir_intrinsics.h
> index 29b5e64..6987d42 100644
> --- a/src/glsl/nir/nir_intrinsics.h
> +++ b/src/glsl/nir/nir_intrinsics.h
> @@ -138,6 +138,7 @@ SYSTEM_VALUE(sample_pos, 2)
>  SYSTEM_VALUE(sample_mask_in, 1)
>  SYSTEM_VALUE(invocation_id, 1)
>  SYSTEM_VALUE(local_invocation_id, 3)
> +SYSTEM_VALUE(work_group_id, 3)
>  
>  /*
>   * The first and only index is the base address to load from.  Indirect
> diff --git a/src/glsl/nir/nir_lower_system_values.c b/src/glsl/nir/nir_lower_system_values.c
> index ee375ea..855dff8 100644
> --- a/src/glsl/nir/nir_lower_system_values.c
> +++ b/src/glsl/nir/nir_lower_system_values.c
> @@ -73,6 +73,9 @@ convert_instr(nir_intrinsic_instr *instr)
>     case SYSTEM_VALUE_LOCAL_INVOCATION_ID:
>        op = nir_intrinsic_load_local_invocation_id;
>        break;
> +   case SYSTEM_VALUE_WORK_GROUP_ID:
> +      op = nir_intrinsic_load_work_group_id;
> +      break;
>     default:
>        unreachable("not reached");
>     }

Add nir_intrinsic_load_work_group_id to
nir_system_value_from_intrinsic() (and add local_invocation_id too in
3/7 from the gl_LocalInvocatioID series).

Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>


More information about the mesa-dev mailing list