Struct Instance

Source
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

Source

pub fn new(name: &str, instance_desc: &InstanceDescriptor) -> Self

Source

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.

Source

pub(crate) fn from_hal_instance<A: HalApi>( name: String, hal_instance: <A as Api>::Instance, ) -> Self

Source

pub fn raw(&self, backend: Backend) -> Option<&dyn DynInstance>

Source

pub unsafe fn as_hal<A: HalApi>(&self) -> Option<&A::Instance>

§Safety
  • The raw instance handle returned must not be manually destroyed.
Source

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>

Creates a new surface from the given drm configuration.

§Safety
  • All parameters must point to valid DRM values.
§Platform Support

This function is only available on non-apple Unix-like platforms (Linux, FreeBSD) and currently only works with the Vulkan backend.

Source

pub fn enumerate_adapters(&self, backends: Backends) -> Vec<Adapter>

Source

pub fn request_adapter( &self, desc: &RequestAdapterOptions<&Surface>, backends: Backends, ) -> Result<Adapter, RequestAdapterError>

Source

fn active_backends(&self) -> Backends

Trait Implementations§

Source§

impl Default for Instance

Source§

fn default() -> Instance

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

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

Source§

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,