# Clustered lighting WGSL fails validation on Firefox WebGPU — ptr\<storage\> function parameter requires unrestricted\_pointer\_parameters, which naga doesn't implement

**URL:** <https://forum.babylonjs.com/t/clustered-lighting-wgsl-fails-validation-on-firefox-webgpu-ptr-storage-function-parameter-requires-unrestricted-pointer-parameters-which-naga-doesnt-implement/63887>\
**Category:** Bugs\
**Tags:** webgl, firefox\
**Created:** [August 4, 2026, 1:16am UTC](https://forum.babylonjs.com/t/clustered-lighting-wgsl-fails-validation-on-firefox-webgpu-ptr-storage-function-parameter-requires-unrestricted-pointer-parameters-which-naga-doesnt-implement/63887 "2026-08-04T01:16:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![increasinglyHuman](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/increasinglyhuman/32/51340_2.png) [@increasinglyHuman](https://forum.babylonjs.com/u/increasinglyHuman)\
**Post date:** [August 4, 2026, 1:16am UTC](https://forum.babylonjs.com/t/clustered-lighting-wgsl-fails-validation-on-firefox-webgpu-ptr-storage-function-parameter-requires-unrestricted-pointer-parameters-which-naga-doesnt-implement/63887/1 "2026-08-04T01:16:20Z")

</div>

**What happens:** Any scene using `ClusteredLightContainer` renders fine on Chrome/Edge WebGPU but fails shader validation on Firefox WebGPU (tested Firefox stable, Windows, 2026-08). Every clustered-consuming material’s fragment pipeline is invalid (~35 failures in our scene), and one invalid pipeline clear-colors every frame it touches — Firefox users get a blank viewport while Chromium users see nothing wrong.

**Root cause:** The clustered lighting WGSL passes a storage-buffer pointer as a user-function parameter (e.g. `tileMaskBuffer: ptr<storage, array<u32>>`). That’s only legal under the optional WGSL language extension `unrestricted_pointer_parameters` — Chrome’s Tint implements it, but Firefox’s naga does not yet (it’s absent from `navigator.gpu.wgslLanguageFeatures` on Firefox). So the same source is valid on one browser’s compiler and a hard validation error on the other. Babylon’s CI/testing on Chromium won’t catch it.

**Versions:** reproduced on Babylon 9.17–9.19.

**Live A/B repro:** [naga clustered A/B](https://poqpoq.com/world/showcase/naga-ab.html) — a minimal `ClusteredLightContainer` scene; unpatched it reproduces the validation failure on Firefox WebGPU (`dom.webgpu.enabled`), with our workaround applied it renders lit.

**Suggested fix:** rewrite the clustered chunks so the storage access happens from module scope (core WGSL) instead of flowing through pointer parameters — per-call-site specialization works since declaration order is irrelevant. We ship exactly that as a client-side final-source transform at `createShaderModule` (feature-gated: it never installs where `unrestricted_pointer_parameters` exists, so Chromium output stays byte-identical), and it restores Firefox rendering with no measurable runtime cost. Happy to share the transform / open a PR against the chunk source if useful.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [August 4, 2026, 2:46pm UTC](https://forum.babylonjs.com/t/clustered-lighting-wgsl-fails-validation-on-firefox-webgpu-ptr-storage-function-parameter-requires-unrestricted-pointer-parameters-which-naga-doesnt-implement/63887/2 "2026-08-04T14:46:32Z")

</div>

Thanks for reporting, here’s the PR:

> <https://github.com/BabylonJS/Babylon.js/pull/18761>
>
> \> 🤖 \*This PR was created by the create-pr skill.\*
> 
> Firefox WebGPU (Naga) rejects… clustered lighting WGSL because \`computeClusteredLighting\` took a \`ptr\<storage, array\<u32\>\>\` parameter. That needs the optional \`unrestricted\_pointer\_parameters\` extension, which Chrome Tint implements but Firefox/Naga does not. Babylon never requested the extension by name — Chrome just accepted the pattern.
> 
> \## Fix
> Specialize per light index (\`computeClusteredLighting{X}\`) and read \`tileMaskBuffer{X}\` at module scope so no storage pointer is passed as a user-function parameter. Nested \`#include…\[0..maxSimultaneousLights\]\` keeps Standard/PBR/NME paths working. WebGL/GLSL is unchanged.
> 
> \## Tests
> Unit regression that expands WGSL includes and asserts no \`ptr\<storage\` function params / no \`&tileMaskBuffer\`.
> 
> \## Forum
> https://forum.babylonjs.com/t/clustered-lighting-wgsl-fails-validation-on-firefox-webgpu-ptr-storage-function-parameter-requires-unrestricted-pointer-parameters-which-naga-doesnt-implement/63887
