pub struct Surface { /* private fields */ }Expand description
Handle to a presentable surface.
A Surface represents a platform-specific surface (e.g. a window) onto which rendered images may
be presented. A Surface may be created with the unsafe function Instance::create_surface.
Implementations§
Source§impl Surface
impl Surface
Sourcepub fn get_preferred_format(&self, adapter: &Adapter) -> Option<TextureFormat>
pub fn get_preferred_format(&self, adapter: &Adapter) -> Option<TextureFormat>
Returns an optimal texture format to use for the Surface with this adapter.
Returns None if the surface is incompatible with the adapter.
Sourcepub fn configure(&self, device: &Device, config: &SurfaceConfiguration)
pub fn configure(&self, device: &Device, config: &SurfaceConfiguration)
Initializes Surface for presentation.
§Panics
- A old
SurfaceTextureis still alive referencing an old surface. - Texture format requested is unsupported on the surface.
Sourcepub fn get_current_texture(&self) -> Result<SurfaceTexture, SurfaceError>
pub fn get_current_texture(&self) -> Result<SurfaceTexture, SurfaceError>
Returns the next texture to be presented by the swapchain for drawing.
In order to present the SurfaceTexture returned by this method,
first a Queue::submit needs to be done with some work rendering to this texture.
Then SurfaceTexture::present needs to be called.
If a SurfaceTexture referencing this surface is alive when the swapchain is recreated, recreating the swapchain will panic.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Surface
impl !RefUnwindSafe for Surface
impl Send for Surface
impl Sync for Surface
impl Unpin for Surface
impl !UnwindSafe for Surface
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more