[Mesa-dev] [PATCH v2 07/18] nir/vtn: handle WorkGroupSize for kernels

Karol Herbst kherbst at redhat.com
Thu Mar 8 15:25:53 UTC 2018


From: Rob Clark <robdclark at gmail.com>

Unlike glsl/vk compute shaders, this isn't a builtin constant.

Signed-off-by: Rob Clark <robdclark at gmail.com>
Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
 src/compiler/spirv/vtn_variables.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index df7edb3915..3ca084801a 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1276,8 +1276,8 @@ vtn_get_builtin_location(struct vtn_builder *b,
       set_mode_system_value(b, mode);
       break;
    case SpvBuiltInWorkgroupSize:
-      /* This should already be handled */
-      vtn_fail("unsupported builtin");
+      *location = SYSTEM_VALUE_LOCAL_GROUP_SIZE;
+      set_mode_system_value(b, mode);
       break;
    case SpvBuiltInWorkgroupId:
       *location = SYSTEM_VALUE_WORK_GROUP_ID;
@@ -1407,7 +1407,7 @@ apply_var_decoration(struct vtn_builder *b, nir_variable *nir_var,
    case SpvDecorationBuiltIn: {
       SpvBuiltIn builtin = dec->literals[0];
 
-      if (builtin == SpvBuiltInWorkgroupSize) {
+      if ((builtin == SpvBuiltInWorkgroupSize) && !b->kernel_mode) {
          /* This shouldn't be a builtin.  It's actually a constant. */
          nir_var->data.mode = nir_var_global;
          nir_var->data.read_only = true;
-- 
2.14.3



More information about the mesa-dev mailing list