Skip to main content

init_device_with_api

Function init_device_with_api 

Source
pub fn init_device_with_api<G: GraphicsApi>(
    setup: WgpuSetup,
    options: RuntimeOptions,
) -> WgpuDevice
Expand description

Import a setup with an explicitly selected graphics API.

With msl enabled, importing through crate::Metal requires native MSL support. AutoGraphicsApi permits WGSL fallback, as init_device does.

Like init_device, each call generates a unique device ID; do not import the same setup twice.

§Panics

If configuration is invalid, the requested API differs from the setup’s backend, the selected compiler is unavailable, or registration fails. Use try_init_device_with_api to handle these errors.