Struct vulkano::framebuffer::Framebuffer
source · pub struct Framebuffer<Rp, A> { /* private fields */ }
Expand description
Contains a render pass and the image views that are attached to it.
Creating a framebuffer is done by calling Framebuffer::start
, which returns a
FramebufferBuilder
object. You can then add the framebuffer attachments one by one by
calling add(image)
. When you are done, call build()
.
Both the add
and the build
functions perform various checks to make sure that the number
of images is correct and that each image is compatible with the attachment definition in the
render pass.
use vulkano::framebuffer::Framebuffer;
// let render_pass: Arc<_> = ...;
let framebuffer = Framebuffer::start(render_pass.clone())
.add(my_image).unwrap()
.build().unwrap();
Just like render pass objects implement the RenderPassAbstract
trait, all framebuffer
objects implement the FramebufferAbstract
trait. This means that you can cast any
Arc<Framebuffer<..>>
into an Arc<FramebufferAbstract + Send + Sync>
for easier storage.
Framebuffer dimensions
If you use Framebuffer::start()
to create a framebuffer then vulkano will automatically
make sure that all the attachments have the same dimensions, as this is the most common
situation.
Alternatively you can also use with_intersecting_dimensions
, in which case the dimensions of
the framebuffer will be the intersection of the dimensions of all attachments, or
with_dimensions
if you want to specify exact dimensions. If you use with_dimensions
, you
are allowed to attach images that are larger than these dimensions.
If the dimensions of the framebuffer don’t match the dimensions of one of its attachment, then only the top-left hand corner of the image will be drawn to.
Implementations
sourceimpl<Rp> Framebuffer<Rp, ()>
impl<Rp> Framebuffer<Rp, ()>
sourcepub fn start(render_pass: Rp) -> FramebufferBuilder<Rp, ()>
pub fn start(render_pass: Rp) -> FramebufferBuilder<Rp, ()>
Starts building a framebuffer.
sourcepub fn with_intersecting_dimensions(
render_pass: Rp
) -> FramebufferBuilder<Rp, ()>
pub fn with_intersecting_dimensions(
render_pass: Rp
) -> FramebufferBuilder<Rp, ()>
Starts building a framebuffer. The dimensions of the framebuffer will automatically be the intersection of the dimensions of all the attachments.
sourcepub fn with_dimensions(
render_pass: Rp,
dimensions: [u32; 3]
) -> FramebufferBuilder<Rp, ()>
pub fn with_dimensions(
render_pass: Rp,
dimensions: [u32; 3]
) -> FramebufferBuilder<Rp, ()>
Starts building a framebuffer.
sourceimpl<Rp, A> Framebuffer<Rp, A>
impl<Rp, A> Framebuffer<Rp, A>
sourcepub fn dimensions(&self) -> [u32; 3]
pub fn dimensions(&self) -> [u32; 3]
Returns the width, height and layers of this framebuffer.
sourcepub fn device(&self) -> &Arc<Device>
pub fn device(&self) -> &Arc<Device>
Returns the device that was used to create this framebuffer.
sourcepub fn render_pass(&self) -> &Rp
pub fn render_pass(&self) -> &Rp
Returns the renderpass that was used to create this framebuffer.
Trait Implementations
sourceimpl<Rp: Debug, A: Debug> Debug for Framebuffer<Rp, A>
impl<Rp: Debug, A: Debug> Debug for Framebuffer<Rp, A>
sourceimpl<Rp, A> DeviceOwned for Framebuffer<Rp, A>
impl<Rp, A> DeviceOwned for Framebuffer<Rp, A>
sourceimpl<Rp, A> Drop for Framebuffer<Rp, A>
impl<Rp, A> Drop for Framebuffer<Rp, A>
sourceimpl<Rp, A> FramebufferAbstract for Framebuffer<Rp, A>where
Rp: RenderPassAbstract,
A: AttachmentsList,
impl<Rp, A> FramebufferAbstract for Framebuffer<Rp, A>where
Rp: RenderPassAbstract,
A: AttachmentsList,
sourcefn inner(&self) -> FramebufferSys<'_>
fn inner(&self) -> FramebufferSys<'_>
sourcefn dimensions(&self) -> [u32; 3]
fn dimensions(&self) -> [u32; 3]
sourcefn attached_image_view(&self, index: usize) -> Option<&dyn ImageViewAccess>
fn attached_image_view(&self, index: usize) -> Option<&dyn ImageViewAccess>
sourceimpl<Rp, A> RenderPassAbstract for Framebuffer<Rp, A>where
Rp: RenderPassAbstract,
impl<Rp, A> RenderPassAbstract for Framebuffer<Rp, A>where
Rp: RenderPassAbstract,
sourcefn inner(&self) -> RenderPassSys<'_>
fn inner(&self) -> RenderPassSys<'_>
sourceimpl<Rp, A> RenderPassDesc for Framebuffer<Rp, A>where
Rp: RenderPassDesc,
impl<Rp, A> RenderPassDesc for Framebuffer<Rp, A>where
Rp: RenderPassDesc,
sourcefn num_attachments(&self) -> usize
fn num_attachments(&self) -> usize
sourcefn attachment_desc(&self, num: usize) -> Option<AttachmentDescription>
fn attachment_desc(&self, num: usize) -> Option<AttachmentDescription>
sourcefn num_subpasses(&self) -> usize
fn num_subpasses(&self) -> usize
sourcefn subpass_desc(&self, num: usize) -> Option<PassDescription>
fn subpass_desc(&self, num: usize) -> Option<PassDescription>
sourcefn num_dependencies(&self) -> usize
fn num_dependencies(&self) -> usize
sourcefn dependency_desc(&self, num: usize) -> Option<PassDependencyDescription>
fn dependency_desc(&self, num: usize) -> Option<PassDependencyDescription>
sourcefn attachment_descs(&self) -> RenderPassDescAttachments<'_, Self> ⓘwhere
Self: Sized,
fn attachment_descs(&self) -> RenderPassDescAttachments<'_, Self> ⓘwhere
Self: Sized,
sourcefn subpass_descs(&self) -> RenderPassDescSubpasses<'_, Self> ⓘwhere
Self: Sized,
fn subpass_descs(&self) -> RenderPassDescSubpasses<'_, Self> ⓘwhere
Self: Sized,
sourcefn dependency_descs(&self) -> RenderPassDescDependencies<'_, Self> ⓘwhere
Self: Sized,
fn dependency_descs(&self) -> RenderPassDescDependencies<'_, Self> ⓘwhere
Self: Sized,
sourcefn is_compatible_with<T>(&self, other: &T) -> boolwhere
Self: Sized,
T: ?Sized + RenderPassDesc,
fn is_compatible_with<T>(&self, other: &T) -> boolwhere
Self: Sized,
T: ?Sized + RenderPassDesc,
sourcefn build_render_pass(
self,
device: Arc<Device>
) -> Result<RenderPass<Self>, RenderPassCreationError>where
Self: Sized,
fn build_render_pass(
self,
device: Arc<Device>
) -> Result<RenderPass<Self>, RenderPassCreationError>where
Self: Sized,
sourcefn num_color_attachments(&self, subpass: u32) -> Option<u32>
fn num_color_attachments(&self, subpass: u32) -> Option<u32>
None
if out of range.sourcefn num_samples(&self, subpass: u32) -> Option<u32>
fn num_samples(&self, subpass: u32) -> Option<u32>
None
if out of
range or if the subpass has no attachment. TODO: return an enum instead? Read moresourcefn has_depth_stencil_attachment(&self, subpass: u32) -> Option<(bool, bool)>
fn has_depth_stencil_attachment(&self, subpass: u32) -> Option<(bool, bool)>
true
if there’s a depth attachment, and whose
second element is true
if there’s a stencil attachment. Returns None
if out of range. Read moresourcefn has_depth(&self, subpass: u32) -> Option<bool>
fn has_depth(&self, subpass: u32) -> Option<bool>
sourcefn has_writable_depth(&self, subpass: u32) -> Option<bool>
fn has_writable_depth(&self, subpass: u32) -> Option<bool>
DepthStencilReadOnlyOptimal
. Read moresourcefn has_stencil(&self, subpass: u32) -> Option<bool>
fn has_stencil(&self, subpass: u32) -> Option<bool>
sourceimpl<C, Rp, A> RenderPassDescClearValues<C> for Framebuffer<Rp, A>where
Rp: RenderPassDescClearValues<C>,
impl<C, Rp, A> RenderPassDescClearValues<C> for Framebuffer<Rp, A>where
Rp: RenderPassDescClearValues<C>,
sourcefn convert_clear_values(&self, vals: C) -> Box<dyn Iterator<Item = ClearValue>>
fn convert_clear_values(&self, vals: C) -> Box<dyn Iterator<Item = ClearValue>>
C
into a list of clear values where each element corresponds
to an attachment. The size of the returned iterator must be the same as the number of
attachments. Read more