Hello there!
We have spent days trying to do the basic setup for WebGPU (as in changing the Engine
to a WebGPUEngine
) and it simply won’t work for us. The following situations have occured in an Angular environment as well as in a VueJS environment and have both been tested in Firefox Nightly / Chrome Canary, the stacktraces will be from the Angular one.
First we just tried the most basic setup, without setting any options that is, which resulted in the Engine not finding the glslang module.
Stacktrace of Firefox Nightly Console
This error already seemed weird to us, as other examples did not need to do anything further than that, but our bug hunt hinted us to using the glslang and twgls sources from https://cdn.babylonjs.com/../…
Providing these resources in the index.html
and also in the engine.initAsync()
call by providing glslangOptions
and twgslOptions
as parameters resulted in a different error, which seems to be related with the twgsl.wasm
file.
After some more intense bug hunting and trying to build the twgsl sources ourselves (which didn’t go well since neither of us has any experience with that) we found this forum post, where someone posted their own built sources as of December 2023. Now this seemed like the solution to our problems, a very recent build of exactly the sources that caused so much trouble, but even these recently created files caused a new error.
Only then did we try to run the project in different environments, first in VueJS, which gave us exactly the same errors. But then we also tried out a project from this forum post and after implementing the bug fixes provided in the answers, it just magically worked. Sadly we are required to use either Angular or VueJS for our purposes, but seeing as the solution above just works out of the box, without providing any sources we came to the conclusion that this must be a problem with Angular or VueJS or Frontend Frameworks in general.
We came here hoping to get some help on this matter, maybe someone had similar troubles with setting up their Angular or VueJS project with WebGPU support. We also created a sample project on Github so you can test it out yourself.
https://github.com/fschwarz/BabylonAngularWebGPUBug
Any help / advice would be much appreciated and thank you so much in advance.