SPIR-V Built-In

InstanceIndex

Index of an instance
InstanceIndex

Decorating a variable in a vertex shader with the InstanceIndex built-in decoration will make that variable contain the index of the instance that is being processed by the current vertex shader invocation. InstanceIndex begins at the firstInstance parameter to vkCmdDraw or vkCmdDrawIndexed or at the firstInstance member of a structure consumed by vkCmdDrawIndirect or vkCmdDrawIndexedIndirect.

Valid Usage

VUID-InstanceIndex-InstanceIndex-04263

The InstanceIndex decoration must be used only within the Vertex Execution Model

VUID-InstanceIndex-InstanceIndex-04264

The variable decorated with InstanceIndex must be declared using the Input Storage Class

VUID-InstanceIndex-InstanceIndex-04265

The variable decorated with InstanceIndex must be declared as a scalar 32-bit integer value