-
Notifications
You must be signed in to change notification settings - Fork 959
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
webgl fallback fails in some browsers. #6166
Comments
I think this might be expected. You say that:
But actually, the way
So One way around this, inspired by |
Could the webgpu detection in wgpu take on this extra case? |
I wrote that awful long comment on eframe & the accompanying workaround, so I'm also very interested in finding a better solution, just haven't figured out yet how to do so elegantly :( |
Is adapter/surface/device creation really that performance-sensitive of an operation? Genuine question, it surprises me but I'd believe you if you told me it was true |
I fear could put a significant cost on startup time. Whether that's performance sensitive depends on your application but it would be pretty awful if every wgpu application on the web were to take 100ms (made up, I believe it's bad but likely not that bad) extra to start without any way to opt out of it. Something I forgot which makes this even harder: adapter creation requires handing back control to the browser (it's async!) which then would make instance creation async and I'd really like to avoid that. |
I guess the way I see it is, if you want your application to be compatible with all browsers while using webgpu (both webgl and webgpu), you HAVE to take that 100ms (madeup) cost anyway, its just that currently you have to do it manually with some hack rather than having wgpu handle that for you. If you dont want to take that cost and can avoid supporting all browsers, then just disable the webgl feature which would also disable that check. So I think that the wgpu project needs to take one of these actions:
Maybe one day this will issue will resolve itself if chrome can either support webgpu or not fail to support it in a broken way. But I think it is inappropriate to take no action in the meantime. |
agreed, we have to bite the bullet here regardless. The only question is how sophisticated we need to be about creating the adapter only once on the happy path. A good first step would be to provide this as a free function on all webgpu enabled wgpu builds since it's a useful utility regardless. This opens a much easier way to deal with the problem in general. Now, the tricky bit remains of how to handle this logic on Feels very related to some of the wgpu context dispatching refactors @cwfitzgerald had in mind (is there a ticket about this?) |
Correct me if I'm missing something, but I think you could avoid this. It might be a little tricky to wire it all up, but I think you can make it so that
So, you could make |
I started looking a bit deeper into it but the surface creation story is as I feared really tricky. WebGL needs the surface to be created before adapter creation (it has to be passed as
otherwise I think the "undecided instance" approach can work, already started prototyping it. Not sure yet if I want to extend that to the surface or handle it differently 🤔. Pushed the few things I have as of writing to https://github.com/Wumpf/wgpu/tree/wip-multi-context-instance-and-surface
pretty much everything is send/sync on native and not at all on wasm unless |
Urgh, this is just too messy for something that can be solved realtively easy in user land if aforementioned utilities are provided. I'll instead look into that and document everything out + providing a sample rather than spending more energy on "undecided" surfaces & adapters. If someone else wants to pick up that thread, I put the barely started sketch here now https://github.com/Wumpf/wgpu/tree/wip-multi-context-instance-and-surface Recap of how stuff works today, highlighting why things are hard:
|
Thankyou so much for your work on this, I would like to find time to test it but have been very busy lately. |
Description
My understanding is that when the
webgpu
andwebgl
cargo features are enabled andBackends::all()
is set, the adapter should attempt to be created with webgpu and then failing that fallback to webgl.However that doesnt seem to be happening in chrome on my machine (linux) and chrome on a users machine (windows 10)
It does however seem to work fine on firefox on my machine.
This issue is not present in the wgpu examples, but I cant figure out what is different between the example and my (isolated) code
Repro steps
Expected vs observed behavior
I expect the project to work on chrome on my machine, it does not.
Extra materials
Fails on chrome:
Succeeds on firefox:
The text was updated successfully, but these errors were encountered: