nir/spirv: implement BuiltInWorkDim
authorRob Clark <robdclark@gmail.com>
Thu, 8 Mar 2018 19:18:59 +0000 (14:18 -0500)
committerKarol Herbst <kherbst@redhat.com>
Sun, 15 Jul 2018 05:51:13 +0000 (07:51 +0200)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
src/compiler/nir/nir.c
src/compiler/nir/nir_intrinsics.py
src/compiler/shader_enums.c
src/compiler/shader_enums.h
src/compiler/spirv/vtn_variables.c

index c515a30b626dab2afc71cea8a43eb4b8403a52c3..ca89a46f7d4a506c7a07b508b46f1cf9d8abc62e 100644 (file)
@@ -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");
    }
index 919aa609f8afc3db09d08beea794ecf9a4fe8298..1a03a6aa30f5b950463fa44bceead7aa5003fb62 100644 (file)
@@ -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)
index 4eade256604e9bffff5112e15ffdd49f75606d84..a874083a0b702400750fb2870d82bb7798eec928 100644 (file)
@@ -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),
index 280bf1d2835a687e518c59aa89ef5b190e340ae9..f8e22925f354753a57058973d4ed65da351ab020 100644 (file)
@@ -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 */
index 67b4d59b9fe2add77fd9fd377585caf370ecf582..6bd7aa1b0d5f0f77931a009dab579cc32c9b672d 100644 (file)
@@ -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);