From 3a0eebc78be04cfe99a38df6f54b57d67e7246e7 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 22 Feb 2016 09:04:06 +0100 Subject: [PATCH] Add some docs --- vulkano/src/framebuffer.rs | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/vulkano/src/framebuffer.rs b/vulkano/src/framebuffer.rs index 7c67d47d7..0795174ee 100644 --- a/vulkano/src/framebuffer.rs +++ b/vulkano/src/framebuffer.rs @@ -128,13 +128,25 @@ pub enum ClearValue { DepthStencil((f32, u32)), } +/// Describes an attachment that will be used in a renderpass. pub struct AttachmentDescription { + /// Format of the image that is going to be binded. pub format: Format, + /// Number of samples of the image that is going to be binded. pub samples: u32, + + /// What the implementation should do with that attachment at the start of the renderpass. pub load: LoadOp, + /// What the implementation should do with that attachment at the end of the renderpass. pub store: StoreOp, + /// Layout that the image is going to be in at the start of the renderpass. + /// + /// The vulkano library will automatically switch to the correct layout if necessary, but it + /// is more optimal to set this to the correct value. pub initial_layout: ImageLayout, + + /// Layout that the image will be transitionned to at the end of the renderpass. pub final_layout: ImageLayout, } @@ -147,29 +159,45 @@ impl AttachmentDescription { } } +/// Describes one of the passes of a renderpass. pub struct PassDescription { - /// Indices of attachments to use as color attachments. + /// Indices and layouts of attachments to use as color attachments. pub color_attachments: Vec<(usize, ImageLayout)>, // TODO: Vec is slow + + /// Index and layout of the attachment to use as depth-stencil attachment. pub depth_stencil: Option<(usize, ImageLayout)>, - /// Indices of attachments to use as input attachments. + + /// Indices and layouts of attachments to use as input attachments. pub input_attachments: Vec<(usize, ImageLayout)>, // TODO: Vec is slow + /// If not empty, each color attachment will be resolved into each corresponding entry of /// this list. /// /// If this value is not empty, it **must** be the same length as `color_attachments`. pub resolve_attachments: Vec<(usize, ImageLayout)>, // TODO: Vec is slow + /// Indices of attachments that will be preserved during this pass. pub preserve_attachments: Vec, // TODO: Vec is slow } +/// Describes a dependency between two passes of a renderpass. +/// +/// The implementation is allowed to change the order of the passes within a renderpass, unless +/// you specify that there exists a dependency between two passes (ie. the result of one will be +/// used as the input of another one). // FIXME: finish pub struct PassDependencyDescription { + /// Index of the subpass that writes the data that `destination_subpass` is going to use. pub source_subpass: usize, + + /// Index of the subpass that reads the data that `source_subpass` wrote. pub destination_subpass: usize, + /*VkPipelineStageFlags srcStageMask; VkPipelineStageFlags dstStageMask; VkAccessFlags srcAccessMask; VkAccessFlags dstAccessMask;*/ + pub by_region: bool, }