pub struct Swapchain<W> { /* private fields */ }
Expand description
Contains the swapping system and the images that can be shown on a surface.
Implementations
sourceimpl<W> Swapchain<W>
impl<W> Swapchain<W>
sourcepub fn new<F, S>(
device: Arc<Device>,
surface: Arc<Surface<W>>,
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<W>>>
) -> Result<(Arc<Swapchain<W>>, Vec<Arc<SwapchainImage<W>>>), SwapchainCreationError>where
F: FormatDesc,
S: Into<SharingMode>,
pub fn new<F, S>(
device: Arc<Device>,
surface: Arc<Surface<W>>,
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<W>>>
) -> Result<(Arc<Swapchain<W>>, Vec<Arc<SwapchainImage<W>>>), SwapchainCreationError>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
usage
is empty.
sourcepub fn recreate_with_dimension(
&self,
dimensions: [u32; 2]
) -> Result<(Arc<Swapchain<W>>, Vec<Arc<SwapchainImage<W>>>), SwapchainCreationError>
pub fn recreate_with_dimension(
&self,
dimensions: [u32; 2]
) -> Result<(Arc<Swapchain<W>>, Vec<Arc<SwapchainImage<W>>>), SwapchainCreationError>
Recreates the swapchain with new dimensions.
sourcepub fn raw_image(&self, offset: usize) -> Option<ImageInner<'_>>
pub fn raw_image(&self, offset: usize) -> Option<ImageInner<'_>>
Returns of the images that belong to this swapchain.
sourcepub fn num_images(&self) -> u32
pub fn num_images(&self) -> u32
Returns the number of images of the swapchain.
See the documentation of Swapchain::new
.
sourcepub fn format(&self) -> Format
pub fn format(&self) -> Format
Returns the format of the images of the swapchain.
See the documentation of Swapchain::new
.
sourcepub fn dimensions(&self) -> [u32; 2]
pub fn dimensions(&self) -> [u32; 2]
Returns the dimensions of the images of the swapchain.
See the documentation of Swapchain::new
.
sourcepub fn layers(&self) -> u32
pub fn layers(&self) -> u32
Returns the number of layers of the images of the swapchain.
See the documentation of Swapchain::new
.
sourcepub fn transform(&self) -> SurfaceTransform
pub fn transform(&self) -> SurfaceTransform
Returns the transform that was passed when creating the swapchain.
See the documentation of Swapchain::new
.
sourcepub fn composite_alpha(&self) -> CompositeAlpha
pub fn composite_alpha(&self) -> CompositeAlpha
Returns the alpha mode that was passed when creating the swapchain.
See the documentation of Swapchain::new
.
sourcepub fn present_mode(&self) -> PresentMode
pub fn present_mode(&self) -> PresentMode
Returns the present mode that was passed when creating the swapchain.
See the documentation of Swapchain::new
.
Trait Implementations
sourceimpl<W> DeviceOwned for Swapchain<W>
impl<W> DeviceOwned for Swapchain<W>
sourceimpl<W> VulkanObject for Swapchain<W>
impl<W> VulkanObject for Swapchain<W>
sourceconst TYPE: DebugReportObjectTypeEXT = 27u32
const TYPE: DebugReportObjectTypeEXT = 27u32
DebugReportObjectTypeEXT
of the internal Vulkan handle.