diff options
-rw-r--r-- | src/compiler/nir/nir_lower_system_values.c | 7 | ||||
-rw-r--r-- | src/compiler/shader_enums.c | 1 | ||||
-rw-r--r-- | src/compiler/shader_enums.h | 1 | ||||
-rw-r--r-- | src/compiler/spirv/vtn_variables.c | 4 |
4 files changed, 13 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c index e8367981a5f..da04895d66c 100644 --- a/src/compiler/nir/nir_lower_system_values.c +++ b/src/compiler/nir/nir_lower_system_values.c @@ -171,6 +171,13 @@ convert_block(nir_block *block, nir_builder *b) sysval = nir_imm_int(b, 0); break; + case SYSTEM_VALUE_GLOBAL_GROUP_SIZE: { + nir_ssa_def *group_size = build_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 0f3b1acae7a..4eade256604 100644 --- a/src/compiler/shader_enums.c +++ b/src/compiler/shader_enums.c @@ -239,6 +239,7 @@ gl_system_value_name(gl_system_value sysval) ENUM(SYSTEM_VALUE_WORK_GROUP_ID), ENUM(SYSTEM_VALUE_NUM_WORK_GROUPS), ENUM(SYSTEM_VALUE_LOCAL_GROUP_SIZE), + ENUM(SYSTEM_VALUE_GLOBAL_GROUP_SIZE), 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 1ef4d5a33d0..280bf1d2835 100644 --- a/src/compiler/shader_enums.h +++ b/src/compiler/shader_enums.h @@ -585,6 +585,7 @@ typedef enum SYSTEM_VALUE_WORK_GROUP_ID, SYSTEM_VALUE_NUM_WORK_GROUPS, SYSTEM_VALUE_LOCAL_GROUP_SIZE, + SYSTEM_VALUE_GLOBAL_GROUP_SIZE, /*@}*/ /** Required for VK_KHR_device_group */ diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index b7c9e6f2f70..c86416495b6 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 SpvBuiltInGlobalSize: + *location = SYSTEM_VALUE_GLOBAL_GROUP_SIZE; + set_mode_system_value(b, mode); + break; default: vtn_fail("unsupported builtin"); } |