![]() |
Mandrill 2025.6.0
|
Pass class that abstracts the use of dynamic rendering (no render passes) in Vulkan. Passes can either be created with explicit color and depth attachments, or with implicit attachments that are created based on a given extent and format. The pass can be used to begin and end rendering commands, as well as transitioning images for rendering or blitting. More...
#include <Pass.h>
Public Member Functions | |
MANDRILL_API | Pass (ptr< Device > pDevice, std::vector< ptr< Image > > colorAttachments, ptr< Image > pDepthAttachment) |
Create a pass with explicit color and depth attachments. | |
MANDRILL_API | Pass (ptr< Device > pDevice, VkExtent2D extent, VkFormat format, uint32_t colorAttachmentCount=1, bool depthAttachment=true, VkSampleCountFlagBits sampleCount=VK_SAMPLE_COUNT_1_BIT) |
Create a pass with implicit attachments, given a certain extent and format. Same format will be used for all color attachments. | |
MANDRILL_API | Pass (ptr< Device > pDevice, VkExtent2D extent, std::vector< VkFormat > formats, bool depthAttachment=true, VkSampleCountFlagBits sampleCount=VK_SAMPLE_COUNT_1_BIT) |
Create a pass with implicit attachments, given a certain extent and format. The list of formats will create mathcing color attachments. | |
MANDRILL_API | ~Pass () |
Destructor for pass. | |
MANDRILL_API void | transitionForRendering (VkCommandBuffer cmd, ptr< Image > pImage) const |
Transition an image for rendering. Call before begin() in an explicit pass. | |
MANDRILL_API void | transitionForBlitting (VkCommandBuffer cmd, ptr< Image > pImage) const |
Transition an image for blitting. Call after end() and before Swapchain::present(..., pImage) in an explicit pass. | |
MANDRILL_API void | begin (VkCommandBuffer cmd) |
Begin a pass without clearing the color attachments. | |
MANDRILL_API void | begin (VkCommandBuffer cmd, glm::vec4 clearColor, VkAttachmentLoadOp loadOp=VK_ATTACHMENT_LOAD_OP_CLEAR) |
Begin a pass with clearing of the color attachments. | |
MANDRILL_API void | begin (VkCommandBuffer cmd, ptr< Image > pImage) |
Begin a pass but override the color attachments with an image. The image is expected to be usable as a color attachment. | |
MANDRILL_API void | end (VkCommandBuffer cmd) const |
End a pass. | |
MANDRILL_API void | end (VkCommandBuffer cmd, ptr< Image > pImage) const |
End a pass and transition a given image for blitting. | |
MANDRILL_API void | update (std::vector< ptr< Image > > colorAttachments, ptr< Image > pDepthAttachment) |
Update an explicit pass with new attachments. Typically call on swapchain recreation. | |
MANDRILL_API void | update (VkExtent2D extent) |
Update an implicit pass with a new extent. Typically call on swapchain recreation. | |
MANDRILL_API VkPipelineRenderingCreateInfo | getPipelineRenderingCreateInfo () const |
Get the pipeline rendering create info. This is needed for pipeline creation when using dynamic rendering. | |
MANDRILL_API const std::vector< ptr< Image > > & | getColorAttachments () const |
Get the list of color attachments of the pass. | |
MANDRILL_API ptr< Image > | getOutput () const |
Get the output image of the pass. If multi-sampling was used, the resolve images is returned, otherwise the first color attachment is assumed to be the output. | |
MANDRILL_API VkExtent2D | getExtent () const |
Get the extent of the pass. | |
MANDRILL_API VkSampleCountFlagBits | getSampleCount () const |
Get the sample count of the pass. If VK_SAMPLE_COUNT_1_BIT is set, that means that there is no resolve happening in the pass. | |
Pass class that abstracts the use of dynamic rendering (no render passes) in Vulkan. Passes can either be created with explicit color and depth attachments, or with implicit attachments that are created based on a given extent and format. The pass can be used to begin and end rendering commands, as well as transitioning images for rendering or blitting.
Pass::Pass | ( | ptr< Device > | pDevice, |
std::vector< ptr< Image > > | colorAttachments, | ||
ptr< Image > | pDepthAttachment | ||
) |
Create a pass with explicit color and depth attachments.
pDevice | Device to use |
colorAttachments | Vector of image to use as color attachments |
pDepthAttachment | Depth attachment to use, can be nullptr |
Pass::Pass | ( | ptr< Device > | pDevice, |
VkExtent2D | extent, | ||
VkFormat | format, | ||
uint32_t | colorAttachmentCount = 1 , |
||
bool | depthAttachment = true , |
||
VkSampleCountFlagBits | sampleCount = VK_SAMPLE_COUNT_1_BIT |
||
) |
Create a pass with implicit attachments, given a certain extent and format. Same format will be used for all color attachments.
pDevice | Device to use |
extent | Resolution of attachments |
format | Format of color attachment |
colorAttachmentCount | Number of color attachments |
depthAttachment | If depth attachment should be created |
sampleCount | Multisampling count |
Pass::Pass | ( | ptr< Device > | pDevice, |
VkExtent2D | extent, | ||
std::vector< VkFormat > | formats, | ||
bool | depthAttachment = true , |
||
VkSampleCountFlagBits | sampleCount = VK_SAMPLE_COUNT_1_BIT |
||
) |
Create a pass with implicit attachments, given a certain extent and format. The list of formats will create mathcing color attachments.
pDevice | Device to use |
extent | Resolution of attachments |
formats | List of formats |
depthAttachment | If depth attachment should be created |
sampleCount | Multisampling count |
Pass::~Pass | ( | ) |
Destructor for pass.
void Pass::begin | ( | VkCommandBuffer | cmd | ) |
Begin a pass without clearing the color attachments.
cmd | Command buffer |
void Pass::begin | ( | VkCommandBuffer | cmd, |
glm::vec4 | clearColor, | ||
VkAttachmentLoadOp | loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR |
||
) |
Begin a pass with clearing of the color attachments.
cmd | Command buffer |
clearColor | Clearing color |
loadOp | Load operation for color attachments |
void Pass::begin | ( | VkCommandBuffer | cmd, |
ptr< Image > | pImage | ||
) |
Begin a pass but override the color attachments with an image. The image is expected to be usable as a color attachment.
cmd | Command buffer |
pImage | Overriding image |
void Pass::end | ( | VkCommandBuffer | cmd | ) | const |
End a pass.
cmd | Command buffer |
void Pass::end | ( | VkCommandBuffer | cmd, |
ptr< Image > | pImage | ||
) | const |
End a pass and transition a given image for blitting.
cmd | Command buffer |
pImage | Image to transition |
|
inline |
Get the list of color attachments of the pass.
|
inline |
Get the extent of the pass.
|
inline |
Get the output image of the pass. If multi-sampling was used, the resolve images is returned, otherwise the first color attachment is assumed to be the output.
|
inline |
Get the pipeline rendering create info. This is needed for pipeline creation when using dynamic rendering.
|
inline |
Get the sample count of the pass. If VK_SAMPLE_COUNT_1_BIT is set, that means that there is no resolve happening in the pass.
void Pass::transitionForBlitting | ( | VkCommandBuffer | cmd, |
ptr< Image > | pImage | ||
) | const |
void Pass::transitionForRendering | ( | VkCommandBuffer | cmd, |
ptr< Image > | pImage | ||
) | const |
Update an explicit pass with new attachments. Typically call on swapchain recreation.
colorAttachments | Vector with new color attachments |
pDepthAttachment | New depth attachment, can be nullptr |
void Pass::update | ( | VkExtent2D | extent | ) |
Update an implicit pass with a new extent. Typically call on swapchain recreation.
extent | New attachment extent |