Struct Instance
pub struct Instance { /* private fields */ }unstable-wgpu-27 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,
memory_budget_thresholds: MemoryBudgetThresholds,
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, memory_budget_thresholds: MemoryBudgetThresholds, has_nv_optimus: bool, drop_callback: Option<Box<dyn FnOnce() + Sync + Send>>, ) -> Result<Instance, InstanceError>
§Safety
raw_instancemust be created fromentryraw_instancemust be created respectinginstance_api_version,extensionsandflagsextensionsmust be a superset ofdesired_extensions()and must be created from the same entry, `instance_api_version`` and flags.android_sdk_versionis ignored and can be0for all platforms besides Android- If
drop_callbackisNone, wgpu-hal will take ownership ofraw_instance. Ifdrop_callbackisSome,raw_instancemust 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].
pub unsafe fn init_with_callback(
desc: &InstanceDescriptor<'_>,
callback: Option<Box<dyn for<'arg, 'pnext> FnOnce(CreateInstanceCallbackArgs<'arg, 'pnext, '_>) + '_>>,
) -> Result<Instance, InstanceError>
pub unsafe fn init_with_callback( desc: &InstanceDescriptor<'_>, callback: Option<Box<dyn for<'arg, 'pnext> FnOnce(CreateInstanceCallbackArgs<'arg, 'pnext, '_>) + '_>>, ) -> Result<Instance, InstanceError>
Instance::init but with a callback.
If you want to add extensions, add the to the Vec<'static CStr> not the create info, otherwise
it will be overwritten
§Safety:
Same as init but additionally
- Callback must not remove features.
- Callback must not change anything to what the instance does not support.
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
§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>
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>
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)
&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)
&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>
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>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.