Function Prototype

vkAllocateCommandBuffers

Allocate command buffers from an existing command pool

To allocate command buffers, call:

VkResult vkAllocateCommandBuffers(
    VkDevice device,
    const VkCommandBufferAllocateInfo* pAllocateInfo,
    VkCommandBuffer* pCommandBuffers);
  • device is the logical device that owns the command pool.
  • pAllocateInfo is a pointer to a VkCommandBufferAllocateInfo structure describing parameters of the allocation.
  • pCommandBuffers is a pointer to an array of VkCommandBuffer handles in which the resulting command buffer objects are returned. The array must be at least the length specified by the commandBufferCount member of pAllocateInfo. Each allocated command buffer begins in the initial state.

vkAllocateCommandBuffers can be used to allocate multiple command buffers. If the allocation of any of those command buffers fails, the implementation must free all successfully allocated command buffer objects from this command, set all entries of the pCommandBuffers array to NULL and return the error.

Filling pCommandBuffers with NULL values on failure is an exception to the default error behavior that output parameters will have undefined: contents.

When command buffers are first allocated, they are in the initial state.

Valid Usage (Implicit)

VUID-vkAllocateCommandBuffers-pAllocateInfo-parameter

pAllocateInfo must be a valid pointer to a valid VkCommandBufferAllocateInfo structure

VUID-vkAllocateCommandBuffers-pCommandBuffers-parameter

pCommandBuffers must be a valid pointer to an array of pAllocateInfo→commandBufferCount VkCommandBuffer handles

VUID-vkAllocateCommandBuffers-pAllocateInfo::commandBufferCount-arraylength

pAllocateInfo→commandBufferCount must be greater than 0

Host Synchronization

  • Host access to pAllocateInfo→commandPool must be externally synchronized ::