From 98315fd86f9cf26984c8ef9f7fd18df3d25f3588 Mon Sep 17 00:00:00 2001 From: Martin Valigursky Date: Sun, 17 May 2026 11:02:47 +0100 Subject: [PATCH] fix(gsplat): avoid GLSL ES reserved word 'packed' in compact format shader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `packed` is reserved in GLSL ES 3.00+ (ยง3.7). The current stable ANGLE shader compiler accepts it, but the newer ANGLE in Chrome Canary correctly rejects it, breaking gsplat rendering with: ERROR: 'packed' : Illegal use of reserved word ERROR: 'packed' : syntax error Rename the offending locals/parameters to `data` in the GLSL chunks, and apply the same renames to the matching WGSL chunks to keep the GLSL/WGSL pair symmetric. No public API or behaviour change. --- .../vert/formats/containerCompactRead.js | 24 +++++++++---------- .../gsplat/vert/formats/uncompressed.js | 4 ++-- .../vert/formats/containerCompactRead.js | 24 +++++++++---------- .../gsplat/vert/formats/uncompressed.js | 4 ++-- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/containerCompactRead.js b/src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/containerCompactRead.js index 69f716c20dc..080180fa4f3 100644 --- a/src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/containerCompactRead.js +++ b/src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/containerCompactRead.js @@ -17,21 +17,21 @@ float getOpacity() { } vec3 getColor() { - uint packed = loadDataColor().x; - float r = float(packed & 0x7FFu) * (4.0 / 2047.0); - float g = float((packed >> 11u) & 0x7FFu) * (4.0 / 2047.0); - float b = float((packed >> 22u) & 0x3FFu) * (4.0 / 1023.0); + uint data = loadDataColor().x; + float r = float(data & 0x7FFu) * (4.0 / 2047.0); + float g = float((data >> 11u) & 0x7FFu) * (4.0 / 2047.0); + float b = float((data >> 22u) & 0x3FFu) * (4.0 / 1023.0); return vec3(r, g, b); } vec4 getRotation() { - uint packed = loadDataTransformB().x; + uint data = loadDataTransformB().x; // dequantize half-angle projected quaternion: 11+11+10 bits to [-1, 1] vec3 p = vec3( - float(packed & 0x7FFu) / 2047.0 * 2.0 - 1.0, - float((packed >> 11u) & 0x7FFu) / 2047.0 * 2.0 - 1.0, - float((packed >> 22u) & 0x3FFu) / 1023.0 * 2.0 - 1.0 + float(data & 0x7FFu) / 2047.0 * 2.0 - 1.0, + float((data >> 11u) & 0x7FFu) / 2047.0 * 2.0 - 1.0, + float((data >> 22u) & 0x3FFu) / 1023.0 * 2.0 - 1.0 ); // inverse half-angle transform, returns (w, x, y, z) format @@ -40,10 +40,10 @@ vec4 getRotation() { } vec3 getScale() { - uint packed = cachedTransformA.a; - float sx = float(packed & 0xFFu); - float sy = float((packed >> 8u) & 0xFFu); - float sz = float((packed >> 16u) & 0xFFu); + uint data = cachedTransformA.a; + float sx = float(data & 0xFFu); + float sy = float((data >> 8u) & 0xFFu); + float sz = float((data >> 16u) & 0xFFu); // decode log-encoded scale: 0 = true zero, 1-255 maps linearly in log-space to e^-12..e^9 const float logRange = 21.0 / 255.0; diff --git a/src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/uncompressed.js b/src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/uncompressed.js index fe6b229241c..18f18b43aab 100644 --- a/src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/uncompressed.js +++ b/src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/uncompressed.js @@ -6,8 +6,8 @@ export default /* glsl */` uint tAw; vec4 tBcached; -vec4 unpackRotation(vec3 packed) { - return vec4(packed.xyz, sqrt(max(0.0, 1.0 - dot(packed, packed)))); +vec4 unpackRotation(vec3 data) { + return vec4(data.xyz, sqrt(max(0.0, 1.0 - dot(data, data)))); } // read the model-space center of the gaussian diff --git a/src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/containerCompactRead.js b/src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/containerCompactRead.js index 255f805b816..aa6545500f1 100644 --- a/src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/containerCompactRead.js +++ b/src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/containerCompactRead.js @@ -17,21 +17,21 @@ fn getOpacity() -> f32 { } fn getColor() -> vec3f { - let packed = loadDataColor().x; - let r = f32(packed & 0x7FFu) * (4.0 / 2047.0); - let g = f32((packed >> 11u) & 0x7FFu) * (4.0 / 2047.0); - let b = f32((packed >> 22u) & 0x3FFu) * (4.0 / 1023.0); + let data = loadDataColor().x; + let r = f32(data & 0x7FFu) * (4.0 / 2047.0); + let g = f32((data >> 11u) & 0x7FFu) * (4.0 / 2047.0); + let b = f32((data >> 22u) & 0x3FFu) * (4.0 / 1023.0); return vec3f(r, g, b); } fn getRotation() -> vec4f { - let packed = loadDataTransformB().x; + let data = loadDataTransformB().x; // dequantize half-angle projected quaternion: 11+11+10 bits to [-1, 1] let p = vec3f( - f32(packed & 0x7FFu) / 2047.0 * 2.0 - 1.0, - f32((packed >> 11u) & 0x7FFu) / 2047.0 * 2.0 - 1.0, - f32((packed >> 22u) & 0x3FFu) / 1023.0 * 2.0 - 1.0 + f32(data & 0x7FFu) / 2047.0 * 2.0 - 1.0, + f32((data >> 11u) & 0x7FFu) / 2047.0 * 2.0 - 1.0, + f32((data >> 22u) & 0x3FFu) / 1023.0 * 2.0 - 1.0 ); // inverse half-angle transform, returns (w, x, y, z) format @@ -40,10 +40,10 @@ fn getRotation() -> vec4f { } fn getScale() -> vec3f { - let packed = cachedTransformA.a; - let sx = f32(packed & 0xFFu); - let sy = f32((packed >> 8u) & 0xFFu); - let sz = f32((packed >> 16u) & 0xFFu); + let data = cachedTransformA.a; + let sx = f32(data & 0xFFu); + let sy = f32((data >> 8u) & 0xFFu); + let sz = f32((data >> 16u) & 0xFFu); // decode log-encoded scale: 0 = true zero, 1-255 maps linearly in log-space to e^-12..e^9 let logRange = 21.0 / 255.0; diff --git a/src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/uncompressed.js b/src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/uncompressed.js index 167ce6383e9..8e95443a4c1 100644 --- a/src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/uncompressed.js +++ b/src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/uncompressed.js @@ -6,8 +6,8 @@ export default /* wgsl */` var tAw: u32; var tBcached: vec4f; -fn unpackRotation(packed: vec3f) -> vec4f { - return vec4f(packed.xyz, sqrt(max(0.0, 1.0 - dot(packed, packed)))); +fn unpackRotation(data: vec3f) -> vec4f { + return vec4f(data.xyz, sqrt(max(0.0, 1.0 - dot(data, data)))); } // read the model-space center of the gaussian