Skip to main content

Swapchain

Struct Swapchain 

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

the images a window shows, presented in turn

Implementations§

Source§

impl Swapchain

Source

pub fn rebuild(&mut self) -> Result<()>

(re)create the swapchain for the window’s size now; the old images may still be in use: waits for the queue to be idle (resizes are rare)

Source

pub fn try_acquire(&mut self) -> Result<TryAcquire>

the next image to draw into, without waiting and without rebuilding (see TryAcquire)

Source

pub fn acquire(&mut self) -> Result<Option<Frame>>

the next image to draw into; None while the window is minimised or has no area

Source

pub fn view(&self, frame: &Frame) -> &TextureView

the frame’s image as a render target (Undefined at the start, Present at the end)

Source

pub fn texture(&self, frame: &Frame) -> &Texture

the frame’s image (copies: SwapchainDesc::copy_src)

Source

pub fn present<'a, I: IntoIterator<Item = CommandBuffer<'a>>>( &self, frame: Frame, cmds: I, ) -> Result<SubmitId>

submit the frame’s commands (they leave the image in Layout::Present) and show it

Source

pub fn prepare(&mut self) -> Result<bool>

(Linux: the display has answered for the images; here nothing to wait for)

Source

pub fn flush(&self) -> Result<bool>

(Linux: a frame reaches the window after the GPU finished it; here present has done that)

Source

pub fn busy(&self) -> bool

(Linux: a frame is on its way to the window; here never)

Source

pub fn next_look(&self, retry: u64) -> u64

when a frame that found NotReady should try again: retry (the caller’s time)

Source

pub fn damage(&self, _rects: Option<&[[i32; 4]]>)

(Linux: what the next image changes, for the compositor; here the whole image counts)

Source

pub fn resize(&mut self)

rebuild at the next acquire (the window’s size is also checked at every acquire)

Source

pub fn set_present_mode(&mut self, m: PresentMode)

another present mode from the next acquire on (FIFO when the surface lacks it)

Source

pub fn present_mode(&self) -> PresentMode

Source

pub fn format(&self) -> Format

Source

pub fn size(&self) -> (u32, u32)

the images’ size (0, 0 while the window has no area)

Source

pub fn image_count(&self) -> usize

Trait Implementations§

Source§

impl Drop for Swapchain

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. 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 T
where 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 T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.