pub async fn new_instance_with_webgpu_detection(
instance_desc: InstanceDescriptor,
) -> Instance
Expand description
Create an new instance of wgpu, but disabling Backends::BROWSER_WEBGPU
if no WebGPU support was detected.
If the instance descriptor enables Backends::BROWSER_WEBGPU
,
this checks via is_browser_webgpu_supported
for WebGPU support before forwarding
the descriptor with or without Backends::BROWSER_WEBGPU
respecitively to Instance::new
.
You should prefer this method over Instance::new
if you want to target WebGPU and automatically
fall back to WebGL if WebGPU is not available.
This is because WebGPU support has to be decided upon instance creation and Instance::new
(being a sync
function) can’t establish WebGPU support (details see is_browser_webgpu_supported
).
§Panics
If no backend feature for the active target platform is enabled,
this method will panic, see Instance::enabled_backend_features()
.