struct RenderPassInfo
Defined at line 51 of file ../../src/ui/lib/escher/third_party/granite/vk/render_pass_info.h
Structure passed to CommandBuffer::BeginRenderPass(), which free Escher users
from direct exposure to VkFramebuffers and VkRenderPasses, which are managed
behind the scenes by CommandBuffer.
Creating a Vulkan render pass is an excruciatingly explicit process.
RenderPassInfo strikes a balance between ease-of-use and efficiency;
despite being relatively easy to use, it nevertheless remains flexible and
sufficiently detailed to generate an efficient VkRenderPass.
NOTE: the semantics of RenderPassInfo are not set in stone. If future
use-cases are limited by some of the current simplifications (e.g. single
depth attachment, layout flags apply to all layouts of that type, etc.),
appropriate adjustments can be made.
Public Members
RefPtr depth_stencil_attachment
AttachmentInfo depth_stencil_attachment_info
ImageViewPtr[8] color_attachments
array color_attachment_infos
uint32_t num_color_attachments
RenderPassInfo::OpFlags op_flags
uint32_t clear_attachments
uint32_t load_attachments
uint32_t store_attachments
Rect2D render_area
vk::ClearColorValue[8] clear_color
ClearDepthStencilValue clear_depth_stencil
vector subpasses
Public Methods
bool Validate ()
Runs a series of validity checks on the RenderPassInfo, returning true only if all pass.
For example:
- there must be at least one attachment (either color or depth-stencil).
- the same attachment cannot be both loaded and cleared.
Defined at line 130 of file ../../src/ui/lib/escher/third_party/granite/vk/render_pass_info.cc
std::pair<vk::AttachmentLoadOp, vk::AttachmentStoreOp> LoadStoreOpsForColorAttachment (uint32_t index)
Return appropriate load/store ops for the specified color attachment,
depending on which of the corresponding bits are set in:
- clear_attachments
- load_attachments
- store attachments
Convenience method, primarily used by the impl::RenderPass constructor.
Defined at line 34 of file ../../src/ui/lib/escher/third_party/granite/vk/render_pass_info.cc
std::pair<vk::AttachmentLoadOp, vk::AttachmentStoreOp> LoadStoreOpsForDepthStencilAttachment ()
Return appropriate load/store ops, depending on which of these flags are
set:
- kClearDepthStencilOp
- kLoadDepthStencilOp
- kStoreDepthStencilOp
Convenience method, primarily used by the impl::RenderPass constructor.
Defined at line 71 of file ../../src/ui/lib/escher/third_party/granite/vk/render_pass_info.cc
bool InitRenderPassInfo (RenderPassInfo * rp, vk::Rect2D render_area, const ImagePtr & output_image, const TexturePtr & depth_texture, const TexturePtr & msaa_texture, ImageViewAllocator * allocator)
Handles the logic for setting up a vulkan render pass. If there are MSAA buffers a resolve
subpass is also added. Clear color is set to transparent-black and if the frame has a depth
texture that will also be used. This is general enough to meet most standard needs but if a
client wants something that is not handled here they will have to manually initialize their
own RenderPassInfo struct.
This variant of InitRenderPassInfo() is used when the application wants to begin a render pass,
which requires the attachment images to be provided.
The layout of |output_image| should be initialized to its swapchain layout (or scheduled to
be initialized by the time we submit the render pass) before we call this.
Returns true if and only if initialization is successful.
Defined at line 325 of file ../../src/ui/lib/escher/third_party/granite/vk/render_pass_info.cc
bool InitRenderPassInfo (RenderPassInfo * rp, const RenderPassInfo::AttachmentInfo & color_info, vk::Format depth_stencil_format, vk::Format msaa_format, uint32_t sample_count, bool use_transient_depth_and_msaa)
This variant of InitRenderPassInfo() cannot be used to call CommandBuffer::BeginRenderPass(),
because there are no attachment images provided. It can be used for warming up the render-pass
cache to avoid jank caused by creating render-passes/pipelines at runtime.
|msaa_format| will be ignored if |sample_count| == 1.
Returns true if and only if initialization is successful.
Defined at line 376 of file ../../src/ui/lib/escher/third_party/granite/vk/render_pass_info.cc
void InitRenderPassAttachmentInfosFromImages (RenderPassInfo * rp)
Used to reduce boilerplate when InitRenderPassInfo() is too generic. This helper populates
|depth_stencil_attachment_info| and |color_attachment_infos| with information from the images
|depth_stencil_attachment| and |color_attachments|. The caller is responsible for filling in
all other fields.
TODO(44566): this is mostly used for tests, some (all?) of which can be rewritten to use the
"no images" variant of InitRenderPassInfo. Aim for deletion of this function.
Defined at line 110 of file ../../src/ui/lib/escher/third_party/granite/vk/render_pass_info.cc
Enumerations
enum OpFlagBits
| Name | Value |
|---|---|
| kClearDepthStencilOp | 1 << 0 |
| kLoadDepthStencilOp | 1 << 1 |
| kStoreDepthStencilOp | 1 << 2 |
| kOptimalColorLayoutOp | 1 << 3 |
| kOptimalDepthStencilLayoutOp | 1 << 4 |
| kDepthStencilReadOnlyLayoutOp | 1 << 5 |
Defined at line 52 of file ../../src/ui/lib/escher/third_party/granite/vk/render_pass_info.h
enum DepthStencil
| Name | Value |
|---|---|
| kNone | 0 |
| kReadOnly | 1 |
| kReadWrite | 2 |
Describes how the depth-stencil attachment is used in each subpass.
Defined at line 72 of file ../../src/ui/lib/escher/third_party/granite/vk/render_pass_info.h