SPIR-V Built-In

ViewIndex

View index of a shader invocation
ViewIndex

The ViewIndex decoration can be applied to a shader input which will be filled with the index of the view that is being processed by the current shader invocation.

If multiview is enabled in the render pass, this value will be the index of one of the bits set in the view mask of the subpass the pipeline is compiled against. If multiview is not enabled in the render pass, this value will be zero.

Valid Usage

VUID-ViewIndex-ViewIndex-04401

The ViewIndex decoration must be used only within the MeshEXT, Vertex, Geometry, TessellationControl, TessellationEvaluation or Fragment Execution Model

VUID-ViewIndex-ViewIndex-04402

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

VUID-ViewIndex-ViewIndex-04403

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