Function Prototype

vkCmdBindVertexBuffers3KHR

Bind strided address ranges as vertex buffers to a command buffer and dynamically set strides

To bind strided address ranges as vertex buffers to a command buffer for use in subsequent drawing commands, call:

void vkCmdBindVertexBuffers3KHR(
    VkCommandBuffer commandBuffer,
    uint32_t                            firstBinding,
    uint32_t                            bindingCount,
    const VkBindVertexBuffer3InfoKHR* pBindingInfos);
  • commandBuffer is the command buffer into which the command is recorded.
  • firstBinding is the index of the first vertex input binding whose state is updated by the command.
  • bindingCount is the number of vertex input bindings whose state is updated by the command.
  • pInfos is a pointer to an array of VkBindVertexBuffer3InfoKHR structures defining address ranges to bind as vertex buffers.

The values taken from the address ranges defined by elements i of pInfos replace the current state for the vertex input binding firstBinding + i, for i in [0, bindingCount). The vertex input binding is updated to the range of memory indicated by pInfos[i]. All vertex input attributes that use each of these bindings will use these updated addresses in their address calculations for subsequent drawing commands. If the nullDescriptor feature is enabled, elements of pInfos can have a addressRange.size and addressRange.address of 0. If a vertex input attribute is bound to a vertex input binding with a size and address of 0, the values taken from memory are considered to be zero, and missing G, B, or A components are filled with (0,0,1).

This command also dynamically sets the byte strides between consecutive elements within the strided range defined by pInfos[i] to the value of pInfos[i].addressRange.stride when drawing using shader objects, or when the graphics pipeline is created with VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, strides are specified by the VkVertexInputBindingDescription::stride values used to create the currently active pipeline.

If drawing using shader objects or if the bound pipeline state object was also created with the VK_DYNAMIC_STATE_VERTEX_INPUT_EXT dynamic state enabled then vkCmdSetVertexInputEXT can be used instead of vkCmdBindVertexBuffers2 to set the stride.

Unlike the static state to set the same, stride for each address range must be between 0 and the maximum extent of the attributes in the binding. vkCmdSetVertexInputEXT does not have this restriction so can be used if other stride values are desired.

Valid Usage

VUID-vkCmdBindVertexBuffers3KHR-firstBinding-13070

firstBinding must be less than VkPhysicalDeviceLimits::maxVertexInputBindings

VUID-vkCmdBindVertexBuffers3KHR-firstBinding-13071

The sum of firstBinding and bindingCount must be less than or equal to VkPhysicalDeviceLimits::maxVertexInputBindings

VUID-vkCmdBindVertexBuffers3KHR-addressRange-13073

The addressRange.stride of all elements of pInfos must be either 0 or greater than or equal to the maximum extent of all vertex input attributes fetched from the corresponding binding, where the extent is calculated as the VkVertexInputAttributeDescription::offset plus VkVertexInputAttributeDescription::format size

Valid Usage (Implicit)

VUID-vkCmdBindVertexBuffers3KHR-pBindingInfos-parameter

pBindingInfos must be a valid pointer to an array of bindingCount valid VkBindVertexBuffer3InfoKHR structures

VUID-vkCmdBindVertexBuffers3KHR-commandBuffer-cmdpool

The VkCommandPool that commandBuffer was allocated from must support VK_QUEUE_GRAPHICS_BIT operations

VUID-vkCmdBindVertexBuffers3KHR-videocoding

This command must only be called outside of a video coding scope

Host Synchronization

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