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(
device: Arc<Device>,
surface: Arc<Surface<W>>,
create_info: SwapchainCreateInfo
) -> Result<(Arc<Swapchain<W>>, Vec<Arc<SwapchainImage<W>>>), SwapchainCreationError>
pub fn new(
device: Arc<Device>,
surface: Arc<Surface<W>>,
create_info: SwapchainCreateInfo
) -> Result<(Arc<Swapchain<W>>, Vec<Arc<SwapchainImage<W>>>), 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<W>>, Vec<Arc<SwapchainImage<W>>>), SwapchainCreationError>
pub fn recreate(
self: &Arc<Self>,
create_info: SwapchainCreateInfo
) -> Result<(Arc<Swapchain<W>>, Vec<Arc<SwapchainImage<W>>>), 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 surface(&self) -> &Arc<Surface<W>>
pub fn surface(&self) -> &Arc<Surface<W>>
Returns the saved Surface, from the Swapchain creation.
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 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 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.
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>
type Object = SwapchainKHR
type Object = SwapchainKHR
The type of the object.
sourcefn internal_object(&self) -> SwapchainKHR
fn internal_object(&self) -> SwapchainKHR
Returns a reference to the object.
impl<W> Eq for Swapchain<W>
Auto Trait Implementations
impl<W> RefUnwindSafe for Swapchain<W> where
W: RefUnwindSafe,
impl<W> Send for Swapchain<W> where
W: Send + Sync,
impl<W> Sync for Swapchain<W> where
W: Send + Sync,
impl<W> Unpin for Swapchain<W>
impl<W> UnwindSafe for Swapchain<W> where
W: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more