C Specification

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

// Provided by VK_VERSION_1_0
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 the size of the indices.

Description

Valid Usage
  • VUID-vkCmdBindIndexBuffer-offset-08782
    offset must be less than the size of buffer

  • VUID-vkCmdBindIndexBuffer-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-vkCmdBindIndexBuffer-buffer-08784
    buffer must have been created with the VK_BUFFER_USAGE_INDEX_BUFFER_BIT flag

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

  • VUID-vkCmdBindIndexBuffer-indexType-08787
    If indexType is VK_INDEX_TYPE_UINT8_EXT, the indexTypeUint8 feature must be enabled

Valid Usage (Implicit)
  • VUID-vkCmdBindIndexBuffer-commandBuffer-parameter
    commandBuffer must be a valid VkCommandBuffer handle

  • VUID-vkCmdBindIndexBuffer-buffer-parameter
    buffer must be a valid VkBuffer handle

  • VUID-vkCmdBindIndexBuffer-indexType-parameter
    indexType must be a valid VkIndexType value

  • VUID-vkCmdBindIndexBuffer-commandBuffer-recording
    commandBuffer must be in the recording state

  • VUID-vkCmdBindIndexBuffer-commandBuffer-cmdpool
    The VkCommandPool that commandBuffer was allocated from must support graphics operations

  • VUID-vkCmdBindIndexBuffer-commonparent
    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 Command Type

Primary
Secondary

Both

Graphics

State

See Also

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 2014-2023 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0