VertexIndex
VertexIndex
Decorating a variable with the VertexIndex
built-in decoration will
make that variable contain the index of the vertex that is being processed
by the current vertex shader invocation.
For non-indexed draws, this variable begins at the firstVertex
parameter to vkCmdDraw or the firstVertex
member of a structure
consumed by vkCmdDrawIndirect and increments by one for each vertex in
the draw.
For indexed draws, its value is the content of the index buffer for the
vertex plus the vertexOffset
parameter to vkCmdDrawIndexed or
the vertexOffset
member of the structure consumed by
vkCmdDrawIndexedIndirect.
VertexIndex
starts at the same starting value for each instance.
Valid Usage
VUID-VertexIndex-VertexIndex-04398
The VertexIndex
decoration must be used only within the
Vertex
Execution
Model
VUID-VertexIndex-VertexIndex-04399
The variable decorated with VertexIndex
must be declared using the
Input
Storage
Class
VUID-VertexIndex-VertexIndex-04400
The variable decorated with VertexIndex
must be declared as a
scalar 32-bit integer value