pub struct Instance {
shared: Arc<InstanceShared>,
}
Fields§
Implementations§
source§impl Instance
impl Instance
pub fn expose_adapter(&self, phd: PhysicalDevice) -> Option<ExposedAdapter<Api>>
source§impl Instance
impl Instance
fn enumerate_instance_extension_properties( entry: &Entry, layer_name: Option<&CStr>, ) -> Result<Vec<ExtensionProperties>, InstanceError>
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
.
fn create_surface_from_xlib( &self, dpy: *mut Display, window: Window, ) -> Result<Surface, InstanceError>
fn create_surface_from_xcb( &self, connection: *mut xcb_connection_t, window: xcb_window_t, ) -> Result<Surface, InstanceError>
fn create_surface_from_wayland( &self, display: *mut wl_display, surface: *mut wl_surface, ) -> Result<Surface, InstanceError>
fn create_surface_android( &self, window: *mut ANativeWindow, ) -> Result<Surface, InstanceError>
fn create_surface_from_hwnd( &self, hinstance: HINSTANCE, hwnd: HWND, ) -> Result<Surface, InstanceError>
fn create_surface_from_vk_surface_khr(&self, surface: SurfaceKHR) -> Surface
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