Creating a command pool
Command pools are objects from which command buffers acquire their memory. Memory itself is allocated implicitly and dynamically, but without it command buffers wouldn't have any storage space to hold the recorded commands. That's why, before we can allocate command buffers, we first need to create a memory pool for them.
How to do it...
- Create a variable of type
VkDevice
namedlogical_device
and initialize it with a handle of a created logical device.
- Take the index of one of the queue families requested for the logical device. Store this index in a variable of type
uint32_t
namedqueue_family
. - Create a variable of type
VkCommandPoolCreateInfo
namedcommand_pool_create_info
. Use the following values for the members of this variable:VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO
value forsType
nullptr
value forpNext
- Bit field indicating selected parameters of type
VkCommandPoolCreateFlags
forflags
queue_family
variable forqueueFamilyIndex
- Create a variable of type
VkCommandPool...