diff options
author | Jason Ekstrand <[email protected]> | 2017-09-30 14:50:40 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-03-07 12:13:47 -0800 |
commit | 752e9697030389e5b09553d55f9c4fc68edf08a2 (patch) | |
tree | 4215327bffba6e63fda9c056a8b707cf33b176c3 /src/compiler | |
parent | 34c60ea02bdcb5ebea1459b71bc94eea3b7b6ac3 (diff) |
compiler: Add two new system values for subgroups
This will be required for SPIR-V subgroup support
Reviewed-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/nir.c | 8 | ||||
-rw-r--r-- | src/compiler/nir/nir_intrinsics.h | 1 | ||||
-rw-r--r-- | src/compiler/shader_enums.c | 2 | ||||
-rw-r--r-- | src/compiler/shader_enums.h | 8 |
4 files changed, 19 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index bdd8960403c..f5fd1dc586b 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -1969,6 +1969,10 @@ nir_intrinsic_from_system_value(gl_system_value val) return nir_intrinsic_load_subgroup_le_mask; case SYSTEM_VALUE_SUBGROUP_LT_MASK: return nir_intrinsic_load_subgroup_lt_mask; + case SYSTEM_VALUE_NUM_SUBGROUPS: + return nir_intrinsic_load_num_subgroups; + case SYSTEM_VALUE_SUBGROUP_ID: + return nir_intrinsic_load_subgroup_id; case SYSTEM_VALUE_LOCAL_GROUP_SIZE: return nir_intrinsic_load_local_group_size; default: @@ -2040,6 +2044,10 @@ nir_system_value_from_intrinsic(nir_intrinsic_op intrin) return SYSTEM_VALUE_SUBGROUP_LE_MASK; case nir_intrinsic_load_subgroup_lt_mask: return SYSTEM_VALUE_SUBGROUP_LT_MASK; + case nir_intrinsic_load_num_subgroups: + return SYSTEM_VALUE_NUM_SUBGROUPS; + case nir_intrinsic_load_subgroup_id: + return SYSTEM_VALUE_SUBGROUP_ID; case nir_intrinsic_load_local_group_size: return SYSTEM_VALUE_LOCAL_GROUP_SIZE; default: diff --git a/src/compiler/nir/nir_intrinsics.h b/src/compiler/nir/nir_intrinsics.h index b8a67355900..1a816b46792 100644 --- a/src/compiler/nir/nir_intrinsics.h +++ b/src/compiler/nir/nir_intrinsics.h @@ -381,6 +381,7 @@ SYSTEM_VALUE(subgroup_ge_mask, 0, 0, xx, xx, xx) SYSTEM_VALUE(subgroup_gt_mask, 0, 0, xx, xx, xx) SYSTEM_VALUE(subgroup_le_mask, 0, 0, xx, xx, xx) SYSTEM_VALUE(subgroup_lt_mask, 0, 0, xx, xx, xx) +SYSTEM_VALUE(num_subgroups, 1, 0, xx, xx, xx) SYSTEM_VALUE(subgroup_id, 1, 0, xx, xx, xx) SYSTEM_VALUE(local_group_size, 3, 0, xx, xx, xx) diff --git a/src/compiler/shader_enums.c b/src/compiler/shader_enums.c index 62c1ac1f073..d0ff11b41e2 100644 --- a/src/compiler/shader_enums.c +++ b/src/compiler/shader_enums.c @@ -210,6 +210,8 @@ gl_system_value_name(gl_system_value sysval) ENUM(SYSTEM_VALUE_SUBGROUP_GT_MASK), ENUM(SYSTEM_VALUE_SUBGROUP_LE_MASK), ENUM(SYSTEM_VALUE_SUBGROUP_LT_MASK), + ENUM(SYSTEM_VALUE_NUM_SUBGROUPS), + ENUM(SYSTEM_VALUE_SUBGROUP_ID), ENUM(SYSTEM_VALUE_VERTEX_ID), ENUM(SYSTEM_VALUE_INSTANCE_ID), ENUM(SYSTEM_VALUE_INSTANCE_INDEX), diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h index 64fb68828ed..2aedbb9b3fa 100644 --- a/src/compiler/shader_enums.h +++ b/src/compiler/shader_enums.h @@ -397,6 +397,14 @@ typedef enum SYSTEM_VALUE_SUBGROUP_LT_MASK, /*@}*/ + /** + * Builtin variables added by VK_KHR_subgroups + */ + /*@{*/ + SYSTEM_VALUE_NUM_SUBGROUPS, + SYSTEM_VALUE_SUBGROUP_ID, + /*@}*/ + /*@}*/ /** |