# vkCmdBindIndexBuffer(3) Manual Page

## Name

vkCmdBindIndexBuffer - Bind an index buffer to a command buffer

## C Specification

To bind an index buffer to a command buffer, call:

    void vkCmdBindIndexBuffer(
        VkCommandBuffer                             commandBuffer,
        VkBuffer                                    buffer,
        VkDeviceSize                                offset,
        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.

- `indexType` is a VkIndexType value specifying whether indices are treated as 16 bits or 32 bits.

## Description

Valid Usage

- `offset` must be less than the size of `buffer`

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

- `buffer` must have been created with the `VK_BUFFER_USAGE_INDEX_BUFFER_BIT` flag

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

- `indexType` must not be `VK_INDEX_TYPE_NONE_KHR`.

- If `indexType` is `VK_INDEX_TYPE_UINT8_EXT`, the indexTypeUint8 feature must be enabled

Valid Usage (Implicit)

- `commandBuffer` must be a valid VkCommandBuffer handle

- `buffer` must be a valid VkBuffer handle

- `indexType` must be a valid VkIndexType value

- `commandBuffer` must be in the recording state

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

- Both of `buffer`, and `commandBuffer` 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 | Supported Queue Types | Pipeline Type
--- | --- | --- | ---
Primary Secondary | Both | Graphics |

## See Also

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 (c) 2014-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.