gfx_hal::window

Trait PresentationSurface

Source
pub trait PresentationSurface<B: Backend>: Surface<B> {
    type SwapchainImage: Borrow<B::Image> + Borrow<B::ImageView> + Debug + Send + Sync;

    // Required methods
    unsafe fn configure_swapchain(
        &mut self,
        device: &B::Device,
        config: SwapchainConfig,
    ) -> Result<(), SwapchainError>;
    unsafe fn unconfigure_swapchain(&mut self, device: &B::Device);
    unsafe fn acquire_image(
        &mut self,
        timeout_ns: u64,
    ) -> Result<(Self::SwapchainImage, Option<Suboptimal>), AcquireError>;
}
Expand description

A surface trait that exposes the ability to present images on the associtated swap chain.

Required Associated Types§

Source

type SwapchainImage: Borrow<B::Image> + Borrow<B::ImageView> + Debug + Send + Sync

An opaque type wrapping the swapchain image.

Required Methods§

Source

unsafe fn configure_swapchain( &mut self, device: &B::Device, config: SwapchainConfig, ) -> Result<(), SwapchainError>

Set up the swapchain associated with the surface to have the given format.

Source

unsafe fn unconfigure_swapchain(&mut self, device: &B::Device)

Remove the associated swapchain from this surface.

This has to be done before the surface is dropped.

Source

unsafe fn acquire_image( &mut self, timeout_ns: u64, ) -> Result<(Self::SwapchainImage, Option<Suboptimal>), AcquireError>

Acquire a new swapchain image for rendering.

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

§Synchronization

The acquired image is available to render. No synchronization is required.

Implementors§