C Specification
Alternatively, to bind vertex buffers, along with their sizes and strides, to a command buffer for use in subsequent drawing commands, call:
// Provided by VK_VERSION_1_3
void vkCmdBindVertexBuffers2(
VkCommandBuffer commandBuffer,
uint32_t firstBinding,
uint32_t bindingCount,
const VkBuffer* pBuffers,
const VkDeviceSize* pOffsets,
const VkDeviceSize* pSizes,
const VkDeviceSize* pStrides);
or the equivalent command
// Provided by VK_EXT_extended_dynamic_state, VK_EXT_shader_object
void vkCmdBindVertexBuffers2EXT(
VkCommandBuffer commandBuffer,
uint32_t firstBinding,
uint32_t bindingCount,
const VkBuffer* pBuffers,
const VkDeviceSize* pOffsets,
const VkDeviceSize* pSizes,
const VkDeviceSize* pStrides);
Parameters
-
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. -
pBuffers
is a pointer to an array of buffer handles. -
pOffsets
is a pointer to an array of buffer offsets. -
pSizes
isNULL
or a pointer to an array of the size in bytes of vertex data bound frompBuffers
. -
pStrides
isNULL
or a pointer to an array of buffer strides.
Description
The values taken from elements i of pBuffers
and pOffsets
replace the current state for the vertex input binding
firstBinding
+ i, for i in [0,
bindingCount
).
The vertex input binding is updated to start at the offset indicated by
pOffsets
[i] from the start of the buffer pBuffers
[i].
If pSizes
is not NULL
then pSizes
[i] specifies the bound size
of the vertex buffer starting from the corresponding elements of
pBuffers
[i] plus pOffsets
[i].
If pSizes
[i] is VK_WHOLE_SIZE
then the bound size is from
pBuffers
[i] plus pOffsets
[i] to the end of the buffer
pBuffers
[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 pBuffers
can be VK_NULL_HANDLE, and can be used by
the vertex shader.
If a vertex input attribute is bound to a vertex input binding that is
VK_NULL_HANDLE, 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 buffer pBuffers
[i] to the
corresponding pStrides
[i] value
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.
Note
Unlike the static state to set the same, |
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.