Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow checking type of wgpu::Instance's context #5142

Open
Wumpf opened this issue Jan 26, 2024 · 0 comments
Open

Allow checking type of wgpu::Instance's context #5142

Wumpf opened this issue Jan 26, 2024 · 0 comments
Labels
area: api Issues related to API surface

Comments

@Wumpf
Copy link
Member

Wumpf commented Jan 26, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api Issues related to API surface
Projects
None yet
Development

No branches or pull requests

1 participant