VKALLOCATECOMMANDBUF(3)

NAME
vkAllocateCommandBuffers - Allocate command buffers from an existing command pool

C SPECIFICATION

    VkResult vkAllocateCommandBuffers(
        VkDevice                                    device,
        const VkCommandBufferAllocateInfo*          pAllocateInfo,
        VkCommandBuffer*                            pCommandBuffers);

PARAMETERS

device
    A handle to the device that owns the pool from which the command buffers are to be allocated.

pAllocateInfo
    A pointer to a structure containing information about the command buffers to be allocated.

pCommandBuffers
    A pointer to an array of VkCommandBuffer handles that will be filled with the newly allocated command buffers.

DESCRIPTION

vkAllocateCommandBuffers allocates command buffers from an existing command pool. pAllocateInfo is a pointer to an instance of the VkCommandBufferAllocateInfo structure which describes the command buffer allocation. The definition of VkCommandBufferAllocateInfo is:

    typedef struct VkCommandBufferAllocateInfo {
        VkStructureType         sType;
        const void*             pNext;
        VkCommandPool           commandPool;
        VkCommandBufferLevel    level;
        uint32_t                commandBufferCount;
    } VkCommandBufferAllocateInfo;

In pAllocateInfo, sType must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO and, unless an extension is in use, pNext must be NULL. commandPool is a handle to the command pool from which the command buffer should be allocated, and this must be a command pool that is owned by the device whose handle is passed in device. The level field indicates the level of the command buffer (primary or secondary) and must be a member of the VkCommandBufferLevel enumeration. The number of command buffers to allocate is given by commandBufferCount.

On success, commandBufferCount new command buffers are returned in the array pointed to by pCommandBuffers. Command buffers allocated with vkAllocateCommandBuffers must be freed using vkFreeCommandBuffers.

VALID USAGE

    • device must be a valid VkDevice handle

    • pAllocateInfo must be a pointer to a valid VkCommandBufferAllocateInfo structure

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

HOST SYNCHRONIZATION

    • Host access to pAllocateInfo→commandPool must be externally synchronized

RETURN CODES

On success, this command returns

        • VK_SUCCESS

On failure, this command returns

        • VK_ERROR_OUT_OF_HOST_MEMORY

        • VK_ERROR_OUT_OF_DEVICE_MEMORY

SEE ALSO

vkCreateCommandPool, vkDestroyCommandPool, vkFreeCommandBuffers

COPYRIGHT

Copyright © 2014-2016 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.

AUTHOR

Khronos Group
    Author.