wgpu_hal

Trait Surface

Source
pub trait Surface<A: Api>: WasmNotSend + WasmNotSync {
    // Required methods
    unsafe fn configure(
        &mut self,
        device: &A::Device,
        config: &SurfaceConfiguration,
    ) -> Result<(), SurfaceError>;
    unsafe fn unconfigure(&mut self, device: &A::Device);
    unsafe fn acquire_texture(
        &mut self,
        timeout: Option<Duration>,
    ) -> Result<Option<AcquiredSurfaceTexture<A>>, SurfaceError>;
    unsafe fn discard_texture(&mut self, texture: A::SurfaceTexture);
}

Required Methods§

Source

unsafe fn configure( &mut self, device: &A::Device, config: &SurfaceConfiguration, ) -> Result<(), SurfaceError>

Configures the surface to use the given device.

§Safety
Source

unsafe fn unconfigure(&mut self, device: &A::Device)

Unconfigures the surface on the given device.

§Safety
Source

unsafe fn acquire_texture( &mut self, timeout: Option<Duration>, ) -> Result<Option<AcquiredSurfaceTexture<A>>, SurfaceError>

Returns the next texture to be presented by the swapchain for drawing

A timeout of None means to wait indefinitely, with no timeout.

§Portability

Some backends can’t support a timeout when acquiring a texture and the timeout will be ignored.

Returns None on timing out.

Source

unsafe fn discard_texture(&mut self, texture: A::SurfaceTexture)

Implementors§