-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
WASMs that I create crash Chrome unless the devtools are open #3867
Comments
If you are running WebGPU backend instead of WebGL2 then looks like regression in Google's Dawn (canary) implementation of WebGPU compared with WGPU used in Firefox (nightly). If this is WebGL2 then looks like upstream problem caused by Chrome itself since you said it works in Firefox. |
Appreciate the info @heavyrain266 . I'm new to this, so I'm not sure what "WebGPU backend instead of WebGL2" means in this context. My understanding according to this post was that generating the wasms in the way described therein (which is what I am doing) would leverage new built-in support for "a native WebGL2 backend to wgpu". If you can point me to a resource that shows how to switch between the cases you're describing (WGPU vs WebGL2 in Bevy 0.6.0), I'd appreciate it. Unless you are describing a dichotomy that existed pre-0.6.0? In any case, is there any course of action I can take, or is this something that I should expect to get fixed upstream eventually? |
By default Bevy 0.6 should use WebGL2 (OpenGL in the browser) but if you use Chrome canary or Frefox nightly with enabled WebGPU then Bevy will use Vulkan, Metal or DirectX 12 for renderer and in both cases if it fails to run in Chrome then looks like it's fully upstream problems caused by Chrome and their implementation of WebGL2/WebGPU if any other browser can run it just fine. |
Ok, embarrassingly the issue was that I was not building with the "--release" argument. After seeing a discussion on Discord, I changed my build commands to:
and everything is working as expected. Thank you for your help and input, I learned some things! |
That's strange though. Are we expecting Wasm to error out in debug mode? |
Not really for such a small project... But Bevy currently musn't block in wasm or it's a crash, which I guess a release build could avoid |
This definitely seems like a problem still. Version 98.0.4758.80 (Official Build) (arm64) For those that find this, I was able to work around this with Trunk specifically doing: I played around with how this crashes in debug builds, and just having dev tools doesn't quite work for me. I need to wrap the wasm init inside a setTimeout of at least 20 seconds. The crash is also super hard and seems to completely kill the dev tools, not really leaving much chance to see logs. |
Bevy version
0.6.0
Operating system & version
What you did
I tried to build this 2D rect example in my project as a wasm target. (Note that I can view the example on that site without any issues in Chrome)
You can see the failing project source here
What you expected to happen
I expected that when when I accessed the HTML file pointing to the wasm (over a web server), it would display the rectangle and that the browser would remain stable.
What actually happened
When I try to access the wasms I've created in Chrome (98.0.4758.80 on Ubuntu 21.10), the rectangle displays for a moment, but unless I have the developer tools open (by clicking Inspect), the browser tab crashes (or sometimes Chrome itself just flat out crashes).
Additional information
The following is output from Chrome when it crashes:
If I have the developer tools open, everything works as expected. I do get the error below in the console log, but I believe it is expected.
The text was updated successfully, but these errors were encountered: