pub struct Surface {
pub device: Device,
pub handle: SurfaceKHR,
}Expand description
Smart pointer handle to a vk::SurfaceKHR object.
Fields§
§device: DeviceThe device which owns this surface resource.
Note: This field is read-only.
handle: SurfaceKHRThe native Vulkan resource handle of this surface.
Note: This field is read-only.
Implementations§
Source§impl Surface
impl Surface
Sourcepub fn capabilities(&self) -> Result<SurfaceCapabilitiesKHR, DriverError>
pub fn capabilities(&self) -> Result<SurfaceCapabilitiesKHR, DriverError>
Query surface capabilities
Sourcepub fn create(
device: &Device,
display: impl HasDisplayHandle,
window: impl HasWindowHandle,
) -> Result<Self, DriverError>
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.
Sourcepub fn formats(&self) -> Result<Vec<SurfaceFormatKHR>, DriverError>
pub fn formats(&self) -> Result<Vec<SurfaceFormatKHR>, DriverError>
Lists the supported surface formats.
Sourcepub fn linear(formats: &[SurfaceFormatKHR]) -> Option<SurfaceFormatKHR>
pub fn linear(formats: &[SurfaceFormatKHR]) -> Option<SurfaceFormatKHR>
Helper function to automatically select the best UNORM format, if one is available.
Sourcepub fn linear_or_default(formats: &[SurfaceFormatKHR]) -> SurfaceFormatKHR
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.
Sourcepub fn physical_device_support(
&self,
queue_family_index: u32,
) -> Result<bool, DriverError>
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.
Sourcepub fn present_modes(&self) -> Result<Vec<PresentModeKHR>, DriverError>
pub fn present_modes(&self) -> Result<Vec<PresentModeKHR>, DriverError>
Query supported presentation modes.
Sourcepub fn srgb(formats: &[SurfaceFormatKHR]) -> Option<SurfaceFormatKHR>
pub fn srgb(formats: &[SurfaceFormatKHR]) -> Option<SurfaceFormatKHR>
Helper function to automatically select the best sRGB format, if one is available.
Sourcepub fn srgb_or_default(formats: &[SurfaceFormatKHR]) -> SurfaceFormatKHR
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.