Skip to main content

Surface

Struct Surface 

Source
pub struct Surface {
    pub(crate) presentation: Mutex<Option<Presentation>>,
    pub surface_per_backend: HashMap<Backend, Box<dyn DynSurface>>,
}

Fields§

§presentation: Mutex<Option<Presentation>>§surface_per_backend: HashMap<Backend, Box<dyn DynSurface>>

Implementations§

Source§

impl Surface

Source

pub unsafe fn as_hal<A: Api>( self: Arc<Self>, ) -> Option<impl Deref<Target = A::Surface>>

§Safety
  • The raw surface handle must not be manually destroyed
Source§

impl Surface

Source

pub fn get_capabilities( &self, adapter: &Adapter, ) -> Result<SurfaceCapabilities, GetSurfaceSupportError>

Source

pub fn get_hal_capabilities( &self, adapter: &Adapter, ) -> Result<SurfaceCapabilities, GetSurfaceSupportError>

Source

pub fn get_capabilities_with_raw( &self, adapter: &DynExposedAdapter, ) -> Result<SurfaceCapabilities, GetSurfaceSupportError>

Source

pub fn display_hdr_info(&self, adapter: &Adapter) -> DisplayHdrInfo

Returns the HDR / luminance characteristics of the display backing this surface on adapter.

Falls back to wgt::DisplayHdrInfo::default (all fields None) when the surface is not on adapter’s backend or the backend reports nothing.

Source

pub fn display_hdr_info_with_raw( &self, adapter: &DynExposedAdapter, ) -> DisplayHdrInfo

Source

pub fn raw(&self, backend: Backend) -> Option<&dyn DynSurface>

Source

fn take_presentation<'a>( &self, presentation: &mut MutexGuard<'a, Option<Presentation>>, ) -> (Option<Arc<Device>>, UserClosures)

Takes the current configuration, destroys its acquired texture and waits for all work on its device to finish.

Returns the device the surface was configured for. The raw surface is still configured, so the caller must unconfigure it next.

Source

unsafe fn unconfigure_raw(&self, device: &Device)

Unconfigures the raw surface from device.

§Safety

device must have been returned by Self::take_presentation, and the surface must not have been configured since.

Source

fn unconfigure_inner<'a>( &self, presentation: &mut MutexGuard<'a, Option<Presentation>>, ) -> UserClosures

Source

pub fn unconfigure(self: &Arc<Self>)

Source

pub fn configure( self: &Arc<Self>, device: &Arc<Device>, config: &SurfaceConfiguration<Vec<TextureFormat>>, ) -> Result<(), ConfigureSurfaceError>

Source§

impl Surface

Source

pub fn get_current_texture( self: &Arc<Self>, ) -> Result<SurfaceOutput, SurfaceError>

Source

pub(crate) fn get_current_texture_inner( &self, ) -> Result<SurfaceOutput, SurfaceError>

Source

pub fn present(self: &Arc<Self>) -> Result<Status, SurfaceError>

Source

pub fn present_with_damage( self: &Arc<Self>, damage_rects: &[Rect<u32>], ) -> Result<Status, SurfaceError>

Source

pub(crate) fn present_inner( &self, damage_rects: &[Rect<u32>], ) -> Result<Status, SurfaceError>

Source§

impl Surface

Source

pub fn discard(self: &Arc<Self>) -> Result<(), SurfaceError>

Source

pub(crate) fn discard_inner(&self) -> Result<(), SurfaceError>

Source

pub fn release(self: &Arc<Self>) -> Result<(), SurfaceError>

Source

pub(crate) fn release_inner(&self) -> Result<(), SurfaceError>

Like discard, drops the inner texture reference, but skips the HAL discard_texture call. Safe to call during unwinding

Trait Implementations§

Source§

impl Drop for Surface

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl ResourceType for Surface

Source§

const TYPE: &'static str = "Surface"

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,