![]() |
VPP
0.7
A high-level modern C++ API for Vulkan
|
Represents a sequence of Vulkan commands. More...
#include <vppCommandBuffer.hpp>
Public Member Functions | |
CommandBuffer () | |
Constructs a null, invalid command buffer. | |
CommandBuffer (VkCommandBuffer hBuffer) | |
Constructs a command buffer from given Vulkan handle. | |
VkCommandBuffer | handle () const |
Retrieves the Vulkan handle. | |
operator bool () const | |
Checks whether this command buffer object is valid (non-null). | |
VkResult | reset () |
Resets the state of individual command buffer for reusing. | |
VkResult | release () |
Frees individual command buffer. More... | |
VkResult | begin (std::uint32_t flags=0) |
Sets the buffer in the recording state. More... | |
VkResult | end () |
Ends command recording for this buffer. More... | |
Represents a sequence of Vulkan commands.
Rendering and computation in Vulkan is performed by means of commands. Sequences of these commands are first recorded into CommandBuffer objects. Next, these CommandBuffer objects are submitted for execution to command queues exposed by the rendering device.
In order to create a command buffer, you need to have access to a CommandPool object first. The CommandPool object manages resources and lifetime for command buffers. One possibility is to use the default command pool provided by each Device instance. Use the Device::defaultCmdPool() method to retrieve the reference.
Next, call the CommandPool::createBuffer() method to obtain a CommandBuffer instance.
Having a CommandBuffer object, you can proceed in two ways:
The first way is the more standard (and recommended) usage.
After execution of the command buffer has finished, the buffer can be freed or reset for reusing. Reusing is typical method. You can free or reuse entire bunch of command buffers created by common CommandPool object. Using the CommandPool to manage command buffers in bulk is recommended.
CommandBuffer objects are lightweight, do not manage resources implicitly and can be passed by value.
VkResult vpp::CommandBuffer::begin | ( | std::uint32_t | flags = 0 | ) |
Sets the buffer in the recording state.
Call only in manual recording mode (not using CommandBufferRecorder).
VkResult vpp::CommandBuffer::end | ( | ) |
Ends command recording for this buffer.
Call only in manual recording mode (not using CommandBufferRecorder).
VkResult vpp::CommandBuffer::release | ( | ) |
Frees individual command buffer.
You usually do not need to call this, as the parent CommandPool will free all its buffers when being destroyed.