Struct Surface

Source
pub struct Surface {
    inner: ManuallyDrop<Box<dyn Surface>>,
    swapchain: RwLock<Option<Box<dyn Swapchain>>>,
}

Fields§

§inner: ManuallyDrop<Box<dyn Surface>>§swapchain: RwLock<Option<Box<dyn Swapchain>>>

Implementations§

Source§

impl Surface

Source

pub unsafe fn raw_native_handle(&self) -> Option<SurfaceKHR>

Returns the raw Vulkan surface handle.

Returns None if the surface is a DXGI surface.

Source

pub fn raw_native_swapchain(&self) -> Option<SwapchainKHR>

Get the raw Vulkan swapchain associated with this surface.

Returns None if the surface is not configured or if the swapchain is a DXGI swapchain.

Source

pub fn set_next_present_time(&self, present_timing: PresentTimeGOOGLE)

Set the present timing information which will be used for the next presentation of this surface, using VK_GOOGLE_display_timing.

This can be used to give an id to presentations, for future use of [vk::PastPresentationTimingGOOGLE]. Note that wgpu-hal does not provide a way to use that API - you should manually access this through [ash].

This can also be used to add a “not before” timestamp to the presentation.

The exact semantics of the fields are also documented in the specification for the extension.

§Panics
  • If the surface hasn’t been configured.
  • If the surface has been configured for a DXGI swapchain.
  • If the device doesn’t support present timing.

Trait Implementations§

Source§

impl Drop for Surface

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl DynResource for Surface

Source§

fn as_any(&self) -> &dyn Any

Source§

fn as_any_mut(&mut self) -> &mut dyn Any

Source§

impl Surface for Surface

Source§

type A = Api

Source§

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

Configure self to use device. Read more
Source§

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

Unconfigure self on device. Read more
Source§

unsafe fn acquire_texture( &self, timeout: Option<Duration>, fence: &Fence, ) -> Result<Option<AcquiredSurfaceTexture<Api>>, SurfaceError>

Return the next texture to be presented by self, for the caller to draw on. Read more
Source§

unsafe fn discard_texture(&self, texture: SurfaceTexture)

Relinquish an acquired texture without presenting it. Read more

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<S> DynSurface for S
where S: Surface + DynResource,

Source§

unsafe fn configure( &self, device: &(dyn DynDevice + 'static), config: &SurfaceConfiguration, ) -> Result<(), SurfaceError>

Source§

unsafe fn unconfigure(&self, device: &(dyn DynDevice + 'static))

Source§

unsafe fn acquire_texture( &self, timeout: Option<Duration>, fence: &(dyn DynFence + 'static), ) -> Result<Option<DynAcquiredSurfaceTexture>, SurfaceError>

Source§

unsafe fn discard_texture(&self, texture: Box<dyn DynSurfaceTexture>)

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, 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>

Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

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