Signed-off-by: Rob Clark <robdcl...@gmail.com> Signed-off-by: Karol Herbst <kher...@redhat.com> --- src/compiler/nir/nir_lower_system_values.c | 8 ++++++++ src/compiler/shader_enums.c | 1 + src/compiler/shader_enums.h | 2 ++ src/compiler/spirv/vtn_variables.c | 4 ++++ 4 files changed, 15 insertions(+)
diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c index fb560ee21b..200b876901 100644 --- a/src/compiler/nir/nir_lower_system_values.c +++ b/src/compiler/nir/nir_lower_system_values.c @@ -138,6 +138,14 @@ convert_block(nir_block *block, nir_builder *b) sysval = nir_imm_int(b, 0); break; + case SYSTEM_VALUE_GLOBAL_SIZE: { + nir_ssa_def *group_size = nir_load_local_group_size(b); + nir_ssa_def *num_work_groups = nir_load_num_work_groups(b); + sysval = nir_imul(b, group_size, num_work_groups); + + break; + } + default: break; } diff --git a/src/compiler/shader_enums.c b/src/compiler/shader_enums.c index d0ff11b41e..37419611b8 100644 --- a/src/compiler/shader_enums.c +++ b/src/compiler/shader_enums.c @@ -237,6 +237,7 @@ gl_system_value_name(gl_system_value sysval) ENUM(SYSTEM_VALUE_DEVICE_INDEX), ENUM(SYSTEM_VALUE_VIEW_INDEX), ENUM(SYSTEM_VALUE_VERTEX_CNT), + ENUM(SYSTEM_VALUE_GLOBAL_SIZE), }; STATIC_ASSERT(ARRAY_SIZE(names) == SYSTEM_VALUE_MAX); return NAME(sysval); diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h index 2aedbb9b3f..f34236f62d 100644 --- a/src/compiler/shader_enums.h +++ b/src/compiler/shader_enums.h @@ -578,6 +578,8 @@ typedef enum */ SYSTEM_VALUE_VERTEX_CNT, + SYSTEM_VALUE_GLOBAL_SIZE, + SYSTEM_VALUE_MAX /**< Number of values */ } gl_system_value; diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index 3ca084801a..f0e876806c 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -1351,6 +1351,10 @@ vtn_get_builtin_location(struct vtn_builder *b, *location = SYSTEM_VALUE_SUBGROUP_LT_MASK, set_mode_system_value(b, mode); break; + case SpvBuiltInGlobalSize: + *location = SYSTEM_VALUE_GLOBAL_SIZE; + set_mode_system_value(b, mode); + break; default: vtn_fail("unsupported builtin"); } -- 2.14.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev