Skip to main content

Swapchain

Struct Swapchain 

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

images shown on a canvas

Implementations§

Source§

impl Swapchain

Source

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

the canvas takes the window’s size now

Source

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

the image to draw into (the same one until the worker returns to its event loop)

Source

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

the image to draw into; None while the window has no area

Source

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

the frame’s image as a render target

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; the browser shows the image when the worker’s turn ends

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 the browser does 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)

the next acquire takes the window’s size

Source

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

(the browser’s: no present modes)

Source

pub fn present_mode(&self) -> PresentMode

Source

pub fn format(&self) -> Format

Source

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

the images’ size

Source

pub fn image_count(&self) -> usize

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.