nir: Add global invocation id intrinsic.
authorPlamena Manolova <plamena.manolova@intel.com>
Fri, 25 May 2018 21:49:47 +0000 (22:49 +0100)
committerPlamena Manolova <plamena.n.manolova@gmail.com>
Thu, 7 Jun 2018 13:53:12 +0000 (14:53 +0100)
Add the missing nir intrinsic for the gl_GlobalInvocationID
compute shader variable.

Signed-off-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/compiler/nir/nir.c
src/compiler/nir/nir_intrinsics.py

index dc1c560319e03c68ae8f51c96107062a0a71f120..36a79f57ee525d1bf5b3824688e7d96e7d86ed96 100644 (file)
@@ -2051,6 +2051,8 @@ nir_intrinsic_from_system_value(gl_system_value val)
       return nir_intrinsic_load_subgroup_id;
    case SYSTEM_VALUE_LOCAL_GROUP_SIZE:
       return nir_intrinsic_load_local_group_size;
+   case SYSTEM_VALUE_GLOBAL_INVOCATION_ID:
+      return nir_intrinsic_load_global_invocation_id;
    default:
       unreachable("system value does not directly correspond to intrinsic");
    }
@@ -2130,6 +2132,8 @@ nir_system_value_from_intrinsic(nir_intrinsic_op intrin)
       return SYSTEM_VALUE_SUBGROUP_ID;
    case nir_intrinsic_load_local_group_size:
       return SYSTEM_VALUE_LOCAL_GROUP_SIZE;
+   case nir_intrinsic_load_global_invocation_id:
+      return SYSTEM_VALUE_GLOBAL_INVOCATION_ID;
    default:
       unreachable("intrinsic doesn't produce a system value");
    }
index ac8a67f44bb9fb69b2711596c51c8bee49087fa1..484b2d4fd6820013d1ed04a96faf395f81a5c5ef 100644 (file)
@@ -449,6 +449,7 @@ system_value("subgroup_lt_mask", 0)
 system_value("num_subgroups", 1)
 system_value("subgroup_id", 1)
 system_value("local_group_size", 3)
+system_value("global_invocation_id", 3)
 
 # Blend constant color values.  Float values are clamped.#
 system_value("blend_const_color_r_float", 1)