[Mesa-dev] [PATCH 2/6] nir/spirv: implement BuiltInWorkDim
Jason Ekstrand
jason at jlekstrand.net
Sat Jul 14 20:18:14 UTC 2018
What is WorkDim? how is it different from the global and/or local
workgroup dimensions?
On Thu, Jul 12, 2018 at 4:30 AM Karol Herbst <kherbst at redhat.com> wrote:
> From: Rob Clark <robdclark at gmail.com>
>
> Signed-off-by: Karol Herbst <kherbst at redhat.com>
> ---
> src/compiler/nir/nir.c | 2 ++
> src/compiler/nir/nir_intrinsics.py | 1 +
> src/compiler/shader_enums.c | 1 +
> src/compiler/shader_enums.h | 1 +
> src/compiler/spirv/vtn_variables.c | 4 ++++
> 5 files changed, 9 insertions(+)
>
> diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
> index c515a30b626..ca89a46f7d4 100644
> --- a/src/compiler/nir/nir.c
> +++ b/src/compiler/nir/nir.c
> @@ -1758,6 +1758,8 @@ nir_intrinsic_from_system_value(gl_system_value val)
> return nir_intrinsic_load_local_group_size;
> case SYSTEM_VALUE_GLOBAL_INVOCATION_ID:
> return nir_intrinsic_load_global_invocation_id;
> + case SYSTEM_VALUE_WORK_DIM:
> + return nir_intrinsic_load_work_dim;
> default:
> unreachable("system value does not directly correspond to
> intrinsic");
> }
> diff --git a/src/compiler/nir/nir_intrinsics.py
> b/src/compiler/nir/nir_intrinsics.py
> index 919aa609f8a..1a03a6aa30f 100644
> --- a/src/compiler/nir/nir_intrinsics.py
> +++ b/src/compiler/nir/nir_intrinsics.py
> @@ -452,6 +452,7 @@ system_value("num_subgroups", 1)
> system_value("subgroup_id", 1)
> system_value("local_group_size", 3)
> system_value("global_invocation_id", 3)
> +system_value("work_dim", 1)
>
> # Blend constant color values. Float values are clamped.#
> system_value("blend_const_color_r_float", 1)
> diff --git a/src/compiler/shader_enums.c b/src/compiler/shader_enums.c
> index 4eade256604..a874083a0b7 100644
> --- a/src/compiler/shader_enums.c
> +++ b/src/compiler/shader_enums.c
> @@ -240,6 +240,7 @@ gl_system_value_name(gl_system_value sysval)
> ENUM(SYSTEM_VALUE_NUM_WORK_GROUPS),
> ENUM(SYSTEM_VALUE_LOCAL_GROUP_SIZE),
> ENUM(SYSTEM_VALUE_GLOBAL_GROUP_SIZE),
> + ENUM(SYSTEM_VALUE_WORK_DIM),
> ENUM(SYSTEM_VALUE_DEVICE_INDEX),
> ENUM(SYSTEM_VALUE_VIEW_INDEX),
> ENUM(SYSTEM_VALUE_VERTEX_CNT),
> diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h
> index 280bf1d2835..f8e22925f35 100644
> --- a/src/compiler/shader_enums.h
> +++ b/src/compiler/shader_enums.h
> @@ -586,6 +586,7 @@ typedef enum
> SYSTEM_VALUE_NUM_WORK_GROUPS,
> SYSTEM_VALUE_LOCAL_GROUP_SIZE,
> SYSTEM_VALUE_GLOBAL_GROUP_SIZE,
> + SYSTEM_VALUE_WORK_DIM,
> /*@}*/
>
> /** Required for VK_KHR_device_group */
> diff --git a/src/compiler/spirv/vtn_variables.c
> b/src/compiler/spirv/vtn_variables.c
> index 67b4d59b9fe..6bd7aa1b0d5 100644
> --- a/src/compiler/spirv/vtn_variables.c
> +++ b/src/compiler/spirv/vtn_variables.c
> @@ -1208,6 +1208,10 @@ vtn_get_builtin_location(struct vtn_builder *b,
> *location = FRAG_RESULT_STENCIL;
> vtn_assert(*mode == nir_var_shader_out);
> break;
> + case SpvBuiltInWorkDim:
> + *location = SYSTEM_VALUE_WORK_DIM;
> + set_mode_system_value(b, mode);
> + break;
> case SpvBuiltInGlobalSize:
> *location = SYSTEM_VALUE_GLOBAL_GROUP_SIZE;
> set_mode_system_value(b, mode);
> --
> 2.17.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/20180714/5c661334/attachment.html>
More information about the mesa-dev
mailing list