vkCmdBindIndexBuffer2(3)

# vkCmdBindIndexBuffer2(3) Manual Page

## Name

vkCmdBindIndexBuffer2 - Bind an index buffer to a command buffer

Loading… please wait.

## C Specification

To bind an index buffer, along with its size, to a command buffer, call:

    // Provided by VK_VERSION_1_4
    void vkCmdBindIndexBuffer2(
        VkCommandBuffer                             commandBuffer,
        VkBuffer                                    buffer,
        VkDeviceSize                                offset,
        VkDeviceSize                                size,
        VkIndexType                                 indexType);

or the equivalent command

    // Provided by VK_KHR_maintenance5
    void vkCmdBindIndexBuffer2KHR(
        VkCommandBuffer                             commandBuffer,
        VkBuffer                                    buffer,
        VkDeviceSize                                offset,
        VkDeviceSize                                size,
        VkIndexType                                 indexType);

## Parameters

- `commandBuffer` is the command buffer into which the command is recorded.

- `buffer` is the buffer being bound.

- `offset` is the starting offset in bytes within `buffer` used in index buffer address calculations.

- `size` is the size in bytes of index data bound from `buffer`.

- `indexType` is a VkIndexType value specifying the size of the indices.

## Description

`size` specifies the bound size of the index buffer starting from `offset`. If `size` is `VK_WHOLE_SIZE` then the bound size is from `offset` to the end of the `buffer`.

If the `maintenance6` feature is enabled, `buffer` can be VK_NULL_HANDLE. If `buffer` is VK_NULL_HANDLE and the `nullDescriptor` feature is enabled, every index fetched results in a value of zero.

Valid Usage

- VUID-vkCmdBindIndexBuffer2-offset-08782
  `offset` must be less than the size of `buffer`

- VUID-vkCmdBindIndexBuffer2-offset-08783
  The sum of `offset` and the base address of the range of `VkDeviceMemory` object that is backing `buffer`, must be a multiple of the size of the type indicated by `indexType`

- VUID-vkCmdBindIndexBuffer2-buffer-08784
  `buffer` must have been created with the `VK_BUFFER_USAGE_INDEX_BUFFER_BIT` flag

- VUID-vkCmdBindIndexBuffer2-buffer-08785
  If `buffer` is non-sparse then it must be bound completely and contiguously to a single `VkDeviceMemory` object

- VUID-vkCmdBindIndexBuffer2-indexType-08786
  `indexType` must not be `VK_INDEX_TYPE_NONE_KHR`

- VUID-vkCmdBindIndexBuffer2-indexType-08787
  If `indexType` is `VK_INDEX_TYPE_UINT8`, the `indexTypeUint8` feature must be enabled

- VUID-vkCmdBindIndexBuffer2-None-09493
  If the `maintenance6` feature is not enabled, `buffer` must not be VK_NULL_HANDLE

- VUID-vkCmdBindIndexBuffer2-buffer-09494
  If `buffer` is VK_NULL_HANDLE, offset must be zero

- VUID-vkCmdBindIndexBuffer2-size-08767
  If `size` is not `VK_WHOLE_SIZE`, `size` must be a multiple of the size of the type indicated by `indexType`

- VUID-vkCmdBindIndexBuffer2-size-08768
  If `size` is not `VK_WHOLE_SIZE`, the sum of `offset` and `size` must be less than or equal to the size of `buffer`

Valid Usage (Implicit)

- VUID-vkCmdBindIndexBuffer2-commandBuffer-parameter
  `commandBuffer` must be a valid VkCommandBuffer handle

- VUID-vkCmdBindIndexBuffer2-buffer-parameter
  If `buffer` is not VK_NULL_HANDLE, `buffer` must be a valid VkBuffer handle

- VUID-vkCmdBindIndexBuffer2-indexType-parameter
  `indexType` must be a valid VkIndexType value

- VUID-vkCmdBindIndexBuffer2-commandBuffer-recording
  `commandBuffer` must be in the recording state

- VUID-vkCmdBindIndexBuffer2-commandBuffer-cmdpool
  The `VkCommandPool` that `commandBuffer` was allocated from must support graphics operations

- VUID-vkCmdBindIndexBuffer2-videocoding
  This command must only be called outside of a video coding scope

- VUID-vkCmdBindIndexBuffer2-commonparent
  Both of `buffer`, and `commandBuffer` that are valid handles of non-ignored parameters must have been created, allocated, or retrieved from the same VkDevice

Host Synchronization

- Host access to `commandBuffer` must be externally synchronized

- Host access to the `VkCommandPool` that `commandBuffer` was allocated from must be externally synchronized

Command Properties

Command Buffer Levels | Render Pass Scope | Video Coding Scope | Supported Queue Types | Command Type
--- | --- | --- | --- | ---
Primary Secondary | Both | Outside | Graphics | State

## See Also

VK_KHR_maintenance5, VK_VERSION_1_4, VkBuffer, VkCommandBuffer, VkDeviceSize, VkIndexType

## 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