SPIR-V Built-In
SubgroupLocalInvocationId
ID of the invocation within a subgroup
SubgroupLocalInvocationId
Decorating a variable with the SubgroupLocalInvocationId builtin
decoration will make that variable contain the index of the invocation
within the subgroup.
This variable is in range [0,SubgroupSize-1].
There is no direct relationship between
SubgroupLocalInvocationId and
LocalInvocationId or LocalInvocationIndex.
If the shader was created with full subgroups,
applications can compute their own local invocation index to serve the same
purpose:index = SubgroupLocalInvocationId + SubgroupId ×
SubgroupSizeIf full subgroups are not enabled, some subgroups may be dispatched with
inactive invocations that do not correspond to a local workgroup invocation,
making the value of index unreliable.Valid Usage
VUID-SubgroupLocalInvocationId-SubgroupLocalInvocationId-04380
The variable decorated with SubgroupLocalInvocationId must be
declared using the Input Storage Class
VUID-SubgroupLocalInvocationId-SubgroupLocalInvocationId-04381
The variable decorated with SubgroupLocalInvocationId must be
declared as a scalar 32-bit integer value