Struct Instance
pub struct Instance { /* private fields */ }
Available on crate feature
unstable-wgpu-24
only.Implementations§
§impl Instance
impl Instance
pub fn expose_adapter(&self, phd: PhysicalDevice) -> Option<ExposedAdapter<Api>>
§impl Instance
impl Instance
pub fn desired_extensions(
entry: &Entry,
_instance_api_version: u32,
flags: InstanceFlags,
) -> Result<Vec<&'static CStr>, InstanceError>
pub fn desired_extensions( entry: &Entry, _instance_api_version: u32, flags: InstanceFlags, ) -> Result<Vec<&'static CStr>, InstanceError>
Return the instance extension names wgpu would like to enable.
Return a vector of the names of instance extensions actually available
on entry
that wgpu would like to enable.
The instance_api_version
argument should be the instance’s Vulkan API
version, as obtained from vkEnumerateInstanceVersion
. This is the same
space of values as the VK_API_VERSION
constants.
Note that wgpu can function without many of these extensions (for
example, VK_KHR_wayland_surface
is certainly not going to be available
everywhere), but if one of these extensions is available at all, wgpu
assumes that it has been enabled.
pub unsafe fn from_raw(
entry: Entry,
raw_instance: Instance,
instance_api_version: u32,
android_sdk_version: u32,
debug_utils_create_info: Option<DebugUtilsCreateInfo>,
extensions: Vec<&'static CStr>,
flags: InstanceFlags,
has_nv_optimus: bool,
drop_callback: Option<Box<dyn FnOnce() + Sync + Send>>,
) -> Result<Instance, InstanceError>
pub unsafe fn from_raw( entry: Entry, raw_instance: Instance, instance_api_version: u32, android_sdk_version: u32, debug_utils_create_info: Option<DebugUtilsCreateInfo>, extensions: Vec<&'static CStr>, flags: InstanceFlags, has_nv_optimus: bool, drop_callback: Option<Box<dyn FnOnce() + Sync + Send>>, ) -> Result<Instance, InstanceError>
§Safety
raw_instance
must be created fromentry
raw_instance
must be created respectinginstance_api_version
,extensions
andflags
extensions
must be a superset ofdesired_extensions()
and must be created from the same entry, `instance_api_version`` and flags.android_sdk_version
is ignored and can be0
for all platforms besides Android- If
drop_callback
isNone
, wgpu-hal will take ownership ofraw_instance
. Ifdrop_callback
isSome
,raw_instance
must be valid until the callback is called.
If debug_utils_user_data
is Some
, then the validation layer is
available, so create a [vk::DebugUtilsMessengerEXT
].
Trait Implementations§
§impl DynResource for Instance
impl DynResource for Instance
§impl Instance for Instance
impl Instance for Instance
type A = Api
unsafe fn init(desc: &InstanceDescriptor<'_>) -> Result<Instance, InstanceError>
unsafe fn create_surface( &self, display_handle: RawDisplayHandle, window_handle: RawWindowHandle, ) -> Result<Surface, InstanceError>
§unsafe fn enumerate_adapters(
&self,
_surface_hint: Option<&Surface>,
) -> Vec<ExposedAdapter<Api>>
unsafe fn enumerate_adapters( &self, _surface_hint: Option<&Surface>, ) -> Vec<ExposedAdapter<Api>>
surface_hint
is only used by the GLES backend targeting WebGL2Auto 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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<I> DynInstance for Iwhere
I: Instance + DynResource,
impl<I> DynInstance for Iwhere
I: Instance + DynResource,
unsafe fn create_surface( &self, display_handle: RawDisplayHandle, window_handle: RawWindowHandle, ) -> Result<Box<dyn DynSurface>, InstanceError>
unsafe fn enumerate_adapters( &self, surface_hint: Option<&(dyn DynSurface + 'static)>, ) -> Vec<DynExposedAdapter>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more