pub struct Instance { /* private fields */ }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,
memory_budget_thresholds: MemoryBudgetThresholds,
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, memory_budget_thresholds: MemoryBudgetThresholds, has_nv_optimus: bool, drop_callback: Option<DropCallback>, ) -> Result<Self, 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.
Sourcepub unsafe fn init_with_callback(
desc: &InstanceDescriptor<'_>,
callback: Option<Box<CreateInstanceCallback<'_>>>,
) -> Result<Self, InstanceError>
pub unsafe fn init_with_callback( desc: &InstanceDescriptor<'_>, callback: Option<Box<CreateInstanceCallback<'_>>>, ) -> Result<Self, 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§
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 WebGL2