pub struct Surface<B: Backend> { /* private fields */ }
Expand description
Rendering target bound to window.
Implementations§
Source§impl<B> Surface<B>where
B: Backend,
impl<B> Surface<B>where
B: Backend,
Sourcepub fn instance_id(&self) -> InstanceId
pub fn instance_id(&self) -> InstanceId
Get owned id.
Sourcepub fn assert_instance_owner(&self, instance: &Instance<B>)
pub fn assert_instance_owner(&self, instance: &Instance<B>)
Assert specified instance is owner.
Source§impl<B> Surface<B>where
B: Backend,
impl<B> Surface<B>where
B: Backend,
Sourcepub fn new(
instance: &Instance<B>,
handle: &impl HasRawWindowHandle,
) -> Result<Self, InitError>
pub fn new( instance: &Instance<B>, handle: &impl HasRawWindowHandle, ) -> Result<Self, InitError>
Create surface for the window.
Sourcepub unsafe fn new_with(
instance: &Instance<B>,
f: impl FnOnce(&B::Instance) -> B::Surface,
) -> Self
pub unsafe fn new_with( instance: &Instance<B>, f: impl FnOnce(&B::Instance) -> B::Surface, ) -> Self
Create surface from instance
.
§Safety
Closure must return surface object created from raw instance provided as closure argument.
Sourcepub unsafe fn from_raw(surface: B::Surface, instance: InstanceId) -> Self
pub unsafe fn from_raw(surface: B::Surface, instance: InstanceId) -> Self
Create surface from raw parts.
Source§impl<B> Surface<B>where
B: Backend,
impl<B> Surface<B>where
B: Backend,
Sourcepub unsafe fn extent(
&self,
physical_device: &B::PhysicalDevice,
) -> Option<Extent2D>
pub unsafe fn extent( &self, physical_device: &B::PhysicalDevice, ) -> Option<Extent2D>
Get current extent of the surface.
Sourcepub unsafe fn format(&self, physical_device: &B::PhysicalDevice) -> Format
pub unsafe fn format(&self, physical_device: &B::PhysicalDevice) -> Format
Get surface ideal format.
Sourcepub unsafe fn supported_formats(
&self,
physical_device: &B::PhysicalDevice,
) -> Option<Vec<Format>>
pub unsafe fn supported_formats( &self, physical_device: &B::PhysicalDevice, ) -> Option<Vec<Format>>
Get formats supported by surface
§Safety
physical_device
must be created from sameInstance
as theSurface
Sourcepub unsafe fn capabilities(
&self,
physical_device: &B::PhysicalDevice,
) -> SurfaceCapabilities
pub unsafe fn capabilities( &self, physical_device: &B::PhysicalDevice, ) -> SurfaceCapabilities
Get formats supported by surface
§Safety
physical_device
must be created from sameInstance
as theSurface
Sourcepub unsafe fn into_target(
self,
physical_device: &B::PhysicalDevice,
device: &Device<B>,
suggest_extent: Extent2D,
image_count: u32,
present_mode: PresentMode,
usage: Usage,
) -> Result<Target<B>, SwapchainError>
pub unsafe fn into_target( self, physical_device: &B::PhysicalDevice, device: &Device<B>, suggest_extent: Extent2D, image_count: u32, present_mode: PresentMode, usage: Usage, ) -> Result<Target<B>, SwapchainError>
Cast surface into render target.
Trait Implementations§
Auto Trait Implementations§
impl<B> Freeze for Surface<B>
impl<B> RefUnwindSafe for Surface<B>
impl<B> Send for Surface<B>
impl<B> Sync for Surface<B>
impl<B> Unpin for Surface<B>
impl<B> UnwindSafe for Surface<B>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more