Hello everyone and thank you for the awesome work on Babylon.
We encountered a strange error trying to migrate Babylon from 6.x to 7.x, using the WebGpu
Engine.
The WebGpu engine seems correctly initialized, but in the middle of the rendering we get many errors on the web console saying “Error while parsing WGSL: :41:1 error: unexpected token” and some others:
engine.service.ts:88 BJS - [11:46:26]: WebGPU uncaptured error (1): [object GPUValidationError] - Error while parsing WGSL: :41:1 error: unexpected token
uniform var opacityIntensity: f32;
^^^^^^^
- While validating [ShaderModuleDescriptor ""fragment""]
- While calling [Device "BabylonWebGPUDevice0"].CreateShaderModule([ShaderModuleDescriptor ""fragment""]).
----
Error while parsing WGSL: :41:1 error: unexpected token
uniform var opacityIntensity: f32;
^^^^^^^
- While validating [ShaderModuleDescriptor ""fragment""]
- While calling [Device "BabylonWebGPUDevice0"].CreateShaderModule([ShaderModuleDescriptor ""fragment""]).
-----
Compilation log for [Invalid ShaderModule "fragment"]:
1 error(s) generated while compiling the shader:
:41:1 error: unexpected token
uniform var opacityIntensity: f32;
-----
engine.service.ts:88 BJS - [11:46:26]: WebGPU uncaptured error (2): [object GPUValidationError] - [Invalid ShaderModule "fragment"] is invalid.
- While validating fragment stage ([Invalid ShaderModule "fragment"], entryPoint: "main").
- While validating fragment state.
- While calling [Device "BabylonWebGPUDevice0"].CreateRenderPipeline([RenderPipelineDescriptor ""RenderPipeline_rgba8unorm_depth32float_samples1_textureState0""]).
We’ve found that this happens only enabling our GlowLayer on WebGPU Engine: on WebGL Engine it works. After a lot of attempts we created a minimal repro playground: 199475
On this PG you should see those errors on the dev console and a white canvas using WEBGPU, while you should see it work using WEBGL. This PG is doing nothing useful on the scene, but it’s the simplest code we’ve found to reproduce those errors.
Any idea? Thanks a lot in advance for the time you would spend on this!