[Mesa-dev] [PATCH 02/10] compiler: add new system values for SPV_KHR_shader_ballot

Connor Abbott connora at valvesoftware.com
Tue Aug 1 02:24:09 UTC 2017


From: Connor Abbott <cwabbott0 at gmail.com>

For SPIR-V, Khronos decided to make the SubGroup*Mask system values
consist of 4 32-bit components rather than one 64-bit component.
Although we'll lower away the difference in nir_lower_system_values so
drivers won't have to deal with them, adding these system values makes
it easier to implement the SPIRV-to-NIR bits.
---
 src/compiler/shader_enums.c |  5 +++++
 src/compiler/shader_enums.h | 11 +++++++++++
 2 files changed, 16 insertions(+)

diff --git a/src/compiler/shader_enums.c b/src/compiler/shader_enums.c
index b2ca80b..571a43e 100644
--- a/src/compiler/shader_enums.c
+++ b/src/compiler/shader_enums.c
@@ -211,6 +211,11 @@ 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_SUBGROUP_EQ_MASK_32BIT),
+     ENUM(SYSTEM_VALUE_SUBGROUP_GE_MASK_32BIT),
+     ENUM(SYSTEM_VALUE_SUBGROUP_GT_MASK_32BIT),
+     ENUM(SYSTEM_VALUE_SUBGROUP_LE_MASK_32BIT),
+     ENUM(SYSTEM_VALUE_SUBGROUP_LT_MASK_32BIT),
      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 2f20e68..c73b382 100644
--- a/src/compiler/shader_enums.h
+++ b/src/compiler/shader_enums.h
@@ -374,6 +374,17 @@ typedef enum
    SYSTEM_VALUE_SUBGROUP_GT_MASK,
    SYSTEM_VALUE_SUBGROUP_LE_MASK,
    SYSTEM_VALUE_SUBGROUP_LT_MASK,
+
+   /**
+    * These are the same as system values above, except that they consist of 4
+    * 32-bit components rather than 1 64-bit component. This matches the
+    * semantics of the SPIR-V KHR_shader_ballot extension.
+    */
+   SYSTEM_VALUE_SUBGROUP_EQ_MASK_32BIT,
+   SYSTEM_VALUE_SUBGROUP_GE_MASK_32BIT,
+   SYSTEM_VALUE_SUBGROUP_GT_MASK_32BIT,
+   SYSTEM_VALUE_SUBGROUP_LE_MASK_32BIT,
+   SYSTEM_VALUE_SUBGROUP_LT_MASK_32BIT,
    /*@}*/
 
    /*@}*/
-- 
2.9.4



More information about the mesa-dev mailing list