pub struct Instance {
pub flags: InstanceFlags,
/* private fields */
}Fields§
§flags: InstanceFlagsImplementations§
Source§impl Instance
impl Instance
pub fn new( name: &str, instance_desc: InstanceDescriptor, telemetry: Option<Telemetry>, ) -> Arc<Self> ⓘ
pub fn from_hal_instance<A: Api>( name: String, hal_instance: <A as Api>::Instance, ) -> Arc<Self> ⓘ
pub fn raw(&self, backend: Backend) -> Option<&dyn DynInstance>
Sourcepub unsafe fn as_hal<A: Api>(&self) -> Option<&A::Instance>
pub unsafe fn as_hal<A: Api>(&self) -> Option<&A::Instance>
§Safety
- The raw instance handle returned must not be manually destroyed.
Sourcepub unsafe fn create_surface(
&self,
display_handle: Option<RawDisplayHandle>,
window_handle: RawWindowHandle,
) -> Result<Arc<Surface>, CreateSurfaceError>
pub unsafe fn create_surface( &self, display_handle: Option<RawDisplayHandle>, window_handle: RawWindowHandle, ) -> Result<Arc<Surface>, CreateSurfaceError>
Creates a new surface targeting the given display/window handles.
Internally attempts to create hal surfaces for all enabled backends.
Fails only if creation for surfaces for all enabled backends fails in which case the error for each enabled backend is listed. Vice versa, if creation for any backend succeeds, success is returned. Surface creation errors are logged to the debug log in any case.
§Safety
display_handlemust be a valid object to create a surface upon, falls back to the instance display handle otherwise.window_handlemust remain valid as long as the returnedSurfaceis being used.
Sourcepub unsafe fn create_surface_from_drm(
&self,
fd: i32,
plane: u32,
connector_id: u32,
width: u32,
height: u32,
refresh_rate: u32,
) -> Result<Arc<Surface>, CreateSurfaceError>
Available on drm only.
pub unsafe fn create_surface_from_drm( &self, fd: i32, plane: u32, connector_id: u32, width: u32, height: u32, refresh_rate: u32, ) -> Result<Arc<Surface>, CreateSurfaceError>
drm only.pub fn enumerate_adapters( self: &Arc<Self>, backends: Backends, apply_limit_buckets: bool, ) -> Vec<Arc<Adapter>>
Sourcepub fn request_adapters(
self: &Arc<Self>,
desc: &RequestAdapterOptions<&Surface>,
backends: Backends,
) -> Result<Vec<Arc<Adapter>>, RequestAdapterError>
pub fn request_adapters( self: &Arc<Self>, desc: &RequestAdapterOptions<&Surface>, backends: Backends, ) -> Result<Vec<Arc<Adapter>>, RequestAdapterError>
Returns a list of adapters that match the given request options and are compatible with the specified backends.
On success at least one compatible adapter will be returned in the resulting vector.
pub fn request_adapter( self: &Arc<Self>, desc: &RequestAdapterOptions<&Surface>, backends: Backends, ) -> Result<Arc<Adapter>, RequestAdapterError>
Sourcepub unsafe fn create_adapter_from_hal(
self: &Arc<Self>,
hal_adapter: DynExposedAdapter,
) -> Arc<Adapter> ⓘ
pub unsafe fn create_adapter_from_hal( self: &Arc<Self>, hal_adapter: DynExposedAdapter, ) -> Arc<Adapter> ⓘ
Create an adapter from a HAL adapter.
The HAL adapter may be obtained e.g. by calling enumerate_adapters on
the HAL directly.
If limit bucketing is desired, crate::limits::apply_limit_buckets
should be called with the HAL adapter before calling this function.
§Safety
hal_adapter must be created from this global internal instance handle.
Sourcepub fn poll_all_devices(&self, force_wait: bool) -> Result<bool, WaitIdleError>
pub fn poll_all_devices(&self, force_wait: bool) -> Result<bool, WaitIdleError>
Poll all devices on all backends.
This is the implementation of wgpu::Instance::poll_all.
Return all_queue_empty indicating whether there are more queue
submissions still in flight.