pub struct Swapchain { /* private fields */ }
Expand description
Contains the swapping system and the images that can be shown on a surface.
Implementations
sourceimpl Swapchain
impl Swapchain
sourcepub fn new(
device: Arc<Device>,
surface: Arc<Surface>,
create_info: SwapchainCreateInfo
) -> Result<(Arc<Swapchain>, Vec<Arc<SwapchainImage>>), SwapchainCreationError>
pub fn new(
device: Arc<Device>,
surface: Arc<Surface>,
create_info: SwapchainCreateInfo
) -> Result<(Arc<Swapchain>, Vec<Arc<SwapchainImage>>), SwapchainCreationError>
Creates a new Swapchain
.
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.
Panics
- Panics if the device and the surface don’t belong to the same instance.
- Panics if
create_info.usage
is empty.
sourcepub fn recreate(
self: &Arc<Self>,
create_info: SwapchainCreateInfo
) -> Result<(Arc<Swapchain>, Vec<Arc<SwapchainImage>>), SwapchainCreationError>
pub fn recreate(
self: &Arc<Self>,
create_info: SwapchainCreateInfo
) -> Result<(Arc<Swapchain>, Vec<Arc<SwapchainImage>>), SwapchainCreationError>
Creates a new swapchain from this one.
Use this when a swapchain has become invalidated, such as due to window resizes.
Panics
- Panics if
create_info.usage
is empty.
sourcepub fn create_info(&self) -> SwapchainCreateInfo
pub fn create_info(&self) -> SwapchainCreateInfo
Returns the creation parameters of the swapchain.
sourcepub fn index_of_image(&self, image: &Image) -> Option<u32>
pub fn index_of_image(&self, image: &Image) -> Option<u32>
If image
is one of the images of this swapchain, returns its index within the swapchain.
sourcepub fn image_count(&self) -> u32
pub fn image_count(&self) -> u32
Returns the number of images of the swapchain.
sourcepub fn image_format(&self) -> Format
pub fn image_format(&self) -> Format
Returns the format of the images of the swapchain.
sourcepub fn image_color_space(&self) -> ColorSpace
pub fn image_color_space(&self) -> ColorSpace
Returns the color space of the images of the swapchain.
sourcepub fn image_extent(&self) -> [u32; 2]
pub fn image_extent(&self) -> [u32; 2]
Returns the extent of the images of the swapchain.
sourcepub fn image_array_layers(&self) -> u32
pub fn image_array_layers(&self) -> u32
Returns the number of array layers of the images of the swapchain.
sourcepub fn image_usage(&self) -> ImageUsage
pub fn image_usage(&self) -> ImageUsage
Returns the usage of the images of the swapchain.
sourcepub fn image_sharing(&self) -> &Sharing<SmallVec<[u32; 4]>>
pub fn image_sharing(&self) -> &Sharing<SmallVec<[u32; 4]>>
Returns the sharing of the images of the swapchain.
sourcepub fn pre_transform(&self) -> SurfaceTransform
pub fn pre_transform(&self) -> SurfaceTransform
Returns the pre-transform that was passed when creating the swapchain.
sourcepub fn composite_alpha(&self) -> CompositeAlpha
pub fn composite_alpha(&self) -> CompositeAlpha
Returns the alpha mode that was passed when creating the swapchain.
sourcepub fn present_mode(&self) -> PresentMode
pub fn present_mode(&self) -> PresentMode
Returns the present mode that was passed when creating the swapchain.
sourcepub fn clipped(&self) -> bool
pub fn clipped(&self) -> bool
Returns the value of clipped
that was passed when creating the swapchain.
sourcepub fn full_screen_exclusive(&self) -> FullScreenExclusive
pub fn full_screen_exclusive(&self) -> FullScreenExclusive
Returns the value of ’full_screen_exclusive` that was passed when creating the swapchain.
sourcepub fn acquire_full_screen_exclusive(
&self
) -> Result<(), FullScreenExclusiveError>
pub fn acquire_full_screen_exclusive(
&self
) -> Result<(), FullScreenExclusiveError>
Acquires full-screen exclusivity.
The swapchain must have been created with FullScreenExclusive::ApplicationControlled
,
and must not already hold full-screen exclusivity. Full-screen exclusivity is held until
either the release_full_screen_exclusive
is called, or if any of the the other Swapchain
functions return FullScreenExclusiveLost
.
sourcepub fn release_full_screen_exclusive(
&self
) -> Result<(), FullScreenExclusiveError>
pub fn release_full_screen_exclusive(
&self
) -> Result<(), FullScreenExclusiveError>
Releases full-screen exclusivity.
The swapchain must have been created with FullScreenExclusive::ApplicationControlled
,
and must currently hold full-screen exclusivity.
sourcepub fn is_full_screen_exclusive(&self) -> bool
pub fn is_full_screen_exclusive(&self) -> bool
FullScreenExclusive::AppControlled
is not the active full-screen exclusivity mode,
then this function will always return false. If true is returned the swapchain
is in FullScreenExclusive::AppControlled
full-screen exclusivity mode and exclusivity
is currently acquired.