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
sourceimpl Surface
impl Surface
sourcepub fn get_supported_formats(&self, adapter: &Adapter) -> Vec<TextureFormat>
pub fn get_supported_formats(&self, adapter: &Adapter) -> Vec<TextureFormat>
Returns a vec of supported texture formats to use for the Surface
with this adapter.
Note: The first format in the vector is preferred
Returns an empty vector if the surface is incompatible with the adapter.
sourcepub fn get_supported_modes(&self, adapter: &Adapter) -> Vec<PresentMode>
pub fn get_supported_modes(&self, adapter: &Adapter) -> Vec<PresentMode>
Returns a vec of supported presentation modes to use for the Surface
with this adapter.
Returns an empty vector 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
SurfaceTexture
is 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 !RefUnwindSafe for Surface
impl Send for Surface
impl Sync for Surface
impl Unpin for Surface
impl !UnwindSafe for Surface
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more