pub struct Surface<W> { /* private fields */ }
Expand description
Represents a surface on the screen.
Creating a Surface
is platform-specific.
Implementations
sourceimpl<W> Surface<W>
impl<W> Surface<W>
sourcepub unsafe fn from_raw_surface(
instance: Arc<Instance>,
handle: SurfaceKHR,
api: SurfaceApi,
win: W
) -> Surface<W>
pub unsafe fn from_raw_surface(
instance: Arc<Instance>,
handle: SurfaceKHR,
api: SurfaceApi,
win: W
) -> Surface<W>
Creates a Surface
given the raw handle.
Safety
handle
must be a valid Vulkan surface handle owned byinstance
.handle
must have been created fromapi
.- The window object that
handle
was created from must outlive the createdSurface
. Thewin
parameter can be used to ensure this.
sourcepub fn from_display_plane(
display_mode: &DisplayMode,
plane: &DisplayPlane
) -> Result<Arc<Surface<()>>, SurfaceCreationError>
pub fn from_display_plane(
display_mode: &DisplayMode,
plane: &DisplayPlane
) -> Result<Arc<Surface<()>>, SurfaceCreationError>
Creates a Surface
from a DisplayPlane
.
Panic
- Panics if
display_mode
andplane
don’t belong to the same physical device. - Panics if
plane
doesn’t support the display ofdisplay_mode
.
sourcepub unsafe fn from_android<T>(
instance: Arc<Instance>,
window: *const T,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
pub unsafe fn from_android<T>(
instance: Arc<Instance>,
window: *const T,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
Creates a Surface
from an Android window.
Safety
window
must be a valid handle.- The object referred to by
window
must outlive the createdSurface
. Thewin
parameter can be used to ensure this.
sourcepub unsafe fn from_ios<T>(
instance: Arc<Instance>,
view: *const T,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
pub unsafe fn from_ios<T>(
instance: Arc<Instance>,
view: *const T,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
Creates a Surface
from an iOS UIView
.
Safety
view
must be a valid handle.- The object referred to by
view
must outlive the createdSurface
. Thewin
parameter can be used to ensure this. - The
UIView
must be backed by aCALayer
instance of typeCAMetalLayer
.
sourcepub unsafe fn from_mac_os<T>(
instance: Arc<Instance>,
view: *const T,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
pub unsafe fn from_mac_os<T>(
instance: Arc<Instance>,
view: *const T,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
Creates a Surface
from a MacOS NSView
.
Safety
view
must be a valid handle.- The object referred to by
view
must outlive the createdSurface
. Thewin
parameter can be used to ensure this. - The
NSView
must be backed by aCALayer
instance of typeCAMetalLayer
.
sourcepub unsafe fn from_metal<T>(
instance: Arc<Instance>,
layer: *const T,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
pub unsafe fn from_metal<T>(
instance: Arc<Instance>,
layer: *const T,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
Creates a Surface
from a Metal CAMetalLayer
.
Safety
layer
must be a valid handle.- The object referred to by
layer
must outlive the createdSurface
. Thewin
parameter can be used to ensure this.
sourcepub unsafe fn from_vi<T>(
instance: Arc<Instance>,
window: *const T,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
pub unsafe fn from_vi<T>(
instance: Arc<Instance>,
window: *const T,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
Creates a Surface
from a code:nn::code:vi::code:Layer
.
Safety
window
must be a valid handle.- The object referred to by
window
must outlive the createdSurface
. Thewin
parameter can be used to ensure this.
sourcepub unsafe fn from_wayland<D, S>(
instance: Arc<Instance>,
display: *const D,
surface: *const S,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
pub unsafe fn from_wayland<D, S>(
instance: Arc<Instance>,
display: *const D,
surface: *const S,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
Creates a Surface
from a Wayland window.
The window’s dimensions will be set to the size of the swapchain.
Safety
display
andsurface
must be valid handles.- The objects referred to by
display
andsurface
must outlive the createdSurface
. Thewin
parameter can be used to ensure this.
sourcepub unsafe fn from_win32<T, U>(
instance: Arc<Instance>,
hinstance: *const T,
hwnd: *const U,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
pub unsafe fn from_win32<T, U>(
instance: Arc<Instance>,
hinstance: *const T,
hwnd: *const U,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
Creates a Surface
from a Win32 window.
The surface’s min, max and current extent will always match the window’s dimensions.
Safety
hinstance
andhwnd
must be valid handles.- The objects referred to by
hwnd
andhinstance
must outlive the createdSurface
. Thewin
parameter can be used to ensure this.
sourcepub unsafe fn from_xcb<C>(
instance: Arc<Instance>,
connection: *const C,
window: u32,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
pub unsafe fn from_xcb<C>(
instance: Arc<Instance>,
connection: *const C,
window: u32,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
Creates a Surface
from an XCB window.
The surface’s min, max and current extent will always match the window’s dimensions.
Safety
connection
andwindow
must be valid handles.- The objects referred to by
connection
andwindow
must outlive the createdSurface
. Thewin
parameter can be used to ensure this.
sourcepub unsafe fn from_xlib<D>(
instance: Arc<Instance>,
display: *const D,
window: c_ulong,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
pub unsafe fn from_xlib<D>(
instance: Arc<Instance>,
display: *const D,
window: c_ulong,
win: W
) -> Result<Arc<Surface<W>>, SurfaceCreationError>
Creates a Surface
from an Xlib window.
The surface’s min, max and current extent will always match the window’s dimensions.
Safety
display
andwindow
must be valid handles.- The objects referred to by
display
andwindow
must outlive the createdSurface
. Thewin
parameter can be used to ensure this.
sourcepub fn api(&self) -> SurfaceApi
pub fn api(&self) -> SurfaceApi
Returns the windowing API that was used to construct the surface.
Trait Implementations
sourceimpl<W> VulkanObject for Surface<W>
impl<W> VulkanObject for Surface<W>
type Object = SurfaceKHR
type Object = SurfaceKHR
The type of the object.
sourcefn internal_object(&self) -> SurfaceKHR
fn internal_object(&self) -> SurfaceKHR
Returns a reference to the object.
impl<W> Eq for Surface<W>
Auto Trait Implementations
impl<W> RefUnwindSafe for Surface<W> where
W: RefUnwindSafe,
impl<W> Send for Surface<W> where
W: Send,
impl<W> Sync for Surface<W> where
W: Sync,
impl<W> Unpin for Surface<W> where
W: Unpin,
impl<W> UnwindSafe for Surface<W> where
W: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more