Skip to main content

Surface

Struct Surface 

Source
pub struct Surface {
    pub device: Device,
    pub handle: SurfaceKHR,
}
Expand description

Smart pointer handle to a vk::SurfaceKHR object.

Fields§

§device: Device

The device which owns this surface resource.

Note: This field is read-only.

§handle: SurfaceKHR

The native Vulkan resource handle of this surface.

Note: This field is read-only.

Implementations§

Source§

impl Surface

Source

pub fn capabilities(&self) -> Result<SurfaceCapabilitiesKHR, DriverError>

Query surface capabilities

Source

pub fn create( device: &Device, display: impl HasDisplayHandle, window: impl HasWindowHandle, ) -> Result<Self, DriverError>

Create a surface from a raw window display handle.

device must have been created with platform specific surface extensions enabled.

Source

pub fn formats(&self) -> Result<Vec<SurfaceFormatKHR>, DriverError>

Lists the supported surface formats.

Source

pub fn linear(formats: &[SurfaceFormatKHR]) -> Option<SurfaceFormatKHR>

Helper function to automatically select the best UNORM format, if one is available.

Source

pub fn linear_or_default(formats: &[SurfaceFormatKHR]) -> SurfaceFormatKHR

Helper function to automatically select the best UNORM format.

NOTE: The default surface format is undefined, and although legal the results may not support presentation. You should prefer to use Surface::linear and fall back to supported values manually.

Source

pub fn physical_device_support( &self, queue_family_index: u32, ) -> Result<bool, DriverError>

Returns true if the given queue family supports presentation on this surface.

Source

pub fn present_modes(&self) -> Result<Vec<PresentModeKHR>, DriverError>

Query supported presentation modes.

Source

pub fn srgb(formats: &[SurfaceFormatKHR]) -> Option<SurfaceFormatKHR>

Helper function to automatically select the best sRGB format, if one is available.

Source

pub fn srgb_or_default(formats: &[SurfaceFormatKHR]) -> SurfaceFormatKHR

Helper function to automatically select the best sRGB format.

NOTE: The default surface format is undefined, and although legal the results may not support presentation. You should prefer to use Surface::srgb and fall back to supported values manually.

Trait Implementations§

Source§

impl Debug for Surface

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
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 PartialEq for Surface

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for 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
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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.