pub struct Instance {
name: String,
instance_per_backend: Vec<(Backend, Box<dyn DynInstance>)>,
requested_backends: Backends,
supported_backends: Backends,
pub flags: InstanceFlags,
}
Fields§
§name: String
§instance_per_backend: Vec<(Backend, Box<dyn DynInstance>)>
List of instances per wgpu-hal
backend.
The ordering in this list implies prioritization and needs to be preserved.
requested_backends: Backends
The backends that were requested by the user.
supported_backends: Backends
The backends that we could have attempted to obtain from wgpu-hal
—
those for which support is compiled in, currently.
The union of this and requested_backends
is the set of backends that would be used,
independent of whether accessing the drivers/hardware for them succeeds.
To obtain the set of backends actually in use by this instance, check
instance_per_backend
instead.
flags: InstanceFlags
Implementations§
Source§impl Instance
impl Instance
pub fn new(name: &str, instance_desc: &InstanceDescriptor) -> Self
Sourcefn try_add_hal<A: HalApi>(&mut self, _: A, instance_desc: &InstanceDescriptor)
fn try_add_hal<A: HalApi>(&mut self, _: A, instance_desc: &InstanceDescriptor)
Helper for Instance::new()
; attempts to add a single wgpu-hal
backend to this instance.
pub(crate) fn from_hal_instance<A: HalApi>( name: String, hal_instance: <A as Api>::Instance, ) -> 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_from_drm(
&self,
fd: i32,
plane: u32,
connector_id: u32,
width: u32,
height: u32,
refresh_rate: u32,
) -> Result<Surface, CreateSurfaceError>
pub unsafe fn create_surface_from_drm( &self, fd: i32, plane: u32, connector_id: u32, width: u32, height: u32, refresh_rate: u32, ) -> Result<Surface, CreateSurfaceError>
pub fn enumerate_adapters(&self, backends: Backends) -> Vec<Adapter>
pub fn request_adapter( &self, desc: &RequestAdapterOptions<&Surface>, backends: Backends, ) -> Result<Adapter, RequestAdapterError>
fn active_backends(&self) -> Backends
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