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
sourceunsafe fn acquire_image(
&mut self,
timeout_ns: u64,
sync: FrameSync<'_, B>
) -> Result<SwapImageIndex, AcquireError>
unsafe fn acquire_image(
&mut self,
timeout_ns: u64,
sync: FrameSync<'_, B>
) -> Result<SwapImageIndex, 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 underlying primitive of sync
will be signaled.
This can either be a Semaphore
or a Fence
.
Examples
Provided Methods
sourceunsafe 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<'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>,
sourceunsafe 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,
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,
Present one acquired image without any semaphore synchronization.