Trait gfx_hal::window::Swapchain

source ·
pub trait Swapchain<B: Backend>: Any + Send + Sync {
    unsafe fn acquire_image(
        &mut self,
        timeout_ns: u64,
        sync: FrameSync<'_, B>
    ) -> Result<SwapImageIndex, AcquireError>; unsafe fn present<'a, C, S, Iw>(
        &'a self,
        present_queue: &mut CommandQueue<B, C>,
        image_index: SwapImageIndex,
        wait_semaphores: Iw
    ) -> Result<(), ()>
    where
        Self: 'a + Sized + Borrow<B::Swapchain>,
        C: Capability,
        S: 'a + Borrow<B::Semaphore>,
        Iw: IntoIterator<Item = &'a S>
, { ... } unsafe fn present_nosemaphores<'a, C>(
        &'a self,
        present_queue: &mut CommandQueue<B, C>,
        image_index: SwapImageIndex
    ) -> Result<(), ()>
    where
        Self: 'a + Sized + Borrow<B::Swapchain>,
        C: Capability
, { ... } }
Expand description

The Swapchain is the backend representation of the surface. It consists of multiple buffers, which will be presented on the surface.

Required Methods

Acquire a new swapchain image for rendering. This needs to be called before presenting.

May fail according to one of the reasons indicated in AcquireError enum.

Synchronization

The acquired image will not be immediately available when the function returns. Once available the underlying primitive of sync will be signaled. This can either be a Semaphore or a Fence.

Examples

Provided Methods

Present one acquired image.

Safety

The passed queue must support presentation on the surface, which is used for creating this swapchain.

Examples

Present one acquired image without any semaphore synchronization.

Implementors