pub struct Swapchain { /* private fields */ }
Expand description

Contains the swapping system and the images that can be shown on a surface.

Implementations§

source§

impl Swapchain

source

pub fn new( device: Arc<Device>, surface: Arc<Surface>, create_info: SwapchainCreateInfo ) -> Result<(Arc<Swapchain>, Vec<Arc<Image>>), Validated<VulkanError>>

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.
source

pub fn recreate( self: &Arc<Self>, create_info: SwapchainCreateInfo ) -> Result<(Arc<Swapchain>, Vec<Arc<Image>>), Validated<VulkanError>>

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.
source

pub unsafe fn from_handle( device: Arc<Device>, handle: SwapchainKHR, image_handles: impl IntoIterator<Item = Image>, surface: Arc<Surface>, create_info: SwapchainCreateInfo ) -> Result<(Arc<Swapchain>, Vec<Arc<Image>>), VulkanError>

Creates a new Swapchain from a raw object handle.

Safety
  • handle and image_handles must be valid Vulkan object handles created from device.
  • handle must not be retired.
  • image_handles must be swapchain images owned by handle, in the same order as they were returned by vkGetSwapchainImagesKHR.
  • surface and create_info must match the info used to create the object.
source

pub fn create_info(&self) -> SwapchainCreateInfo

Returns the creation parameters of the swapchain.

source

pub fn surface(&self) -> &Arc<Surface>

Returns the surface that the swapchain was created from.

source

pub fn flags(&self) -> SwapchainCreateFlags

Returns the flags that the swapchain was created with.

source

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.

source

pub fn image_count(&self) -> u32

Returns the number of images of the swapchain.

source

pub fn image_format(&self) -> Format

Returns the format of the images of the swapchain.

source

pub fn image_view_formats(&self) -> &[Format]

Returns the formats that an image view created from a swapchain image can have.

source

pub fn image_color_space(&self) -> ColorSpace

Returns the color space of the images of the swapchain.

source

pub fn image_extent(&self) -> [u32; 2]

Returns the extent of the images of the swapchain.

source

pub fn image_array_layers(&self) -> u32

Returns the number of array layers of the images of the swapchain.

source

pub fn image_usage(&self) -> ImageUsage

Returns the usage of the images of the swapchain.

source

pub fn image_sharing(&self) -> &Sharing<SmallVec<[u32; 4]>>

Returns the sharing of the images of the swapchain.

source

pub fn pre_transform(&self) -> SurfaceTransform

Returns the pre-transform that was passed when creating the swapchain.

source

pub fn composite_alpha(&self) -> CompositeAlpha

Returns the alpha mode that was passed when creating the swapchain.

source

pub fn present_mode(&self) -> PresentMode

Returns the present mode that was passed when creating the swapchain.

source

pub fn present_modes(&self) -> &[PresentMode]

Returns the alternative present modes that were passed when creating the swapchain.

source

pub fn clipped(&self) -> bool

Returns the value of clipped that was passed when creating the swapchain.

source

pub fn scaling_behavior(&self) -> Option<PresentScaling>

Returns the scaling behavior that was passed when creating the swapchain.

source

pub fn present_gravity(&self) -> Option<[PresentGravity; 2]>

Returns the scaling behavior that was passed when creating the swapchain.

source

pub fn full_screen_exclusive(&self) -> FullScreenExclusive

Returns the value of ’full_screen_exclusive` that was passed when creating the swapchain.

source

pub fn acquire_full_screen_exclusive_mode( &self ) -> Result<(), Validated<VulkanError>>

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.

source

pub fn release_full_screen_exclusive_mode( &self ) -> Result<(), Validated<VulkanError>>

Releases full-screen exclusivity.

The swapchain must have been created with FullScreenExclusive::ApplicationControlled, and must currently hold full-screen exclusivity.

source

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§

source§

impl Debug for Swapchain

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl DeviceOwned for Swapchain

source§

fn device(&self) -> &Arc<Device>

Returns the device that owns self.
source§

impl Drop for Swapchain

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Hash for Swapchain

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Swapchain

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl VulkanObject for Swapchain

§

type Handle = SwapchainKHR

The type of the object.
source§

fn handle(&self) -> Self::Handle

Returns the raw Vulkan handle of the object.
source§

impl Eq for Swapchain

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DeviceOwnedVulkanObject for Twhere T: DeviceOwned + VulkanObject,

source§

fn set_debug_utils_object_name( &self, object_name: Option<&str> ) -> Result<(), VulkanError>

Assigns a human-readable name to the object for debugging purposes. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.