Struct vulkano::swapchain::Swapchain
[−]
[src]
pub struct Swapchain { /* fields omitted */ }
Contains the swapping system and the images that can be shown on a surface.
Methods
impl Swapchain
[src]
fn new<F, S>(device: &Arc<Device>, surface: &Arc<Surface>, num_images: u32, format: F, dimensions: [u32; 2], layers: u32, usage: &ImageUsage, sharing: S, transform: SurfaceTransform, alpha: CompositeAlpha, mode: PresentMode, clipped: bool, old_swapchain: Option<&Arc<Swapchain>>) -> Result<(Arc<Swapchain>, Vec<Arc<SwapchainImage>>), OomError> where F: FormatDesc, S: Into<SharingMode>
Builds a new swapchain. Allocates images who content can be made visible on a surface.
See also the Surface::get_capabilities
function which returns the values that are
supported by the implementation. All the parameters that you pass to Swapchain::new
must be supported.
The clipped
parameter indicates whether the implementation is allowed to discard
rendering operations that affect regions of the surface which aren't visible. This is
important to take into account if your fragment shader has side-effects or if you want to
read back the content of the image afterwards.
This function returns the swapchain plus a list of the images that belong to the
swapchain. The order in which the images are returned is important for the
acquire_next_image
and present
functions.
Panic
- Panics if the device and the surface don't belong to the same instance.
- Panics if
color_attachment
is false inusage
.
fn recreate_with_dimension(&self, dimensions: [u32; 2]) -> Result<(Arc<Swapchain>, Vec<Arc<SwapchainImage>>), OomError>
Recreates the swapchain with new dimensions.
fn acquire_next_image(&self, timeout: Duration) -> Result<usize, AcquireError>
Tries to take ownership of an image in order to draw on it.
The function returns the index of the image in the array of images that was returned when creating the swapchain.
If you try to draw on an image without acquiring it first, the execution will block. (TODO behavior may change).
fn present(&self, queue: &Arc<Queue>, index: usize) -> Result<(), PresentError>
Presents an image on the screen.
The parameter is the same index as what acquire_next_image
returned. The image must
have been acquired first.
The actual behavior depends on the present mode that you passed when creating the swapchain.
fn num_images(&self) -> u32
Returns the number of images of the swapchain.
See the documentation of Swapchain::new
.
fn format(&self) -> Format
Returns the format of the images of the swapchain.
See the documentation of Swapchain::new
.
fn dimensions(&self) -> [u32; 2]
Returns the dimensions of the images of the swapchain.
See the documentation of Swapchain::new
.
fn layers(&self) -> u32
Returns the number of layers of the images of the swapchain.
See the documentation of Swapchain::new
.
fn transform(&self) -> SurfaceTransform
Returns the transform that was passed when creating the swapchain.
See the documentation of Swapchain::new
.
fn composite_alpha(&self) -> CompositeAlpha
Returns the alpha mode that was passed when creating the swapchain.
See the documentation of Swapchain::new
.
fn present_mode(&self) -> PresentMode
Returns the present mode that was passed when creating the swapchain.
See the documentation of Swapchain::new
.
fn clipped(&self) -> bool
Returns the value of clipped
that was passed when creating the swapchain.
See the documentation of Swapchain::new
.