-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
I ran into a situation where WebGPU adapter creation fails and I want to retry with WebGL (Chrome Linux 121 advertises WebGPU support but can't create adapters -.-)
Turns out though it's actually not easily possible to programmatically determine that this was the error: If the instance is created with both WebGPU & WebGL enabled and adapter creation fails subsequently,it might mean that either of the context type (webgpu or wgpu-core) was picked and failed. Only in the case of a webgpu-instance do I want to retry instance creation.
One hacky way to check for this is the result of as_hal
, but this method is only available when wgpu_core compilation is enabled, and in the context I'm in (egui's guts) I don't know this.
Proposing to add this simple method on wgpu::Instance
:
is_webgpu_instance() -> bool