-
Notifications
You must be signed in to change notification settings - Fork 969
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
WebGPU support detection doesn't handle failure at getContext()
#5332
Comments
I would like to also enable WebGPU support, as that no longer needs special unstable flags, but doing so breaks WebGL on Firefox: <gfx-rs/wgpu#5332>
As I understand |
Oh, this is actually a feasible workaround in applications which create the instance and adapter together, since it can be done purely using the wgpu API! I'll have to try that. Would be nice to have it mentioned in wgpu's docs until this bug can be fixed (or Firefox can be ?more conformant?). |
I tried implementing the workaround: creating an instance, surface, and adapter first with
This appears to be the bug already fixed by #5166. But it can be avoided by using |
I'm getting this as well. Tried running it locally and https://wgpu.rs/examples/?backend=webgpu&example=bunnymark both give the same error. I'm going to investigate it unless a fix is already in the works
|
There is not, go ahead :) |
So it seems that firefox only supports WebGPU API on Nightly, I tried it with nightly and its works. |
I for one observed that issue on Linux Chrome where they (afaik as of writing) still don't support WebGPU. wgpu incorrectly picks webgpu over webgl there |
There's now proper webgpu supprot via new utilities: But I think we still have to use that in the samples correctly! |
Description
Enabling the "webgpu" backend can cause WebGL support to be lost.
Repro steps
dom.webgpu.enabled
to true.Expected vs observed behavior
Expected: The demo should display, using either webgpu or webgl2.
Observed: it fails to initialize:
CreateSurfaceError { inner: Web("canvas.getContext() returned null; webgpu not available or canvas already in use") }
WebGPU detection is presumably concluding WebGPU is supported because
navigator.gpu
exists, but that is evidently not sufficient.(Note that it is also possible for a canvas to return null for the context simply because it was previously used as
"webgl2"
rather than"webgpu"
. That would be nice to support too, but since it would require a simultaneous WebGPU-or-WebGL2 backend, understandable to skip.)Platform
The text was updated successfully, but these errors were encountered: