Struct surfman::chains::SwapChain

source ·
pub struct SwapChain<Device: DeviceAPI>(Arc<Mutex<SwapChainData<Device>>>);
Expand description

A thread-safe swap chain.

Tuple Fields§

§0: Arc<Mutex<SwapChainData<Device>>>

Implementations§

source§

impl<Device: DeviceAPI> SwapChain<Device>

source

fn lock(&self) -> MutexGuard<'_, SwapChainData<Device>>

source

pub fn swap_buffers( &self, device: &mut Device, context: &mut Device::Context, preserve_buffer: PreserveBuffer<'_>, ) -> Result<(), Error>

Swap the back and front buffers. Called by the producer. Returns an error if context is not the producer context for this swap chain.

source

pub fn take_attachment_from( &self, device: &mut Device, context: &mut Device::Context, other: &SwapChain<Device>, ) -> Result<(), Error>

Swap the attached swap chain. Called by the producer. Returns an error if context is not the producer context for both swap chains. Returns an error if this swap chain is attached, or the other swap chain is detached.

source

pub fn resize( &self, device: &mut Device, context: &mut Device::Context, size: Size2D<i32>, ) -> Result<(), Error>

Resize the swap chain. This creates a new back buffer of the appropriate size, and destroys the old one. Called by the producer. Returns an error if context is not the producer context for this swap chain.

source

pub fn size(&self) -> Size2D<i32>

Get the current size. Called by a consumer.

source

pub fn take_surface_texture( &self, device: &Device, context: &mut Device::Context, ) -> Result<Device::SurfaceTexture, Error>

Take the current back buffer. Called by a producer.

source

pub fn recycle_surface_texture( &self, device: &Device, context: &mut Device::Context, surface_texture: Device::SurfaceTexture, ) -> Result<(), Error>

Recycle the current back buffer. Called by a producer.

source

pub fn take_pending_surface(&self) -> Option<Device::Surface>

Take the current front buffer. Returns None if there is no current front buffer. Called by a consumer.

source

pub fn clear_surface( &self, device: &mut Device, context: &mut Device::Context, gl: &Gl, color: [f32; 4], ) -> Result<(), Error>

Clear the current back buffer. Called by the producer. Returns an error if context is not the producer context for this swap chain.

source

pub fn is_attached(&self) -> bool

Is this the attached swap chain?

source

pub fn destroy( &self, device: &mut Device, context: &mut Device::Context, ) -> Result<(), Error>

Destroy the swap chain. Called by the producer. Returns an error if context is not the producer context for this swap chain.

source

pub fn create_attached( device: &mut Device, context: &mut Device::Context, surface_access: SurfaceAccess, ) -> Result<SwapChain<Device>, Error>

Create a new attached swap chain

source

pub fn create_detached( device: &mut Device, context: &mut Device::Context, surface_access: SurfaceAccess, size: Size2D<i32>, ) -> Result<SwapChain<Device>, Error>

Create a new detached swap chain

Trait Implementations§

source§

impl<Device: DeviceAPI> Clone for SwapChain<Device>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Device> SwapChainAPI for SwapChain<Device>
where Device: 'static + DeviceAPI, Device::Surface: Send,

source§

fn take_surface(&self) -> Option<Device::Surface>

Take the current front buffer. Returns the most recent recycled surface if there is no current front buffer. Called by a consumer.

source§

fn recycle_surface(&self, surface: Device::Surface)

Recycle the current front buffer. Called by a consumer.

§

type Surface = <Device as Device>::Surface

Auto Trait Implementations§

§

impl<Device> Freeze for SwapChain<Device>

§

impl<Device> RefUnwindSafe for SwapChain<Device>

§

impl<Device> Send for SwapChain<Device>
where <Device as Device>::Surface: Send,

§

impl<Device> Sync for SwapChain<Device>
where <Device as Device>::Surface: Send,

§

impl<Device> Unpin for SwapChain<Device>

§

impl<Device> UnwindSafe for SwapChain<Device>

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.