Module vulkano::framebuffer [] [src]

Targets on which your draw commands are executed.

Render passes and framebuffers

There are two concepts in Vulkan:

  • A RenderPass is a collection of one or multiples passes called subpasses. Each subpass contains the format and dimensions of the attachments that are part of the subpass. The render pass only defines the layout of the rendering process.
  • A Framebuffer contains the list of actual images that are attached. It is created from a render pass and has to match its characteristics.

You can create graphics pipelines from a render pass object alone. A Framebuffer is only needed when you add draw commands to a command buffer.

Render passes

In vulkano, a render pass is any object that implements the RenderPass trait.

You can create a render pass by creating a UnsafeRenderPass object. But as its name tells, it is unsafe because a lot of safety checks aren't performed.

Instead you are encouraged to use a safe wrapper around an UnsafeRenderPass. There are two ways to do this: TODO add more ways

  • Creating an instance of an EmptySinglePassRenderPass, which describes a render pass with no attachment and with one subpass.
  • Using the single_pass_renderpass! macro. See the documentation of this macro.

Render passes have three characteristics:

  • A list of attachments with their format.
  • A list of subpasses, that defines for each subpass which attachment is used for which purpose.
  • A list of dependencies between subpasses. Vulkan implementations are free to reorder the subpasses, which means that you need to declare dependencies if the output of a subpass needs to be read in a following subpass.

Example

With EmptySinglePassRenderPass:

use vulkano::framebuffer::EmptySinglePassRenderPass;

let renderpass = EmptySinglePassRenderPass::new(&device);

Framebuffers

Creating a framebuffer is done by passing the render pass object, the dimensions of the framebuffer, and the list of attachments to Framebuffer::new().

The slightly tricky part is that the type that contains the list of attachments depends on the trait implementation of RenderPass. For example if you use an EmptySinglePassRenderPass, you have to pass () for the list of attachments.

Structs

EmptySinglePassRenderPass

Implementation of RenderPass with no attachment at all and a single pass.

Framebuffer

Contains the list of images attached to a render pass.

LayoutAttachmentDescription

Describes an attachment that will be used in a render pass.

LayoutPassDependencyDescription

Describes a dependency between two passes of a render pass.

LayoutPassDescription

Describes one of the passes of a render pass.

Subpass

Represents a subpass within a RenderPass object.

UnsafeRenderPass

Defines the layout of multiple subpasses.

Enums

FramebufferCreationError

Error that can happen when creating a framebuffer object.

LoadOp

Describes what the implementation should do with an attachment at the start of the subpass.

RenderPassCreationError

Error that can happen when creating a compute pipeline.

StoreOp

Describes what the implementation should do with an attachment after all the subpasses have completed.

Traits

RenderPass

Trait for objects that describe a render pass.

RenderPassAttachmentsList

Extension trait for RenderPass. Defines which types are allowed as an attachments list.

RenderPassClearValues

Extension trait for RenderPass. Defines which types are allowed as a list of clear values.

RenderPassCompatible

Trait implemented on render pass objects to check whether they are compatible with another render pass.

RenderPassDesc
RenderPassSubpassInterface

Extension trait for RenderPass that checks whether a subpass of this render pass accepts the output of a fragment shader.