# InstanceIndex(3) Manual Page

## Name

InstanceIndex - Index of an instance

Loading… please wait.

## Description

`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

## See Also

No cross-references are available

## Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

## Copyright

Copyright 2014-2025 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0