I am trying to implement a kind of playground that allows to switch between WebGL 1.0, 2.0 and WebGPU.
When running on a browser without WebGPU enabled, I get to create a BABYLON.Engine instance, and there is no issue switching between both WebGL versions of the shading language.
However if WebGPU is enabled, then I make use of BABYLON.WebGPUEngine, which seems to dislike GLSL ES 3.0 syntax, littering the console with parse errors.
What might I been missing regarding the settings, or that is really like that with WebGPUEngine?
We would need to know what the errors are, but the spec is still evolving and Chrome (Canary) is not up to date. Notably, there have been changes with the discard statement which will break any code that are using it, but once Canary is updated that will fix it.
Now if I start Chrome Canary with WebGPU support enabled, I will be using BABYLON.WebGPUEngine instead, and despite giving it BABYLON.ShaderLanguage.GLSL as shader language configuration it doesn’t like it,
I just had some time to look into this, and it really looks like a BabylonJS issue.
I took the Playground example from the documentation regarding how to write shaders, rewrote the shaders in WebGL 2.0 GLSL, everything renders perfectly fine in WebGL modes, as expected.
When opening the playground in Chrome Canary, and switching the backend to WebGPU, the rendering errors regarding a bad GLSL version happen.
If on the other hand I use the original playground example with old GLSL in Chrome Canary, then everything renders as well.
So to me it really seems BABYLON.ShaderMaterial() has an issue with WebGL 2.0 GLSL syntax when using the WebGPU backend.