![]() |
VPP
0.7
A high-level modern C++ API for Vulkan
|
Interface to the automatic command recording framework. More...
#include <vppCommandBufferRecorder.hpp>
Public Member Functions | |
CommandBufferRecorder (CommandBuffer buffer, std::uint32_t flags=0) | |
Creates and initializes the recorder for given command buffer. | |
~CommandBufferRecorder () | |
Finalizes the recorder. | |
void | render (const RenderPass &hRenderPass, const FrameBuffer &hFrameBuffer, bool bAutoBindPipeline=true) |
Generates commands for graphics rendering, for specified render pass and framebuffer. More... | |
void | compute (const ComputePass &hComputePass, bool bAutoBindPipeline=true) |
Generates commands for computation, for specified compute pass. More... | |
void | perform (const Procedure &hProcedure) |
Generates commands for auxiliary processing, for specified compiled procedure. More... | |
void | presentImage (VkImage hImage) |
Generates commands for presentation of a SwapChain image on screen. More... | |
void | unpresentImage (VkImage hImage) |
Generates commands for releasing a SwapChain image currently presented on screen. More... | |
Interface to the automatic command recording framework.
This class is the main interface to the framework used by VPP to generate sequences of commands for render and compute passes. This is the recommended way to fill command buffers.
The first step is to create the recorder object. You need only to provide the target CommandBuffer object to the constructor.
Next, call one of the methods depending on what kind of operation you want to do:
render:
when you have a RenderPass to be rendered into specific FrameBuffer (typical operation for graphics rendering).compute:
when you have a ComputePass to execute (typical operation for compute shader execution).presentImage:
when you want to create commands to display an image to the swapchain (physically on screen).unpresentImage:
when you want to create commands to unlock the image displayed on screen, to overwrite it for the next frame.In all cases, do not call begin()
and end()
methods on the CommandBuffer, as the CommandBufferRecorder does it implicitly.
The CommandBufferRecorder should be temporary, created on stack. Do not store it.
void vpp::CommandBufferRecorder::compute | ( | const ComputePass & | hComputePass, |
bool | bAutoBindPipeline = true |
||
) |
Generates commands for computation, for specified compute pass.
Command sequence for this step is obtained by execution of the corresponding lambda function registered in the ComputePass.
void vpp::CommandBufferRecorder::perform | ( | const Procedure & | hProcedure | ) |
Generates commands for auxiliary processing, for specified compiled procedure.
This usually is not called directly, as the CompiledProcedures class already does it.
Compiled procedure is a sequence of Vulkan commands that are not rendering nor computing anything. For example, copying images and buffers and other tasks not requiring a pipeline.
Compiled procedures do not have render graphs nor pipelines. They have also some extra functions allowing easy calling on CPU side. These functions perform queuing and synchronization automatically.
Command sequence for this step is obtained by execution of the corresponding lambda function registered in the procedure.
void vpp::CommandBufferRecorder::presentImage | ( | VkImage | hImage | ) |
void vpp::CommandBufferRecorder::render | ( | const RenderPass & | hRenderPass, |
const FrameBuffer & | hFrameBuffer, | ||
bool | bAutoBindPipeline = true |
||
) |
Generates commands for graphics rendering, for specified render pass and framebuffer.
The CommandBufferRecorder implicitly does all preparation and gathers commands for the render preprocessing step, all subpasses and postprocessing step.
Command sequences for these steps are obtained by execution of the corresponding lambda functions in the RenderGraph, associated with given RenderPass.
void vpp::CommandBufferRecorder::unpresentImage | ( | VkImage | hImage | ) |