[][src]Trait gfx_hal::window::Swapchain

pub trait Swapchain<B: Backend>: Debug + Any + Send + Sync {
    unsafe fn acquire_image(
        &mut self,
        timeout_ns: u64,
        semaphore: Option<&B::Semaphore>,
        fence: Option<&B::Fence>
    ) -> Result<(SwapImageIndex, Option<Suboptimal>), AcquireError>; unsafe fn present<'a, C, S, Iw>(
        &'a self,
        present_queue: &mut CommandQueue<B, C>,
        image_index: SwapImageIndex,
        wait_semaphores: Iw
    ) -> Result<Option<Suboptimal>, PresentError>
    where
        Self: 'a + Sized + Borrow<B::Swapchain>,
        C: Capability,
        S: 'a + Borrow<B::Semaphore>,
        Iw: IntoIterator<Item = &'a S>
, { ... }
unsafe fn present_without_semaphores<'a, C>(
        &'a self,
        present_queue: &mut CommandQueue<B, C>,
        image_index: SwapImageIndex
    ) -> Result<Option<Suboptimal>, PresentError>
    where
        Self: 'a + Sized + Borrow<B::Swapchain>,
        C: Capability
, { ... } }

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

Required methods

unsafe fn acquire_image(
    &mut self,
    timeout_ns: u64,
    semaphore: Option<&B::Semaphore>,
    fence: Option<&B::Fence>
) -> Result<(SwapImageIndex, Option<Suboptimal>), AcquireError>

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 provided Semaphore and Fence will be signaled.

Examples

Loading content...

Provided methods

unsafe fn present<'a, C, S, Iw>(
    &'a self,
    present_queue: &mut CommandQueue<B, C>,
    image_index: SwapImageIndex,
    wait_semaphores: Iw
) -> Result<Option<Suboptimal>, PresentError> where
    Self: 'a + Sized + Borrow<B::Swapchain>,
    C: Capability,
    S: 'a + Borrow<B::Semaphore>,
    Iw: IntoIterator<Item = &'a S>, 

Present one acquired image.

Safety

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

Examples

unsafe fn present_without_semaphores<'a, C>(
    &'a self,
    present_queue: &mut CommandQueue<B, C>,
    image_index: SwapImageIndex
) -> Result<Option<Suboptimal>, PresentError> where
    Self: 'a + Sized + Borrow<B::Swapchain>,
    C: Capability

Present one acquired image without any semaphore synchronization.

Loading content...

Implementors

Loading content...