pub struct Instance {
pub name: String,
pub instance_per_backend: Vec<(Backend, Box<dyn DynInstance>)>,
pub flags: InstanceFlags,
}
Fields§
§name: String
§instance_per_backend: Vec<(Backend, Box<dyn DynInstance>)>
List of instances per backend.
The ordering in this list implies prioritization and needs to be preserved.
flags: InstanceFlags
Implementations§
Source§impl Instance
impl Instance
pub fn new(name: &str, instance_desc: InstanceDescriptor) -> Self
pub fn raw(&self, backend: Backend) -> Option<&dyn DynInstance>
Sourcepub unsafe fn as_hal<A: HalApi>(&self) -> Option<&A::Instance>
pub unsafe fn as_hal<A: HalApi>(&self) -> Option<&A::Instance>
§Safety
- The raw instance handle returned must not be manually destroyed.
Sourcepub unsafe fn create_surface(
&self,
display_handle: RawDisplayHandle,
window_handle: RawWindowHandle,
) -> Result<Surface, CreateSurfaceError>
Available on crate feature raw-window-handle
only.
pub unsafe fn create_surface( &self, display_handle: RawDisplayHandle, window_handle: RawWindowHandle, ) -> Result<Surface, CreateSurfaceError>
raw-window-handle
only.Creates a new surface targeting the given display/window handles.
Internally attempts to create hal surfaces for all enabled backends.
Fails only if creation for surfaces for all enabled backends fails in which case the error for each enabled backend is listed. Vice versa, if creation for any backend succeeds, success is returned. Surface creation errors are logged to the debug log in any case.
§Safety
display_handle
must be a valid object to create a surface upon.window_handle
must remain valid as long as the returnedSurfaceId
is being used.
Sourcepub unsafe fn create_surface_from_visual(
&self,
visual: *mut c_void,
) -> Result<Surface, CreateSurfaceError>
Available on dx12
only.
pub unsafe fn create_surface_from_visual( &self, visual: *mut c_void, ) -> Result<Surface, CreateSurfaceError>
dx12
only.§Safety
The visual must be valid and able to be used to make a swapchain with.
Sourcepub unsafe fn create_surface_from_surface_handle(
&self,
surface_handle: *mut c_void,
) -> Result<Surface, CreateSurfaceError>
Available on dx12
only.
pub unsafe fn create_surface_from_surface_handle( &self, surface_handle: *mut c_void, ) -> Result<Surface, CreateSurfaceError>
dx12
only.§Safety
The surface_handle must be valid and able to be used to make a swapchain with.
Sourcepub unsafe fn create_surface_from_swap_chain_panel(
&self,
swap_chain_panel: *mut c_void,
) -> Result<Surface, CreateSurfaceError>
Available on dx12
only.
pub unsafe fn create_surface_from_swap_chain_panel( &self, swap_chain_panel: *mut c_void, ) -> Result<Surface, CreateSurfaceError>
dx12
only.§Safety
The swap_chain_panel must be valid and able to be used to make a swapchain with.
pub fn enumerate_adapters(&self, backends: Backends) -> Vec<Adapter>
pub fn request_adapter( &self, desc: &RequestAdapterOptions<&Surface>, backends: Backends, ) -> Result<Adapter, RequestAdapterError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Instance
impl !RefUnwindSafe for Instance
impl Send for Instance
impl Sync for Instance
impl Unpin for Instance
impl !UnwindSafe for Instance
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