pub struct Instance { /* private fields */ }
Available on
vulkan
only.Implementations§
Source§impl Instance
impl Instance
pub fn expose_adapter(&self, phd: PhysicalDevice) -> Option<ExposedAdapter<Api>>
Source§impl Instance
impl Instance
Sourcepub 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.
Sourcepub 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<DropCallback>,
) -> Result<Self, 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<DropCallback>, ) -> Result<Self, 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§
Source§impl DynResource for Instance
impl DynResource for Instance
Source§impl Instance for Instance
impl Instance for Instance
type A = Api
unsafe fn init(desc: &InstanceDescriptor<'_>) -> Result<Self, InstanceError>
unsafe fn create_surface( &self, display_handle: RawDisplayHandle, window_handle: RawWindowHandle, ) -> Result<Surface, InstanceError>
Source§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