Allocating command buffers
Command buffers are used to store (record) commands that are later submitted to queues, where they are executed and processed by the hardware to give us results. When we have created a command pool, we can use it to allocate command buffers.
How to do it...
- Take the handle of a created logical device and store it in a variable of type
VkDevicenamedlogical_device. - Take the handle of a command pool and use it to initialize a variable of type
VkCommandPoolnamedcommand_pool. - Create a variable of type
VkCommandBufferAllocateInfonamedcommand_buffer_allocate_infoand use the following values for its members:VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFOvalue forsTypenullptrvalue forpNextcommand_poolvariable forcommandPoolVK_COMMAND_BUFFER_LEVEL_PRIMARYvalue or aVK_COMMAND_BUFFER_LEVEL_SECONDARYvalue forlevel- The number of command buffers we want to allocate for
commandBufferCount
- Create a vector of type
std::vector<VkCommandBuffer>namedcommand_buffers...