Beginning a command buffer recording operation
When we want to perform operations using hardware, we need to record them and submit them to a queue. Commands are recorded into command buffers. So when we want to record them, we need to begin a recording operation of a selected command buffer, effectively setting it in the recording state.
How to do it...
- Take the handle of a command buffer, in which commands should be recorded, and store it in a variable of type
VkCommandBuffer
namedcommand_buffer
. Make sure the command buffer is allocated from a pool with aVK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT
flag set, or that it is in the initial state (it was reset). - Create a variable of a bit field type
VkCommandBufferUsageFlags
namedusage
and set the following bits depending on which conditions are met:- If the command buffer will be submitted only once and then reset or re-recorded, set the
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT
bit.
- If it is the secondary command buffer and is considered...
- If the command buffer will be submitted only once and then reset or re-recorded, set the