Struct vulkano::swapchain::Surface

source ·
pub struct Surface { /* private fields */ }
Expand description

Represents a surface on the screen.

Creating a Surface is platform-specific.

Implementations§

source§

impl Surface

source

pub fn required_extensions( event_loop: &impl HasRawDisplayHandle ) -> InstanceExtensions

Returns the instance extensions required to create a surface from a window of the given event loop.

source

pub fn from_window( instance: Arc<Instance>, window: Arc<impl HasRawWindowHandle + HasRawDisplayHandle + Any + Send + Sync> ) -> Result<Arc<Self>, Validated<VulkanError>>

Creates a new Surface from the given window.

source

pub unsafe fn from_window_ref( instance: Arc<Instance>, window: &(impl HasRawWindowHandle + HasRawDisplayHandle) ) -> Result<Arc<Self>, Validated<VulkanError>>

Creates a new Surface from the given window without ensuring that the window outlives the surface.

Safety
  • The given window must outlive the created surface.
source

pub unsafe fn from_handle( instance: Arc<Instance>, handle: SurfaceKHR, api: SurfaceApi, object: Option<Arc<dyn Any + Send + Sync>> ) -> Self

Creates a Surface from a raw handle.

Safety
  • handle must be a valid Vulkan object handle created from instance.
  • handle must have been created using the function specified by api.
  • The window object that handle was created from must outlive the created Surface. The object parameter can be used to ensure this.
source

pub fn headless( instance: Arc<Instance>, object: Option<Arc<dyn Any + Send + Sync>> ) -> Result<Arc<Self>, Validated<VulkanError>>

Creates a Surface with no backing window or display.

Presenting to a headless surface does nothing, so this is mostly useless in itself. However, it may be useful for testing, and it is available for future extensions to layer on top of.

source

pub fn from_display_plane( display_mode: Arc<DisplayMode>, create_info: DisplaySurfaceCreateInfo ) -> Result<Arc<Self>, Validated<VulkanError>>

Creates a Surface from a DisplayMode and display plane.

source

pub unsafe fn from_android<W>( instance: Arc<Instance>, window: *const W, object: Option<Arc<dyn Any + Send + Sync>> ) -> Result<Arc<Self>, Validated<VulkanError>>

Creates a Surface from an Android window.

Safety
  • window must be a valid Android ANativeWindow handle.
  • The object referred to by window must outlive the created Surface. The object parameter can be used to ensure this.
source

pub unsafe fn from_directfb<D, S>( instance: Arc<Instance>, dfb: *const D, surface: *const S, object: Option<Arc<dyn Any + Send + Sync>> ) -> Result<Arc<Self>, Validated<VulkanError>>

Creates a Surface from a DirectFB surface.

Safety
  • dfb must be a valid DirectFB IDirectFB handle.
  • surface must be a valid DirectFB IDirectFBSurface handle.
  • The object referred to by dfb and surface must outlive the created Surface. The object parameter can be used to ensure this.
source

pub unsafe fn from_fuchsia_image_pipe( instance: Arc<Instance>, image_pipe_handle: zx_handle_t, object: Option<Arc<dyn Any + Send + Sync>> ) -> Result<Arc<Self>, Validated<VulkanError>>

Creates a Surface from an Fuchsia ImagePipe.

Safety
  • image_pipe_handle must be a valid Fuchsia zx_handle_t handle.
  • The object referred to by image_pipe_handle must outlive the created Surface. The object parameter can be used to ensure this.
source

pub unsafe fn from_ggp_stream_descriptor( instance: Arc<Instance>, stream_descriptor: GgpStreamDescriptor, object: Option<Arc<dyn Any + Send + Sync>> ) -> Result<Arc<Self>, Validated<VulkanError>>

Creates a Surface from a Google Games Platform stream descriptor.

Safety
  • stream_descriptor must be a valid Google Games Platform GgpStreamDescriptor handle.
  • The object referred to by stream_descriptor must outlive the created Surface. The object parameter can be used to ensure this.
source

pub unsafe fn from_metal<L>( instance: Arc<Instance>, layer: *const L, object: Option<Arc<dyn Any + Send + Sync>> ) -> Result<Arc<Self>, Validated<VulkanError>>

Creates a Surface from a Metal CAMetalLayer.

Safety
  • layer must be a valid Metal CAMetalLayer handle.
  • The object referred to by layer must outlive the created Surface. The object parameter can be used to ensure this.
source

pub unsafe fn from_qnx_screen<C, W>( instance: Arc<Instance>, context: *const C, window: *const W, object: Option<Arc<dyn Any + Send + Sync>> ) -> Result<Arc<Self>, Validated<VulkanError>>

Creates a Surface from a QNX Screen window.

Safety
  • context must be a valid QNX Screen _screen_context handle.
  • window must be a valid QNX Screen _screen_window handle.
  • The object referred to by window must outlive the created Surface. The object parameter can be used to ensure this.
source

pub unsafe fn from_vi<W>( instance: Arc<Instance>, window: *const W, object: Option<Arc<dyn Any + Send + Sync>> ) -> Result<Arc<Self>, Validated<VulkanError>>

Creates a Surface from a code:nn::code:vi::code:Layer.

Safety
  • window must be a valid nn::vi::NativeWindowHandle handle.
  • The object referred to by window must outlive the created Surface. The object parameter can be used to ensure this.
source

pub unsafe fn from_wayland<D, S>( instance: Arc<Instance>, display: *const D, surface: *const S, object: Option<Arc<dyn Any + Send + Sync>> ) -> Result<Arc<Self>, Validated<VulkanError>>

Creates a Surface from a Wayland window.

The window’s dimensions will be set to the size of the swapchain.

Safety
  • display must be a valid Wayland wl_display handle.
  • surface must be a valid Wayland wl_surface handle.
  • The objects referred to by display and surface must outlive the created Surface. The object parameter can be used to ensure this.
source

pub unsafe fn from_win32<I, W>( instance: Arc<Instance>, hinstance: *const I, hwnd: *const W, object: Option<Arc<dyn Any + Send + Sync>> ) -> Result<Arc<Self>, Validated<VulkanError>>

Creates a Surface from a Win32 window.

The surface’s min, max and current extent will always match the window’s dimensions.

Safety
  • hinstance must be a valid Win32 HINSTANCE handle.
  • hwnd must be a valid Win32 HWND handle.
  • The objects referred to by hwnd and hinstance must outlive the created Surface. The object parameter can be used to ensure this.
source

pub unsafe fn from_xcb<C>( instance: Arc<Instance>, connection: *const C, window: xcb_window_t, object: Option<Arc<dyn Any + Send + Sync>> ) -> Result<Arc<Self>, Validated<VulkanError>>

Creates a Surface from an XCB window.

The surface’s min, max and current extent will always match the window’s dimensions.

Safety
  • connection must be a valid X11 xcb_connection_t handle.
  • window must be a valid X11 xcb_window_t handle.
  • The objects referred to by connection and window must outlive the created Surface. The object parameter can be used to ensure this.
source

pub unsafe fn from_xlib<D>( instance: Arc<Instance>, display: *const D, window: Window, object: Option<Arc<dyn Any + Send + Sync>> ) -> Result<Arc<Self>, Validated<VulkanError>>

Creates a Surface from an Xlib window.

The surface’s min, max and current extent will always match the window’s dimensions.

Safety
  • display must be a valid Xlib Display handle.
  • window must be a valid Xlib Window handle.
  • The objects referred to by display and window must outlive the created Surface. The object parameter can be used to ensure this.
source

pub fn instance(&self) -> &Arc<Instance>

Returns the instance this surface was created with.

source

pub fn api(&self) -> SurfaceApi

Returns the windowing API that was used to construct the surface.

source

pub fn object(&self) -> Option<&Arc<dyn Any + Send + Sync>>

Returns a reference to the object parameter that was passed when creating the surface.

Trait Implementations§

source§

impl Debug for Surface

source§

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

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§

impl Hash for Surface

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl InstanceOwned for Surface

source§

fn instance(&self) -> &Arc<Instance>

Returns the instance that owns self.
source§

impl PartialEq for Surface

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl VulkanObject for Surface

§

type Handle = SurfaceKHR

The type of the object.
source§

fn handle(&self) -> Self::Handle

Returns the raw Vulkan handle of the object.
source§

impl Eq for Surface

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.