pub trait Surface<A: Api>: WasmNotSendSync {
// Required methods
unsafe fn configure(
&self,
device: &A::Device,
config: &SurfaceConfiguration
) -> Result<(), SurfaceError>;
unsafe fn unconfigure(&self, device: &A::Device);
unsafe fn acquire_texture(
&self,
timeout: Option<Duration>
) -> Result<Option<AcquiredSurfaceTexture<A>>, SurfaceError>;
unsafe fn discard_texture(&self, texture: A::SurfaceTexture);
}
Required Methods§
sourceunsafe fn configure(
&self,
device: &A::Device,
config: &SurfaceConfiguration
) -> Result<(), SurfaceError>
unsafe fn configure( &self, device: &A::Device, config: &SurfaceConfiguration ) -> Result<(), SurfaceError>
Configures the surface to use the given device.
Safety
- All gpu work that uses the surface must have been completed.
- All
AcquiredSurfaceTexture
s must have been destroyed. - All
Api::TextureView
s derived from theAcquiredSurfaceTexture
s must have been destroyed. - All surfaces created using other devices must have been unconfigured before this call.
sourceunsafe fn unconfigure(&self, device: &A::Device)
unsafe fn unconfigure(&self, device: &A::Device)
Unconfigures the surface on the given device.
Safety
- All gpu work that uses the surface must have been completed.
- All
AcquiredSurfaceTexture
s must have been destroyed. - All
Api::TextureView
s derived from theAcquiredSurfaceTexture
s must have been destroyed. - The surface must have been configured on the given device.
sourceunsafe fn acquire_texture(
&self,
timeout: Option<Duration>
) -> Result<Option<AcquiredSurfaceTexture<A>>, SurfaceError>
unsafe fn acquire_texture( &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.