Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

refactor(render): the lit material domains stop calling themselves 2D

esengine5607bbf81572
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6c898f1af..f2808298c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,21 @@ published separately; it ships inside the editor.
### Changed
+- **The lit material domains lose the plane from their names too.**
+ `#pragma domain Lit2D` is `Lit` and `Unlit2D` is `Unlit`. `Lit` was never the
+ flat half of anything either: a 3D mesh, its PBR shading, its environment
+ reflection and its shadow map all arrive through it, and its "2D vertex stage"
+ is the one that handles MESH, MESH_NORMALS and SKINNED. A `.esshader` carries
+ no format version to migrate by, so **the old spellings are still read as these
+ two** — normalized at the parser, in the engine and the SDK alike, so nothing
+ downstream sees two names for one domain. A material graph saved with the old
+ domain compiles to the new one.
+
+ The injected helpers keep their names: `applyLighting2D` and `shadowFactor2D`
+ really are the flat lighting model, and they sit beside `applyLightingPBR` and
+ `shadowFactor3D`, which are not. What changed is the GPU-side light record,
+ now `Light` rather than `Light2D` — the same one both models read.
+
- **The engine's light and mesh components are no longer named after a plane.**
`Light2D` is now `Light` and `Mesh2D` is now `MeshRenderer`. They were never a
second, flat pair of components — they are the *only* light and the only mesh
diff --git a/desktop b/desktop
index e4bf68a41..37847e795 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit e4bf68a4180536ae29c86238e3d5fb1524e4aec1
+Subproject commit 37847e7957710af7d24a992d96dd9dfabbdaef1d
diff --git a/docs/astro/src/content/docs/graphics/lighting.mdx b/docs/astro/src/content/docs/graphics/lighting.mdx
index 4bc25d56f..723d8e753 100644
--- a/docs/astro/src/content/docs/graphics/lighting.mdx
+++ b/docs/astro/src/content/docs/graphics/lighting.mdx
@@ -97,7 +97,7 @@ you write only the fragment:
```glsl
#pragma shader "MyLit"
#pragma version 300 es
-#pragma domain Lit2D
+#pragma domain Lit
#pragma fragment
precision mediump float;
@@ -107,7 +107,7 @@ in highp vec2 v_worldPos;
uniform sampler2D u_textures[8];
out vec4 fragColor;
-// #pragma domain Lit2D makes the engine inject the LightConstants block and the
+// #pragma domain Lit makes the engine inject the LightConstants block and the
// applyLighting2D() helper — you just call it with your base color and a normal.
void main() {
vec4 base = texture(u_textures[0], v_texCoord) * v_color;
@@ -133,7 +133,7 @@ const applyLit = defineSystem([Query(Mut(Sprite))], (q) => {
```
You can also build a lit material visually — set the **Material Graph**'s domain to
-`Lit2D` — see the [material graph](/docs/graphics/materials/) section.
+`Lit` — see the [material graph](/docs/graphics/materials/) section.
<Aside type="tip">
Every renderer that takes a `material` — `Sprite`, `SpineAnimation`,
diff --git a/docs/astro/src/content/docs/graphics/materials.mdx b/docs/astro/src/content/docs/graphics/materials.mdx
index 9f0f57a73..f6f6de84c 100644
--- a/docs/astro/src/content/docs/graphics/materials.mdx
+++ b/docs/astro/src/content/docs/graphics/materials.mdx
@@ -84,7 +84,7 @@ One file holds every stage plus its metadata, separated by pragmas:
|---|---|
| `#pragma shader "Name"` | Display name. |
| `#pragma version 300 es` | GLSL version line for every stage. |
-| `#pragma domain <D>` | `Unlit2D` (default), `Lit2D`, `PostProcess`, `UI`. `Lit2D` injects the lighting uniforms + helpers. |
+| `#pragma domain <D>` | `Unlit` (default), `Lit`, `PostProcess`, `UI`. `Lit` injects the lighting uniforms + helpers. The older spellings `Unlit2D` / `Lit2D` still load as these. |
| `#pragma param …` | A reflected material parameter (table below). |
| `#pragma switch NAME [default(on)]` | Material-facing static permutation toggle (a `#define`). |
| `#pragma feature NAME` | Engine-chosen compile-time variant keyword. |
@@ -101,7 +101,7 @@ varyings arrive ready to use:
|---|---|---|
| `v_color` | `vec4` | Per-instance tint (the sprite's `color`). |
| `v_texCoord` | `vec2` | Texture UV. |
-| `v_worldPos` | `highp vec2` | World-space position (**Lit2D domain only**). |
+| `v_worldPos` | `highp vec2` | World-space position (**Lit domain only**). |
The sprite's texture is `u_textures[0]` (declare `uniform sampler2D u_textures[8];`
— units 0–7 belong to the batch; texture *params* bind above them automatically).
@@ -135,10 +135,10 @@ The engine injects these into every compiled `.esshader` — never declare them
| `u_time` | always | `vec4` frame clock: `.x` elapsed seconds, `.y` delta seconds. |
| `u_viewport` | always | `vec4` canvas: `.xy` size in pixels, `.zw` = 1/size (screen UV = `gl_FragCoord.xy * u_viewport.zw`). |
| MaterialConstants block | when the shader has params | Your `#pragma param` values. |
-| `applyLighting2D(albedo, N, worldPos)` | Lit2D | Applies every scene light (+shadows); returns the lit color. |
-| `applyLighting2DAO(albedo, N, worldPos, ao)` | Lit2D | The same, with the ambient term scaled by `ao` (1 = unoccluded). |
-| `sampleNormal(map, uv)` | Lit2D | Unpacks a tangent-space normal map (RGB → [-1,1], normalized). |
-| `shadowFactor2D(worldPos, target, softness)` | Lit2D | Occlusion factor toward a point (used by `applyLighting2D`). |
+| `applyLighting2D(albedo, N, worldPos)` | Lit | Applies every scene light (+shadows); returns the lit color. |
+| `applyLighting2DAO(albedo, N, worldPos, ao)` | Lit | The same, with the ambient term scaled by `ao` (1 = unoccluded). |
+| `sampleNormal(map, uv)` | Lit | Unpacks a tangent-space normal map (RGB → [-1,1], normalized). |
+| `shadowFactor2D(worldPos, target, softness)` | Lit | Occlusion factor toward a point (used by `applyLighting2D`). |
A `#pragma switch` selects a static shader permutation baked into the material at
compile time (via the `features` argument to `compileShader`).
diff --git a/docs/astro/src/content/docs/zh-cn/graphics/lighting.mdx b/docs/astro/src/content/docs/zh-cn/graphics/lighting.mdx
index 893c27c6b..14f57bd3d 100644
--- a/docs/astro/src/content/docs/zh-cn/graphics/lighting.mdx
+++ b/docs/astro/src/content/docs/zh-cn/graphics/lighting.mdx
@@ -94,7 +94,7 @@ app.world.spawn()
```glsl
#pragma shader "MyLit"
#pragma version 300 es
-#pragma domain Lit2D
+#pragma domain Lit
#pragma fragment
precision mediump float;
@@ -104,7 +104,7 @@ in highp vec2 v_worldPos;
uniform sampler2D u_textures[8];
out vec4 fragColor;
-// #pragma domain Lit2D 让引擎注入 LightConstants 块和 applyLighting2D() helper——
+// #pragma domain Lit 让引擎注入 LightConstants 块和 applyLighting2D() helper——
// 你只需用你的基础色和一个法线调用它。
void main() {
vec4 base = texture(u_textures[0], v_texCoord) * v_color;
@@ -129,7 +129,7 @@ const applyLit = defineSystem([Query(Mut(Sprite))], (q) => {
});
```
-你也能可视化地做一个受光材质——把 **材质图** 的域设为 `Lit2D`——见
+你也能可视化地做一个受光材质——把 **材质图** 的域设为 `Lit`——见
[材质图](/docs/zh-cn/graphics/materials/)一节。
<Aside type="tip">
@@ -148,7 +148,7 @@ const applyLit = defineSystem([Query(Mut(Sprite))], (q) => {
### 金属度、粗糙度与高光
`applyLighting2D` 是"这个表面什么都不反射"的简写。它的一般形式让同样的灯走一遍微表面
-BRDF,Lit2D 着色器可以直接调用:
+BRDF,Lit 着色器可以直接调用:
```glsl
highp vec3 P = vec3(v_worldPos, 0.0);
diff --git a/docs/astro/src/content/docs/zh-cn/graphics/materials.mdx b/docs/astro/src/content/docs/zh-cn/graphics/materials.mdx
index 82d9f4df3..f1dd30932 100644
--- a/docs/astro/src/content/docs/zh-cn/graphics/materials.mdx
+++ b/docs/astro/src/content/docs/zh-cn/graphics/materials.mdx
@@ -70,7 +70,7 @@ std140 uniform 块,于是 CPU 能按名字设置、并安全地送到 GPU。一
|---|---|
| `#pragma shader "Name"` | 显示名。 |
| `#pragma version 300 es` | 每个 stage 的 GLSL 版本行。 |
-| `#pragma domain <D>` | `Unlit2D`(默认)、`Lit2D`、`PostProcess`、`UI`。`Lit2D` 注入光照 uniform + helper。 |
+| `#pragma domain <D>` | `Unlit`(默认)、`Lit`、`PostProcess`、`UI`。`Lit` 注入光照 uniform + helper。旧拼写 `Unlit2D` / `Lit2D` 仍按这两个域加载。 |
| `#pragma param …` | 反射的材质参数(见下表)。 |
| `#pragma switch NAME [default(on)]` | 材质可控的静态排列开关(一个 `#define`)。 |
| `#pragma feature NAME` | 引擎选择的编译期变体关键字。 |
@@ -86,7 +86,7 @@ std140 uniform 块,于是 CPU 能按名字设置、并安全地送到 GPU。一
|---|---|---|
| `v_color` | `vec4` | 每实例色调(精灵的 `color`)。 |
| `v_texCoord` | `vec2` | 纹理 UV。 |
-| `v_worldPos` | `highp vec2` | 世界坐标(**仅 Lit2D 域**)。 |
+| `v_worldPos` | `highp vec2` | 世界坐标(**仅 Lit 域**)。 |
精灵纹理是 `u_textures[0]`(声明 `uniform sampler2D u_textures[8];`——单元 0–7 归批处理;
纹理*参数*自动绑定在其上方)。
@@ -119,10 +119,10 @@ std140 uniform 块,于是 CPU 能按名字设置、并安全地送到 GPU。一
| `u_time` | 总是 | `vec4` 帧时钟:`.x` 累计秒,`.y` 帧间隔秒。 |
| `u_viewport` | 总是 | `vec4` 画布:`.xy` 像素尺寸,`.zw` = 1/尺寸(屏幕 UV = `gl_FragCoord.xy * u_viewport.zw`)。 |
| MaterialConstants 块 | 着色器有参数时 | 你的 `#pragma param` 值。 |
-| `applyLighting2D(albedo, N, worldPos)` | Lit2D | 应用场景所有灯光(含阴影),返回受光颜色。 |
-| `applyLighting2DAO(albedo, N, worldPos, ao)` | Lit2D | 同上,但环境光项乘以 `ao`(1 = 无遮蔽)。 |
-| `sampleNormal(map, uv)` | Lit2D | 解包切线空间法线贴图(RGB → [-1,1],归一化)。 |
-| `shadowFactor2D(worldPos, target, softness)` | Lit2D | 朝向目标点的遮挡系数(`applyLighting2D` 内部使用)。 |
+| `applyLighting2D(albedo, N, worldPos)` | Lit | 应用场景所有灯光(含阴影),返回受光颜色。 |
+| `applyLighting2DAO(albedo, N, worldPos, ao)` | Lit | 同上,但环境光项乘以 `ao`(1 = 无遮蔽)。 |
+| `sampleNormal(map, uv)` | Lit | 解包切线空间法线贴图(RGB → [-1,1],归一化)。 |
+| `shadowFactor2D(worldPos, target, softness)` | Lit | 朝向目标点的遮挡系数(`applyLighting2D` 内部使用)。 |
`#pragma switch` 选择编译期烘焙进材质的静态着色器排列(通过 `compileShader` 的 `features` 参数)。
diff --git a/docs/astro/src/data/componentDocs.ts b/docs/astro/src/data/componentDocs.ts
index ae5bd395d..462fbb9b1 100644
--- a/docs/astro/src/data/componentDocs.ts
+++ b/docs/astro/src/data/componentDocs.ts
@@ -70,7 +70,7 @@ export const COMPONENT_DOCS: Record<string, ComponentDoc> = {
FollowTarget: { category: 'graphics', summary: 'Makes a camera chase an entity, with an offset, a dead zone and eased catch-up.', doc: 'graphics/camera', anchor: 'follow-a-target', anchorZh: '跟随目标' },
CameraBounds: { category: 'graphics', summary: 'The world rectangle a camera may not look outside of, so the level edge stays at the screen edge.', doc: 'graphics/camera', anchor: 'keep-the-camera-inside-the-level', anchorZh: '把相机限制在关卡内' },
Canvas: { category: 'graphics', summary: 'The design resolution and scale mode a scene is authored against — one per scene root.', doc: 'core-concepts/screen', anchor: 'the-canvas-component', anchorZh: 'canvas-组件' },
- Light: { category: 'graphics', summary: 'A light — point, directional, spot or ambient — read by lit renderers, Lit2D materials and mesh shadow maps.', doc: 'graphics/lighting', anchor: 'light-types', anchorZh: '光源类型' },
+ Light: { category: 'graphics', summary: 'A light — point, directional, spot or ambient — read by lit renderers, Lit materials and mesh shadow maps.', doc: 'graphics/lighting', anchor: 'light-types', anchorZh: '光源类型' },
ShadowCaster2D: { category: 'graphics', summary: 'Marks a renderer as an occluder, so 2D lights cast shadows from its silhouette.', doc: 'graphics/lighting', anchor: 'casting-shadows', anchorZh: '投射阴影' },
PostProcessVolume: { category: 'graphics', summary: 'A stack of full-screen effects (bloom, vignette, colour grading) applied after the scene is drawn.', doc: 'graphics/post-processing', anchor: 'using-a-postprocessvolume', anchorZh: '使用-postprocessvolume' },
MeshRenderer: { category: 'graphics', summary: 'Geometry drawn as an entity — your own vertices or an imported mesh, with a material and a sorting layer.', doc: 'graphics/drawing', anchor: 'custom-meshes-meshrenderer', anchorZh: '自定义网格meshrenderer' },
diff --git a/examples/effects-gallery/assets/materials/dissolve.esshader b/examples/effects-gallery/assets/materials/dissolve.esshader
index c89329cce..64fe7ab90 100644
--- a/examples/effects-gallery/assets/materials/dissolve.esshader
+++ b/examples/effects-gallery/assets/materials/dissolve.esshader
@@ -1,6 +1,6 @@
#pragma shader "Dissolve"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_progress float default(0) range(0,1) ui(slider)
#pragma param u_edgeColor color default(1,0.5,0,1)
#pragma param u_edgeWidth float default(0.08) range(0,0.5)
@@ -39,7 +39,7 @@ void main() {
#pragma vertex wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 99e3d67aae0be3c6
+// source-hash: 0a687499da49fe50
// assembled-hash: b25f4206f2477249
struct gl_PerVertex {
@builtin(position) gl_Position: vec4<f32>,
@@ -113,7 +113,7 @@ fn vs_main(@location(0) a_position: vec3<f32>, @location(1) a_color: vec4<f32>,
#pragma fragment wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 99e3d67aae0be3c6
+// source-hash: 0a687499da49fe50
// assembled-hash: b25f4206f2477249
struct MaterialConstants {
u_progress: f32,
diff --git a/examples/effects-gallery/assets/materials/hit-flash.esshader b/examples/effects-gallery/assets/materials/hit-flash.esshader
index e6b1f4a40..34f762fed 100644
--- a/examples/effects-gallery/assets/materials/hit-flash.esshader
+++ b/examples/effects-gallery/assets/materials/hit-flash.esshader
@@ -1,6 +1,6 @@
#pragma shader "Hit Flash"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_flash float default(0) range(0,1) ui(slider)
#pragma param u_flashColor color default(1,1,1,1)
@@ -24,7 +24,7 @@ void main() {
#pragma vertex wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 1c3115bd7b73f674
+// source-hash: 674537b45fb865fb
// assembled-hash: 0a587e1ebadddcdf
struct gl_PerVertex {
@builtin(position) gl_Position: vec4<f32>,
@@ -96,7 +96,7 @@ fn vs_main(@location(0) a_position: vec3<f32>, @location(1) a_color: vec4<f32>,
#pragma fragment wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 1c3115bd7b73f674
+// source-hash: 674537b45fb865fb
// assembled-hash: 0a587e1ebadddcdf
struct MaterialConstants {
u_flash: f32,
diff --git a/examples/effects-gallery/assets/materials/outline.esshader b/examples/effects-gallery/assets/materials/outline.esshader
index 7159a76ff..2989df9ed 100644
--- a/examples/effects-gallery/assets/materials/outline.esshader
+++ b/examples/effects-gallery/assets/materials/outline.esshader
@@ -1,6 +1,6 @@
#pragma shader "Outline"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_outlineColor color default(1,1,1,1)
#pragma param u_outlineWidth float default(1) range(0,8)
@@ -33,7 +33,7 @@ void main() {
#pragma vertex wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 0d65463ea0c29816
+// source-hash: 7ed4f4686c6bfd8d
// assembled-hash: 3790668aef426091
struct gl_PerVertex {
@builtin(position) gl_Position: vec4<f32>,
@@ -105,7 +105,7 @@ fn vs_main(@location(0) a_position: vec3<f32>, @location(1) a_color: vec4<f32>,
#pragma fragment wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 0d65463ea0c29816
+// source-hash: 7ed4f4686c6bfd8d
// assembled-hash: 3790668aef426091
struct MaterialConstants {
u_outlineColor: vec4<f32>,
diff --git a/examples/effects-gallery/assets/materials/pixelate.esshader b/examples/effects-gallery/assets/materials/pixelate.esshader
index 489c00bf4..672480f90 100644
--- a/examples/effects-gallery/assets/materials/pixelate.esshader
+++ b/examples/effects-gallery/assets/materials/pixelate.esshader
@@ -1,6 +1,6 @@
#pragma shader "Pixelate"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_pixels float default(32) range(2,256)
#pragma fragment
@@ -22,7 +22,7 @@ void main() {
#pragma vertex wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 2e7de16a41174f41
+// source-hash: 0c2fb4b31599ec7a
// assembled-hash: fe3f56d6195fed46
struct gl_PerVertex {
@builtin(position) gl_Position: vec4<f32>,
@@ -93,7 +93,7 @@ fn vs_main(@location(0) a_position: vec3<f32>, @location(1) a_color: vec4<f32>,
#pragma fragment wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 2e7de16a41174f41
+// source-hash: 0c2fb4b31599ec7a
// assembled-hash: fe3f56d6195fed46
struct MaterialConstants {
u_pixels: f32,
diff --git a/examples/effects-gallery/assets/materials/uv-scroll.esshader b/examples/effects-gallery/assets/materials/uv-scroll.esshader
index 67cb426dd..0402dee2d 100644
--- a/examples/effects-gallery/assets/materials/uv-scroll.esshader
+++ b/examples/effects-gallery/assets/materials/uv-scroll.esshader
@@ -1,6 +1,6 @@
#pragma shader "UV Scroll"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_scrollSpeed vec2 default(0.1,0)
#pragma fragment
@@ -23,7 +23,7 @@ void main() {
#pragma vertex wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 8ae602b222f8cbdc
+// source-hash: 301c5b2b73d966f3
// assembled-hash: c8cc6f14bb51a809
struct gl_PerVertex {
@builtin(position) gl_Position: vec4<f32>,
@@ -94,7 +94,7 @@ fn vs_main(@location(0) a_position: vec3<f32>, @location(1) a_color: vec4<f32>,
#pragma fragment wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 8ae602b222f8cbdc
+// source-hash: 301c5b2b73d966f3
// assembled-hash: c8cc6f14bb51a809
struct TimeConstants {
u_time: vec4<f32>,
diff --git a/fixtures/scenes/depth-layers/opaque.esshader b/fixtures/scenes/depth-layers/opaque.esshader
index f2ebfa585..3bbe2f0fe 100644
--- a/fixtures/scenes/depth-layers/opaque.esshader
+++ b/fixtures/scenes/depth-layers/opaque.esshader
@@ -1,6 +1,6 @@
#pragma shader "Opaque Unlit"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
// Fragment-only on purpose: the vertex stage is the one ShaderParser injects, so
// this scene also proves that the INHERITED stage carries z. A material that
@@ -23,7 +23,7 @@ void main() {
#pragma vertex wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 28a0ea120b8a9996
+// source-hash: 930787555114ce9c
// assembled-hash: 608493cc809284d8
struct gl_PerVertex {
@builtin(position) gl_Position: vec4<f32>,
@@ -88,7 +88,7 @@ fn vs_main(@location(0) a_position: vec3<f32>, @location(1) a_color: vec4<f32>,
#pragma fragment wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 28a0ea120b8a9996
+// source-hash: 930787555114ce9c
// assembled-hash: 608493cc809284d8
struct FrameConstants {
u_projection: mat4x4<f32>,
diff --git a/fixtures/scenes/mat-builtin-lit/lit.esshader b/fixtures/scenes/mat-builtin-lit/lit.esshader
index c0ffec86e..9716e9d79 100644
--- a/fixtures/scenes/mat-builtin-lit/lit.esshader
+++ b/fixtures/scenes/mat-builtin-lit/lit.esshader
@@ -1,6 +1,6 @@
#pragma shader "Sprite Lit"
#pragma version 300 es
-#pragma domain Lit2D
+#pragma domain Lit
#pragma param u_tint color default(1,1,1,1)
#pragma param u_normalMap texture default(flatnormal)
@@ -26,8 +26,8 @@ void main() {
#pragma vertex wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 9f608a54b0f5c530
-// assembled-hash: 5bca33c2fc3d1478
+// source-hash: 5330079245724fa2
+// assembled-hash: 4c0c9d4c327408ac
struct gl_PerVertex {
@builtin(position) gl_Position: vec4<f32>,
gl_PointSize: f32,
@@ -106,14 +106,14 @@ fn vs_main(@location(0) a_position: vec3<f32>, @location(1) a_color: vec4<f32>,
#pragma fragment wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 9f608a54b0f5c530
-// assembled-hash: 5bca33c2fc3d1478
+// source-hash: 5330079245724fa2
+// assembled-hash: 4c0c9d4c327408ac
struct FrameConstants {
u_projection: mat4x4<f32>,
u_camera: vec4<f32>,
}
-struct Light2D {
+struct Light {
posDir: vec4<f32>,
color: vec4<f32>,
spot: vec4<f32>,
@@ -123,7 +123,7 @@ struct Light2D {
struct LightConstants {
u_ambient: vec4<f32>,
- u_lights: array<Light2D, 16>,
+ u_lights: array<Light, 16>,
u_occluderCount: vec4<f32>,
u_occluders: array<vec4<f32>, 8>,
u_shadowMatrix: array<mat4x4<f32>, 16>,
diff --git a/fixtures/scenes/mat-dissolve/dissolve.esshader b/fixtures/scenes/mat-dissolve/dissolve.esshader
index c89329cce..64fe7ab90 100644
--- a/fixtures/scenes/mat-dissolve/dissolve.esshader
+++ b/fixtures/scenes/mat-dissolve/dissolve.esshader
@@ -1,6 +1,6 @@
#pragma shader "Dissolve"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_progress float default(0) range(0,1) ui(slider)
#pragma param u_edgeColor color default(1,0.5,0,1)
#pragma param u_edgeWidth float default(0.08) range(0,0.5)
@@ -39,7 +39,7 @@ void main() {
#pragma vertex wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 99e3d67aae0be3c6
+// source-hash: 0a687499da49fe50
// assembled-hash: b25f4206f2477249
struct gl_PerVertex {
@builtin(position) gl_Position: vec4<f32>,
@@ -113,7 +113,7 @@ fn vs_main(@location(0) a_position: vec3<f32>, @location(1) a_color: vec4<f32>,
#pragma fragment wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 99e3d67aae0be3c6
+// source-hash: 0a687499da49fe50
// assembled-hash: b25f4206f2477249
struct MaterialConstants {
u_progress: f32,
diff --git a/fixtures/scenes/mat-graph/graph-tint.esshader b/fixtures/scenes/mat-graph/graph-tint.esshader
index 6620da196..898001c26 100644
--- a/fixtures/scenes/mat-graph/graph-tint.esshader
+++ b/fixtures/scenes/mat-graph/graph-tint.esshader
@@ -1,6 +1,6 @@
#pragma shader "GraphTint"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_albedo texture default(white)
#pragma param u_tint color default(1,1,1,1)
@@ -38,7 +38,7 @@ void main() {
#pragma vertex wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 67f8bff89c3862af
+// source-hash: 5382212ba4021113
// assembled-hash: 36468b69f1f87459
struct gl_PerVertex {
@builtin(position) gl_Position: vec4<f32>,
@@ -111,7 +111,7 @@ fn vs_main(@location(0) a_position: vec3<f32>, @location(1) a_color: vec4<f32>,
#pragma fragment wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 67f8bff89c3862af
+// source-hash: 5382212ba4021113
// assembled-hash: 36468b69f1f87459
struct MaterialConstants {
u_tint: vec4<f32>,
diff --git a/fixtures/scenes/mat-lit-flatnormal/lit-fn.esshader b/fixtures/scenes/mat-lit-flatnormal/lit-fn.esshader
index 8fb7548f6..20520796a 100644
--- a/fixtures/scenes/mat-lit-flatnormal/lit-fn.esshader
+++ b/fixtures/scenes/mat-lit-flatnormal/lit-fn.esshader
@@ -1,6 +1,6 @@
-#pragma shader "Lit2DFlatNormal"
+#pragma shader "LitFlatNormal"
#pragma version 300 es
-#pragma domain Lit2D
+#pragma domain Lit
#pragma param u_normal texture default(flatnormal)
#pragma vertex
@@ -46,8 +46,8 @@ void main() {
#pragma vertex wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 01a4bc3e793ceb2e
-// assembled-hash: 76f16825b5fe7ebc
+// source-hash: a8853729e0f76d55
+// assembled-hash: 599d5ceb99e0137c
struct gl_PerVertex {
@builtin(position) gl_Position: vec4<f32>,
gl_PointSize: f32,
@@ -118,14 +118,14 @@ fn vs_main(@location(0) a_position: vec3<f32>, @location(1) a_color: vec4<f32>,
#pragma fragment wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 01a4bc3e793ceb2e
-// assembled-hash: 76f16825b5fe7ebc
+// source-hash: a8853729e0f76d55
+// assembled-hash: 599d5ceb99e0137c
struct FrameConstants {
u_projection: mat4x4<f32>,
u_camera: vec4<f32>,
}
-struct Light2D {
+struct Light {
posDir: vec4<f32>,
color: vec4<f32>,
spot: vec4<f32>,
@@ -135,7 +135,7 @@ struct Light2D {
struct LightConstants {
u_ambient: vec4<f32>,
- u_lights: array<Light2D, 16>,
+ u_lights: array<Light, 16>,
u_occluderCount: vec4<f32>,
u_occluders: array<vec4<f32>, 8>,
u_shadowMatrix: array<mat4x4<f32>, 16>,
diff --git a/fixtures/scenes/mat-lit-normal/lit-normal.esshader b/fixtures/scenes/mat-lit-normal/lit-normal.esshader
index 1aeaf2e63..7dd1fe516 100644
--- a/fixtures/scenes/mat-lit-normal/lit-normal.esshader
+++ b/fixtures/scenes/mat-lit-normal/lit-normal.esshader
@@ -1,6 +1,6 @@
-#pragma shader "Lit2DNormal"
+#pragma shader "LitNormal"
#pragma version 300 es
-#pragma domain Lit2D
+#pragma domain Lit
#pragma param u_normal texture default(white)
#pragma vertex
@@ -33,7 +33,7 @@ uniform sampler2D u_textures[8];
out vec4 fragColor;
// sampleNormal + applyLighting2D + the LightConstants block are injected by ShaderParser
-// for `#pragma domain Lit2D`. The surface normal comes from the material's u_normal map, so
+// for `#pragma domain Lit`. The surface normal comes from the material's u_normal map, so
// lighting varies per texel.
void main() {
vec4 base = texture(u_textures[0], v_texCoord) * v_color;
@@ -46,8 +46,8 @@ void main() {
#pragma vertex wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 25277537fdff67e5
-// assembled-hash: a9a500aabef80487
+// source-hash: 577c1ff7b66006ff
+// assembled-hash: 8d305a8052328143
struct gl_PerVertex {
@builtin(position) gl_Position: vec4<f32>,
gl_PointSize: f32,
@@ -118,14 +118,14 @@ fn vs_main(@location(0) a_position: vec3<f32>, @location(1) a_color: vec4<f32>,
#pragma fragment wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 25277537fdff67e5
-// assembled-hash: a9a500aabef80487
+// source-hash: 577c1ff7b66006ff
+// assembled-hash: 8d305a8052328143
struct FrameConstants {
u_projection: mat4x4<f32>,
u_camera: vec4<f32>,
}
-struct Light2D {
+struct Light {
posDir: vec4<f32>,
color: vec4<f32>,
spot: vec4<f32>,
@@ -135,7 +135,7 @@ struct Light2D {
struct LightConstants {
u_ambient: vec4<f32>,
- u_lights: array<Light2D, 16>,
+ u_lights: array<Light, 16>,
u_occluderCount: vec4<f32>,
u_occluders: array<vec4<f32>, 8>,
u_shadowMatrix: array<mat4x4<f32>, 16>,
diff --git a/fixtures/scenes/mat-lit/lit.esshader b/fixtures/scenes/mat-lit/lit.esshader
index 057c55e43..2c44fccad 100644
--- a/fixtures/scenes/mat-lit/lit.esshader
+++ b/fixtures/scenes/mat-lit/lit.esshader
@@ -1,6 +1,6 @@
-#pragma shader "Lit2DTest"
+#pragma shader "LitTest"
#pragma version 300 es
-#pragma domain Lit2D
+#pragma domain Lit
#pragma vertex
layout(location = 0) in vec3 a_position;
@@ -40,7 +40,7 @@ uniform sampler2D u_textures[8];
out vec4 fragColor;
// The LightConstants block + applyLighting2D() are injected by ShaderParser for
-// `#pragma domain Lit2D`. A flat normal (no normal map in this fixture) faces the camera.
+// `#pragma domain Lit`. A flat normal (no normal map in this fixture) faces the camera.
void main() {
vec4 base = texture(u_textures[0], v_texCoord) * v_color;
vec3 N = vec3(0.0, 0.0, 1.0);
@@ -52,8 +52,8 @@ void main() {
#pragma vertex wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: c578fc449c0e606e
-// assembled-hash: e401fcf183c2ffca
+// source-hash: 8c118f2b442c055e
+// assembled-hash: c7fd6653414f297a
struct gl_PerVertex {
@builtin(position) gl_Position: vec4<f32>,
gl_PointSize: f32,
@@ -120,14 +120,14 @@ fn vs_main(@location(0) a_position: vec3<f32>, @location(1) a_color: vec4<f32>,
#pragma fragment wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: c578fc449c0e606e
-// assembled-hash: e401fcf183c2ffca
+// source-hash: 8c118f2b442c055e
+// assembled-hash: c7fd6653414f297a
struct FrameConstants {
u_projection: mat4x4<f32>,
u_camera: vec4<f32>,
}
-struct Light2D {
+struct Light {
posDir: vec4<f32>,
color: vec4<f32>,
spot: vec4<f32>,
@@ -137,7 +137,7 @@ struct Light2D {
struct LightConstants {
u_ambient: vec4<f32>,
- u_lights: array<Light2D, 16>,
+ u_lights: array<Light, 16>,
u_occluderCount: vec4<f32>,
u_occluders: array<vec4<f32>, 8>,
u_shadowMatrix: array<mat4x4<f32>, 16>,
diff --git a/fixtures/scenes/mat-pbr/pbr.esshader b/fixtures/scenes/mat-pbr/pbr.esshader
index a1410a3a0..40ff7d9e7 100644
--- a/fixtures/scenes/mat-pbr/pbr.esshader
+++ b/fixtures/scenes/mat-pbr/pbr.esshader
@@ -1,6 +1,6 @@
#pragma shader "PBRTest"
#pragma version 300 es
-#pragma domain Lit2D
+#pragma domain Lit
#pragma param u_metallic float default(0) range(0,1)
#pragma param u_roughness float default(1) range(0,1)
#pragma param u_specular float default(0) range(0,1)
diff --git a/fixtures/scenes/mat-pbr/viewvec.esshader b/fixtures/scenes/mat-pbr/viewvec.esshader
index ff938cb3e..5f6d16e2a 100644
--- a/fixtures/scenes/mat-pbr/viewvec.esshader
+++ b/fixtures/scenes/mat-pbr/viewvec.esshader
@@ -1,6 +1,6 @@
#pragma shader "ViewVectorTest"
#pragma version 300 es
-#pragma domain Lit2D
+#pragma domain Lit
#pragma fragment
precision mediump float;
diff --git a/fixtures/scenes/mat-sw/switched.esshader b/fixtures/scenes/mat-sw/switched.esshader
index 0708921f9..2ab03467c 100644
--- a/fixtures/scenes/mat-sw/switched.esshader
+++ b/fixtures/scenes/mat-sw/switched.esshader
@@ -1,6 +1,6 @@
#pragma shader "Switched"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma switch USE_GREEN default(off)
#pragma vertex
@@ -37,7 +37,7 @@ void main() {
#pragma vertex wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 49d2d4a5e4a04d72
+// source-hash: 0ba3d3644597ce83
// assembled-hash: e569b7c498f64957
#ifdef USE_GREEN
struct gl_PerVertex {
@@ -149,7 +149,7 @@ fn vs_main(@location(0) a_position: vec3<f32>, @location(1) a_color: vec4<f32>,
#pragma fragment wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: 49d2d4a5e4a04d72
+// source-hash: 0ba3d3644597ce83
// assembled-hash: e569b7c498f64957
#ifdef USE_GREEN
struct FrameConstants {
diff --git a/fixtures/scenes/mat-tex/masked.esshader b/fixtures/scenes/mat-tex/masked.esshader
index 0d1712142..ebae3a830 100644
--- a/fixtures/scenes/mat-tex/masked.esshader
+++ b/fixtures/scenes/mat-tex/masked.esshader
@@ -1,6 +1,6 @@
#pragma shader "Masked"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_mask texture default(white)
#pragma vertex
@@ -37,7 +37,7 @@ void main() {
#pragma vertex wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: adaf30016421f0d6
+// source-hash: 11b26db499fb2fc6
// assembled-hash: 3644b006823fa039
struct gl_PerVertex {
@builtin(position) gl_Position: vec4<f32>,
@@ -104,7 +104,7 @@ fn vs_main(@location(0) a_position: vec3<f32>, @location(1) a_color: vec4<f32>,
#pragma fragment wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: adaf30016421f0d6
+// source-hash: 11b26db499fb2fc6
// assembled-hash: 3644b006823fa039
struct FrameConstants {
u_projection: mat4x4<f32>,
diff --git a/fixtures/scenes/mat-tint/tint.esshader b/fixtures/scenes/mat-tint/tint.esshader
index 0ad7c2457..cb5c4b496 100644
--- a/fixtures/scenes/mat-tint/tint.esshader
+++ b/fixtures/scenes/mat-tint/tint.esshader
@@ -1,6 +1,6 @@
#pragma shader "TintTest"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_tint color default(1,1,1,1)
#pragma vertex
@@ -77,7 +77,7 @@ struct VSOut {
#pragma vertex wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: e7a1c1ef8d0e282f
+// source-hash: 7be4a77f9921c078
// assembled-hash: 3590d58ae5cbd4de
struct gl_PerVertex {
@builtin(position) gl_Position: vec4<f32>,
@@ -146,7 +146,7 @@ fn vs_main(@location(0) a_position: vec3<f32>, @location(1) a_color: vec4<f32>,
#pragma fragment wgsl full
// GENERATED by tools/gen-shader-twins.mjs (glslang + naga) - do not edit.
// Regenerate after changing the GLSL stages above.
-// source-hash: e7a1c1ef8d0e282f
+// source-hash: 7be4a77f9921c078
// assembled-hash: 3590d58ae5cbd4de
struct MaterialConstants {
u_tint: vec4<f32>,
diff --git a/fixtures/scenes/mesh-material-lit/litmat.esshader b/fixtures/scenes/mesh-material-lit/litmat.esshader
index 304cc1b1b..9dde0e1b1 100644
--- a/fixtures/scenes/mesh-material-lit/litmat.esshader
+++ b/fixtures/scenes/mesh-material-lit/litmat.esshader
@@ -1,6 +1,6 @@
#pragma shader "MeshLitMaterial"
#pragma version 300 es
-#pragma domain Lit2D
+#pragma domain Lit
// Fragment only: the engine owns the vertex stage, and MESH_NORMALS is how it
// says this draw's geometry carries normals — a material asks for them the same
diff --git a/fixtures/scenes/mesh-material/tintonly.esshader b/fixtures/scenes/mesh-material/tintonly.esshader
index 70cecd812..b114d38e8 100644
--- a/fixtures/scenes/mesh-material/tintonly.esshader
+++ b/fixtures/scenes/mesh-material/tintonly.esshader
@@ -1,6 +1,6 @@
#pragma shader "MeshTintTest"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_tint color default(1,1,1,1)
// Fragment only: the engine owns the vertex stage, which is what lets the same
diff --git a/fixtures/scenes/mesh-shadow-material/blockmat.esshader b/fixtures/scenes/mesh-shadow-material/blockmat.esshader
index c131bbf31..b05e49389 100644
--- a/fixtures/scenes/mesh-shadow-material/blockmat.esshader
+++ b/fixtures/scenes/mesh-shadow-material/blockmat.esshader
@@ -1,6 +1,6 @@
#pragma shader "BlockerMaterial"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma fragment
precision mediump float;
diff --git a/fixtures/scenes/mesh-skin-mat/skinmat.esshader b/fixtures/scenes/mesh-skin-mat/skinmat.esshader
index 4908ce3bb..c70294e91 100644
--- a/fixtures/scenes/mesh-skin-mat/skinmat.esshader
+++ b/fixtures/scenes/mesh-skin-mat/skinmat.esshader
@@ -1,6 +1,6 @@
#pragma shader "SkinnedMaterial"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_tint color default(1,1,1,1)
#pragma fragment
diff --git a/sdk/src/render/builtinShaders.ts b/sdk/src/render/builtinShaders.ts
index 2e00ed2f0..58a9d281a 100644
--- a/sdk/src/render/builtinShaders.ts
+++ b/sdk/src/render/builtinShaders.ts
@@ -6,7 +6,7 @@
* @details Each template carries a `#pragma fragment wgsl` twin so it compiles
* on the WebGPU backend. Twins run under the canonical fragment-only
* contract: `fs_main(v : VSOut)` with v.v_color / v.v_texCoord
- * (+ v.v_worldPos on Lit2D), the batch textures as t0..t7 / s0..s7,
+ * (+ v.v_worldPos on Lit), the batch textures as t0..t7 / s0..s7,
* params as mc.<name>, texture params as <name> + <name>_s, and the
* frame clock as tc.u_time / tc.u_viewport.
*/
@@ -50,7 +50,7 @@ const template = (id: string, label: string, description: string, source: string
const SPRITE_UNLIT = `#pragma shader "Sprite Unlit"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_tint color default(1,1,1,1)
#pragma fragment
@@ -77,7 +77,7 @@ void main() {
const SPRITE_LIT = `#pragma shader "Sprite Lit"
#pragma version 300 es
-#pragma domain Lit2D
+#pragma domain Lit
#pragma param u_tint color default(1,1,1,1)
#pragma param u_normalMap texture default(flatnormal)
@@ -127,7 +127,7 @@ void main() {
const SPRITE_HIT_FLASH = `#pragma shader "Hit Flash"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_flash float default(0) range(0,1) ui(slider)
#pragma param u_flashColor color default(1,1,1,1)
@@ -158,7 +158,7 @@ void main() {
const SPRITE_OUTLINE = `#pragma shader "Outline"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_outlineColor color default(1,1,1,1)
#pragma param u_outlineWidth float default(1) range(0,8)
@@ -208,7 +208,7 @@ void main() {
const SPRITE_DISSOLVE = `#pragma shader "Dissolve"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_progress float default(0) range(0,1) ui(slider)
#pragma param u_edgeColor color default(1,0.5,0,1)
#pragma param u_edgeWidth float default(0.08) range(0,0.5)
@@ -267,7 +267,7 @@ fn noise2d(p : vec2f) -> f32 {
const SPRITE_PIXELATE = `#pragma shader "Pixelate"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_pixels float default(32) range(2,256)
#pragma fragment
@@ -296,7 +296,7 @@ void main() {
const SPRITE_UV_SCROLL = `#pragma shader "UV Scroll"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_scrollSpeed vec2 default(0.1,0)
#pragma fragment
@@ -329,7 +329,7 @@ void main() {
// and a component does not — a MeshRenderer's per-object attributes are full.
const MODEL = `#pragma shader "Model"
#pragma version 300 es
-#pragma domain Lit2D
+#pragma domain Lit
#pragma param u_tint color default(1,1,1,1)
#pragma param u_normalMap texture default(flatnormal)
#pragma param u_emissive color default(0,0,0,1)
diff --git a/sdk/src/render/filters.ts b/sdk/src/render/filters.ts
index ed0bd8085..1280a171f 100644
--- a/sdk/src/render/filters.ts
+++ b/sdk/src/render/filters.ts
@@ -8,7 +8,7 @@ import { Material, type ShaderHandle } from './material';
// raw-GLSL form of this filter was unusable by construction).
const COLOR_MATRIX_ESSHADER = `#pragma shader "ColorMatrixFilter"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_cmRow0 vec4 default(1,0,0,0)
#pragma param u_cmRow1 vec4 default(0,1,0,0)
#pragma param u_cmRow2 vec4 default(0,0,1,0)
diff --git a/sdk/src/render/materialGraph.ts b/sdk/src/render/materialGraph.ts
index 931d954f2..8927a177a 100644
--- a/sdk/src/render/materialGraph.ts
+++ b/sdk/src/render/materialGraph.ts
@@ -18,6 +18,8 @@
/** A node's GLSL output type. Determines how it combines and how it promotes to fragColor. */
export type GraphType = 'float' | 'vec2' | 'vec3' | 'vec4';
+import { RENAMED_DOMAINS } from './shaderReflect';
+
export type GraphNodeType =
| 'output' // the root: its `color` input becomes fragColor
| 'uv' // v_texCoord
@@ -51,7 +53,7 @@ export interface MaterialGraphNode {
export interface MaterialGraph {
name?: string;
- /** Material domain (Unlit2D default; Lit2D etc. flow through unchanged). */
+ /** Material domain (Unlit default; Lit etc. flow through unchanged, under its current name). */
domain?: string;
/** Id of the `output` node — the compile root. */
output: string;
@@ -274,7 +276,7 @@ export function compileMaterialGraph(graph: MaterialGraph): string {
const result = emit(graph.output);
const name = graph.name ?? 'Graph';
- const domain = graph.domain ?? 'Unlit2D';
+ const domain = RENAMED_DOMAINS[graph.domain ?? ''] ?? graph.domain ?? 'Unlit';
const paramBlock = params.length ? params.join('\n') + '\n' : '';
const helperBlock = helpers.size ? [...helpers].join('\n') + '\n\n' : '';
const whelperBlock = whelpers.size ? [...whelpers].join('\n') + '\n\n' : '';
diff --git a/sdk/src/render/shaderReflect.ts b/sdk/src/render/shaderReflect.ts
index 95e8f18bd..1e54166ca 100644
--- a/sdk/src/render/shaderReflect.ts
+++ b/sdk/src/render/shaderReflect.ts
@@ -18,7 +18,7 @@
*
* Grammar (matches ShaderParser):
* #pragma param <name> <type> [default(csv)] [range(min,max)] [ui(hint)]
- * #pragma domain <Unlit2D|Lit2D|PostProcess|UI>
+ * #pragma domain <Unlit|Lit|PostProcess|UI>
*/
export type ShaderParamType = 'float' | 'vec2' | 'vec3' | 'vec4' | 'color' | 'int' | 'texture';
@@ -119,10 +119,18 @@ export function paramDefaultValue(param: ShaderParam): unknown {
return vec;
}
+/**
+ * A domain a shader was authored against, under the name the engine uses now.
+ * The twin of the engine parser's own table: the two lit domains were named for
+ * a plane before either was the only one there is, and a `.esshader` carries no
+ * format version to migrate by, so the old spelling is answered on the way in.
+ */
+export const RENAMED_DOMAINS: Readonly<Record<string, string>> = { Lit2D: 'Lit', Unlit2D: 'Unlit' };
+
/** Parse a `.esshader` source into its declared parameters and domain. */
export function reflectEsshader(source: string): ShaderReflection {
const params: ShaderParam[] = [];
- let domain = 'Unlit2D';
+ let domain = 'Unlit';
for (const raw of source.split('\n')) {
const line = raw.trim();
@@ -136,7 +144,7 @@ export function reflectEsshader(source: string): ShaderReflection {
const p = parseParam(arg);
if (p) params.push(p);
} else if (directive === 'domain' && arg) {
- domain = arg;
+ domain = RENAMED_DOMAINS[arg] ?? arg;
}
}
diff --git a/sdk/src/render/spriteFilter.ts b/sdk/src/render/spriteFilter.ts
index 4e51fa73f..c83a5b98c 100644
--- a/sdk/src/render/spriteFilter.ts
+++ b/sdk/src/render/spriteFilter.ts
@@ -18,7 +18,7 @@ import { Material, type MaterialHandle, type ShaderHandle } from './material';
// no attribute bindings, and its loose uniforms bypassed the material system.
const OUTLINE_ESSHADER = `#pragma shader "SpriteOutlineFilter"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_outlineColor color default(1,1,1,1)
#pragma param u_outlineWidth float default(1) range(0,8)
#pragma param u_texelSize vec2 default(0.001953125,0.001953125)
@@ -71,7 +71,7 @@ void main() {
const SHADOW_ESSHADER = `#pragma shader "SpriteShadowFilter"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_shadowColor color default(0,0,0,0.6)
#pragma param u_shadowOffset vec2 default(3,3)
#pragma param u_shadowBlur float default(2)
diff --git a/sdk/tests/materialGraph.test.ts b/sdk/tests/materialGraph.test.ts
index 419804b00..c31a3e2ae 100644
--- a/sdk/tests/materialGraph.test.ts
+++ b/sdk/tests/materialGraph.test.ts
@@ -30,7 +30,7 @@ describe('compileMaterialGraph', () => {
const src = compileMaterialGraph(tintGraph);
expect(src).toContain('#pragma param u_albedo texture default(white)');
expect(src).toContain('#pragma param u_tint color default(1,1,1,1)');
- expect(src).toContain('#pragma domain Unlit2D');
+ expect(src).toContain('#pragma domain Unlit');
expect(src).toContain('#pragma shader "GraphTint"');
});
@@ -109,8 +109,9 @@ describe('compileMaterialGraph', () => {
expect(compileMaterialGraph(g)).toContain('fragColor = vec4(vec3(u_g), 1.0);');
});
- it('passes a Lit2D domain through', () => {
- expect(compileMaterialGraph({ ...tintGraph, domain: 'Lit2D' })).toContain('#pragma domain Lit2D');
+ it('passes a Lit domain through, and a graph saved under the old name compiles to the new one', () => {
+ expect(compileMaterialGraph({ ...tintGraph, domain: 'Lit' })).toContain('#pragma domain Lit');
+ expect(compileMaterialGraph({ ...tintGraph, domain: 'Lit2D' })).toContain('#pragma domain Lit');
});
it('emits oneMinus / saturate preserving the input type', () => {
diff --git a/sdk/tests/shader-reflect.test.ts b/sdk/tests/shader-reflect.test.ts
index a1c57cb8c..24e736d45 100644
--- a/sdk/tests/shader-reflect.test.ts
+++ b/sdk/tests/shader-reflect.test.ts
@@ -7,7 +7,7 @@ import { BUILTIN_SHADER_TEMPLATES, builtinShaderTemplate } from '../src/render/b
const SRC = `
#pragma shader "ParamTest"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma param u_strength float default(1) range(0,4) ui(slider)
#pragma param u_tint color default(1,0.5,0.25,1)
#pragma param u_offset vec2 default(3,4)
@@ -24,7 +24,7 @@ void main() {}
describe('reflectEsshader', () => {
it('parses domain and all params', () => {
const r = reflectEsshader(SRC);
- expect(r.domain).toBe('Unlit2D');
+ expect(r.domain).toBe('Unlit');
expect(r.params.map((p) => p.name)).toEqual(['u_strength', 'u_tint', 'u_offset', 'u_noise']);
});
@@ -68,7 +68,14 @@ describe('reflectEsshader', () => {
});
it('returns the default domain when none is declared', () => {
- expect(reflectEsshader('#pragma param u_a float').domain).toBe('Unlit2D');
+ expect(reflectEsshader('#pragma param u_a float').domain).toBe('Unlit');
+ });
+
+ // A .esshader has no format version, so the old spelling is answered here or
+ // nowhere: a shader written before the rename reflects as the domain it means.
+ it('reads a domain written under its old name', () => {
+ expect(reflectEsshader('#pragma domain Lit2D').domain).toBe('Lit');
+ expect(reflectEsshader('#pragma domain Unlit2D').domain).toBe('Unlit');
});
});
diff --git a/src/esengine/bindings/RendererBindings.cpp b/src/esengine/bindings/RendererBindings.cpp
index cfbaaa02c..0c984efcf 100644
--- a/src/esengine/bindings/RendererBindings.cpp
+++ b/src/esengine/bindings/RendererBindings.cpp
@@ -1116,7 +1116,7 @@ void renderer_renderMaterialPreview(u32 materialId, i32 w, i32 h) {
if (!g_renderFrame || w <= 0 || h <= 0) return;
// A throwaway one-sprite scene: a 2×2 quad filling the ortho [-1,1] with the material, lit by
- // one white directional light so Lit2D materials preview lit (Unlit2D ignores it).
+ // one white directional light so Lit materials preview lit (Unlit ignores it).
ecs::Registry reg;
auto quad = reg.create();
reg.emplace<ecs::Transform>(quad);
diff --git a/src/esengine/data/shaders/batch.esshader b/src/esengine/data/shaders/batch.esshader
index d00909dca..24b647da8 100644
--- a/src/esengine/data/shaders/batch.esshader
+++ b/src/esengine/data/shaders/batch.esshader
@@ -7,7 +7,7 @@
#pragma feature SDF
// Compile-time variant: lit by the scene's 2D lights (Sprite.lit). Compiled as a
-// Lit2D-domain shader, so applyLighting2D + LightConstants are injected.
+// Lit-domain shader, so applyLighting2D + LightConstants are injected.
#pragma feature LIT
// Compile-time variant: discard fragments the sprite draws as (near-)transparent.
diff --git a/src/esengine/data/shaders/mesh.esshader b/src/esengine/data/shaders/mesh.esshader
index 4d60b728a..8600d6ae8 100644
--- a/src/esengine/data/shaders/mesh.esshader
+++ b/src/esengine/data/shaders/mesh.esshader
@@ -1,11 +1,11 @@
#pragma shader "Mesh"
#pragma version 300 es
-// Lit2D domain for the LIGHTING it injects (LightConstants + applyLighting2D),
+// Lit domain for the LIGHTING it injects (LightConstants + applyLighting2D),
// not for its canonical vertex stage — that is only supplied to a shader which
// writes none, and this one writes its own to place local vertices by a model
// matrix. So the light math is shared with every 2D lit surface rather than
// copied, and the std140 block stays the engine's to own.
-#pragma domain Lit2D
+#pragma domain Lit
// What the GEOMETRY carries. A layout may not declare an attribute its shader
// does not consume, so the normal channel and the per-object normal matrix are
diff --git a/src/esengine/data/shaders/sky.esshader b/src/esengine/data/shaders/sky.esshader
index d05186546..118de7463 100644
--- a/src/esengine/data/shaders/sky.esshader
+++ b/src/esengine/data/shaders/sky.esshader
@@ -1,6 +1,6 @@
#pragma shader "Sky"
#pragma version 300 es
-#pragma domain Lit2D
+#pragma domain Lit
// The background half of an environment. The reflection in a metal ball and the
// sky behind it are the same baked panorama; without this only one of them was
diff --git a/src/esengine/ecs/components/Light.hpp b/src/esengine/ecs/components/Light.hpp
index a79bc9b77..f870b41de 100644
--- a/src/esengine/ecs/components/Light.hpp
+++ b/src/esengine/ecs/components/Light.hpp
@@ -2,9 +2,9 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
/**
* @file Light.hpp
- * @brief 2D light source component for the Lit2D material domain.
+ * @brief 2D light source component for the Lit material domain.
* @details A scene's Light components are gathered by the render collect path into the
- * per-frame LightConstants UBO (binding 2); Lit2D-domain material shaders read them
+ * per-frame LightConstants UBO (binding 2); Lit-domain material shaders read them
* via the injected applyLighting2D() helper. Point/Directional/Spot lights occupy a
* light slot; Ambient lights sum into the ambient term. This component carries only
* the light's intrinsic parameters. Where a light sits and where it aims are the
@@ -41,7 +41,7 @@ enum class LightType : i32 {
};
/**
- * @brief A 2D light contributing to Lit2D-shaded materials.
+ * @brief A 2D light contributing to Lit-shaded materials.
*
* @code
* auto& light = registry.emplace<Light>(e);
diff --git a/src/esengine/ecs/components/ShadowCaster2D.hpp b/src/esengine/ecs/components/ShadowCaster2D.hpp
index 8634a5494..fa859486d 100644
--- a/src/esengine/ecs/components/ShadowCaster2D.hpp
+++ b/src/esengine/ecs/components/ShadowCaster2D.hpp
@@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
/**
* @file ShadowCaster2D.hpp
- * @brief Marks an entity as a 2D shadow occluder for the Lit2D lighting path.
+ * @brief Marks an entity as a 2D shadow occluder for the Lit lighting path.
* @details The render collect path turns each enabled caster into a world-space AABB (centered
* on the entity's Transform, `size` wide/tall) and feeds it to LightStore as an occluder.
* A point/spot light is then blocked at any fragment whose segment to the light crosses
diff --git a/src/esengine/renderer/draw/BatchBuilder.hpp b/src/esengine/renderer/draw/BatchBuilder.hpp
index 5c350c4f0..b88388f77 100644
--- a/src/esengine/renderer/draw/BatchBuilder.hpp
+++ b/src/esengine/renderer/draw/BatchBuilder.hpp
@@ -87,7 +87,7 @@ struct BatchDrawKey {
// slot 1. Not the same thing as the Batch stream's extra slots, which are a
// MERGE product chosen per vertex.
u32 normalTextureId = 0;
- // The frame's shadow map, on the slot the injected Lit2D header samples. Per-draw
+ // The frame's shadow map, on the slot the injected Lit header samples. Per-draw
// like the two above rather than a global unit: which draws receive a shadow is a
// question the collect answers, and the device has no "bind for everyone" seam.
u32 shadowTextureId = 0;
diff --git a/src/esengine/renderer/frame/RenderContext.hpp b/src/esengine/renderer/frame/RenderContext.hpp
index b5aa95bee..f7d11547e 100644
--- a/src/esengine/renderer/frame/RenderContext.hpp
+++ b/src/esengine/renderer/frame/RenderContext.hpp
@@ -182,7 +182,7 @@ public:
/**
* @brief The engine-side per-frame 2D light registry (binding 2 LightConstants UBO).
* @details Filled by the render collect path from the scene's Light components and uploaded
- * once per frame; Lit2D material shaders read it. Lives here next to materials() so
+ * once per frame; Lit material shaders read it. Lives here next to materials() so
* the render path reaches one store / one UBO without a global lookup.
*/
LightStore& lights() { return lights_; }
diff --git a/src/esengine/renderer/frame/RenderFrame.cpp b/src/esengine/renderer/frame/RenderFrame.cpp
index 1c465ddbc..dbbb7c45f 100644
--- a/src/esengine/renderer/frame/RenderFrame.cpp
+++ b/src/esengine/renderer/frame/RenderFrame.cpp
@@ -706,7 +706,7 @@ void RenderFrame::collectLights(ecs::Registry& registry) {
continue;
}
- GpuLight2D gpu;
+ GpuLight gpu;
bool castsMeshShadow = false;
ShadowCaster caster;
gpu.color = glm::vec4(rgb, light.intensity);
@@ -773,14 +773,14 @@ void RenderFrame::collectLights(ecs::Registry& registry) {
collected.push_back({gpu, castsMeshShadow, caster});
}
- if (collected.size() > MAX_LIGHTS_2D) {
- std::partial_sort(collected.begin(), collected.begin() + MAX_LIGHTS_2D, collected.end(),
+ if (collected.size() > MAX_LIGHTS) {
+ std::partial_sort(collected.begin(), collected.begin() + MAX_LIGHTS, collected.end(),
[](const CollectedLight& a, const CollectedLight& b) {
return a.gpu.color.a > b.gpu.color.a;
});
ES_LOG_WARN("collectLights: {} lights exceed the {}-light cap; keeping the brightest",
- collected.size(), MAX_LIGHTS_2D);
- collected.resize(MAX_LIGHTS_2D);
+ collected.size(), MAX_LIGHTS);
+ collected.resize(MAX_LIGHTS);
}
for (u32 slot = 0; slot < collected.size(); ++slot) {
if (collected[slot].castsMeshShadow) {
@@ -1127,7 +1127,7 @@ void RenderFrame::renderShadowMap(ecs::Registry& registry) {
// it sits inside either clip volume as built, and the depths it writes are
// compared against the copy of it the receiving shader holds.
context_.updateFrameConstants(projection);
- // The depth variant is still a Lit2D shader and still declares the light block,
+ // The depth variant is still a Lit shader and still declares the light block,
// and a draw whose declared UBO is unbound is undefined behaviour that draws
// nothing — the whole pass came back empty for exactly this.
context_.lights().uploadAndBind();
@@ -1278,10 +1278,10 @@ resource::ShaderHandle RenderFrame::compileBatchVariant(const std::vector<std::s
// preprocessor.
const auto target = resource_manager_.preferredShaderTarget();
auto parsed = resource::ShaderParser::parse(ShaderEmbeds::BATCH);
- // LIT is a Lit2D-domain variant: the domain drives the lighting injection,
- // same path as Lit2D material shaders.
+ // LIT is a Lit-domain variant: the domain drives the lighting injection,
+ // same path as Lit material shaders.
if (std::find(features.begin(), features.end(), "LIT") != features.end()) {
- parsed.domain = "Lit2D";
+ parsed.domain = "Lit";
}
resource::ShaderHandle handle = resource_manager_.createShaderWithBindings(
resource::ShaderParser::assembleStage(parsed, resource::ShaderStage::Vertex, "", features, target),
diff --git a/src/esengine/renderer/frame/RenderFrame.hpp b/src/esengine/renderer/frame/RenderFrame.hpp
index 152932684..bbdf714f7 100644
--- a/src/esengine/renderer/frame/RenderFrame.hpp
+++ b/src/esengine/renderer/frame/RenderFrame.hpp
@@ -342,7 +342,7 @@ private:
void applySceneDepthNeed();
/// Gathers the scene's enabled Light components into the per-frame LightConstants UBO
/// (point/directional into the light array, ambient summed). Run each frame in collectAll;
- /// flush() uploads + binds the result so Lit2D material shaders read it.
+ /// flush() uploads + binds the result so Lit material shaders read it.
void collectLights(ecs::Registry& registry);
/// Makes this ambient light the frame's environment, when it names one that is
@@ -396,7 +396,7 @@ private:
/// inside the GPU struct, because the cap sort reorders these and the answer has
/// to travel with the light.
struct CollectedLight {
- GpuLight2D gpu;
+ GpuLight gpu;
bool castsMeshShadow;
ShadowCaster caster;
};
diff --git a/src/esengine/renderer/rhi/Shader.cpp b/src/esengine/renderer/rhi/Shader.cpp
index ab34a8a71..962f2db4c 100644
--- a/src/esengine/renderer/rhi/Shader.cpp
+++ b/src/esengine/renderer/rhi/Shader.cpp
@@ -233,7 +233,7 @@ bool Shader::compile(const std::string& vertexSrc, const std::string& fragmentSr
device_->uniformBlockBinding(program_, materialBlock, MATERIAL_CONSTANTS_BINDING);
}
- // Same for the per-frame 2D light block (ShaderParser injects it for Lit2D-domain shaders);
+ // Same for the per-frame 2D light block (ShaderParser injects it for Lit-domain shaders);
// the render path uploads + binds the shared LightConstants UBO here once per frame.
u32 lightBlock = device_->getUniformBlockIndex(program_, LIGHT_CONSTANTS_BLOCK);
if (lightBlock != GFX_INVALID_UNIFORM_BLOCK) {
@@ -260,7 +260,7 @@ bool Shader::compile(const std::string& vertexSrc, const std::string& fragmentSr
}
// Engine-injected samplers sit on fixed units, pinned here for the same reason the
- // blocks above are: the header reaches every Lit2D shader, so a compile site that
+ // blocks above are: the header reaches every Lit shader, so a compile site that
// forgot the unit would sample slot 0 silently. GLSL ES 300 has no layout(binding).
if (hasUniform(SHADOW_MAP_SAMPLER) || hasUniform(ENV_MAP_SAMPLER)) {
bind();
diff --git a/src/esengine/renderer/rhi/ShaderEmbeds.generated.hpp b/src/esengine/renderer/rhi/ShaderEmbeds.generated.hpp
index 13748b565..fac70db9f 100644
--- a/src/esengine/renderer/rhi/ShaderEmbeds.generated.hpp
+++ b/src/esengine/renderer/rhi/ShaderEmbeds.generated.hpp
@@ -11,7 +11,7 @@ inline constexpr const char* BATCH = R"esshader(#pragma shader "Batch"
#pragma feature SDF
// Compile-time variant: lit by the scene's 2D lights (Sprite.lit). Compiled as a
-// Lit2D-domain shader, so applyLighting2D + LightConstants are injected.
+// Lit-domain shader, so applyLighting2D + LightConstants are injected.
#pragma feature LIT
// Compile-time variant: discard fragments the sprite draws as (near-)transparent.
@@ -266,12 +266,12 @@ void main() {
inline constexpr const char* MESH = R"esshader(#pragma shader "Mesh"
#pragma version 300 es
-// Lit2D domain for the LIGHTING it injects (LightConstants + applyLighting2D),
+// Lit domain for the LIGHTING it injects (LightConstants + applyLighting2D),
// not for its canonical vertex stage — that is only supplied to a shader which
// writes none, and this one writes its own to place local vertices by a model
// matrix. So the light math is shared with every 2D lit surface rather than
// copied, and the std140 block stays the engine's to own.
-#pragma domain Lit2D
+#pragma domain Lit
// What the GEOMETRY carries. A layout may not declare an attribute its shader
// does not consume, so the normal channel and the per-object normal matrix are
@@ -829,7 +829,7 @@ struct VSOut {
inline constexpr const char* SKY = R"esshader(#pragma shader "Sky"
#pragma version 300 es
-#pragma domain Lit2D
+#pragma domain Lit
// The background half of an environment. The reflection in a metal ball and the
// sky behind it are the same baked panorama; without this only one of them was
diff --git a/src/esengine/renderer/store/LightConstants.hpp b/src/esengine/renderer/store/LightConstants.hpp
index 85c31da87..d0dfe569f 100644
--- a/src/esengine/renderer/store/LightConstants.hpp
+++ b/src/esengine/renderer/store/LightConstants.hpp
@@ -4,7 +4,7 @@
* @file LightConstants.hpp
* @brief Per-frame 2D lighting constants — the third tier of the engine's constant-buffer
* layering (after per-frame FrameConstants at 0 and per-material MaterialConstants at 1).
- * @details A Lit2D-domain material shader (#pragma domain Lit2D) gets a `layout(std140) uniform
+ * @details A Lit-domain material shader (#pragma domain Lit) gets a `layout(std140) uniform
* LightConstants { ... }` block auto-injected by ShaderParser, and Shader::compile links
* it to LIGHT_CONSTANTS_BINDING. LightStore (owned by RenderContext) collects the scene's
* Light components into this CPU mirror each frame and uploads it once. The GLSL struct
@@ -26,7 +26,7 @@ inline constexpr const char* LIGHT_CONSTANTS_BLOCK = "LightConstants";
/**
* @brief The injected shadow-map sampler, and the texture unit Shader::compile pins it to.
- * @details Every Lit2D shader gets the sampler from the injected header, so the unit is a
+ * @details Every Lit shader gets the sampler from the injected header, so the unit is a
* contract rather than something each compile site repeats. Slot 2 sits after the
* draw's own two (base colour, normal map) — see BatchBuilder's slot assembly.
*/
@@ -42,7 +42,7 @@ inline constexpr u32 ENV_MAP_TEXTURE_UNIT = 3;
* bound; inactive slots are zeroed (intensity 0) so they contribute nothing. Must match
* the `u_lights[..]` array size in ShaderParser's injected GLSL.
*/
-inline constexpr u32 MAX_LIGHTS_2D = 16;
+inline constexpr u32 MAX_LIGHTS = 16;
/**
* @brief Max 2D shadow occluders packed into the UBO (axis-aligned boxes in world space).
@@ -93,7 +93,7 @@ inline constexpr u32 MAX_SHADOW_TILES = 16;
* only a surface with real geometry measures against (MESH_NORMALS); w = a spot's
* cone-axis third component. Read by shadowFactor2D and lightVector/spotCone.
*/
-struct GpuLight2D {
+struct GpuLight {
glm::vec4 posDir{0.0f};
glm::vec4 color{0.0f};
glm::vec4 spot{0.0f};
@@ -109,14 +109,14 @@ struct GpuLight2D {
/**
* @brief CPU mirror of the GLSL LightConstants block (std140).
* @details ambient: rgb = summed ambient color, a = active light count (informational).
- * std140 array-of-struct stride is 80 (each GpuLight2D is five 16-aligned vec4s), so
- * lights start at offset 16 and the lights array spans 80*MAX_LIGHTS_2D bytes.
+ * std140 array-of-struct stride is 80 (each GpuLight is five 16-aligned vec4s), so
+ * lights start at offset 16 and the lights array spans 80*MAX_LIGHTS bytes.
*/
struct LightConstants {
glm::vec4 ambient{0.0f};
- GpuLight2D lights[MAX_LIGHTS_2D];
+ GpuLight lights[MAX_LIGHTS];
/// x = active occluder count; yzw unused. Appended after `lights` so existing std140
- /// offsets (ambient, lights) are unchanged — old Lit2D shaders keep reading the same bytes.
+ /// offsets (ambient, lights) are unchanged — old Lit shaders keep reading the same bytes.
glm::vec4 occluderCount{0.0f};
/// World-space AABBs: (minX, minY, maxX, maxY). A light is shadowed at a fragment when the
/// fragment→light segment (or, for directional, the fragment→far-along-light-dir segment)
@@ -146,8 +146,8 @@ struct LightConstants {
glm::vec4 envTint{0.0f};
};
-static_assert(sizeof(GpuLight2D) == 80, "GpuLight2D must be std140-tight (five vec4s)");
-static_assert(sizeof(LightConstants) == 16 + 80 * MAX_LIGHTS_2D + 16 + 16 * MAX_OCCLUDERS_2D
+static_assert(sizeof(GpuLight) == 80, "GpuLight must be std140-tight (five vec4s)");
+static_assert(sizeof(LightConstants) == 16 + 80 * MAX_LIGHTS + 16 + 16 * MAX_OCCLUDERS_2D
+ 64 * MAX_SHADOW_TILES + 16 * MAX_SHADOW_TILES
+ 16 + 16 * 9 + 16 + 16,
"LightConstants must match the std140 GLSL block layout");
diff --git a/src/esengine/renderer/store/LightStore.hpp b/src/esengine/renderer/store/LightStore.hpp
index 0a402b13c..db3556669 100644
--- a/src/esengine/renderer/store/LightStore.hpp
+++ b/src/esengine/renderer/store/LightStore.hpp
@@ -6,7 +6,7 @@
* @details The render collect path clears this each frame, then accumulates the scene's enabled
* Light components into it (point/directional into the lights array, ambient summed
* into the ambient term). flush() uploads the mirror once and binds it at
- * LIGHT_CONSTANTS_BINDING, so every Lit2D shader reads the same lighting UBO. Owned by
+ * LIGHT_CONSTANTS_BINDING, so every Lit shader reads the same lighting UBO. Owned by
* RenderContext so both the render path and any future SDK push reach one store / one UBO.
*
* @author ESEngine Team
@@ -60,10 +60,10 @@ public:
dirty_ = true;
}
- /// Appends a point/directional light. Silently drops past MAX_LIGHTS_2D (the fixed shader loop
+ /// Appends a point/directional light. Silently drops past MAX_LIGHTS (the fixed shader loop
/// bound); callers keep the most significant lights first if they exceed the cap.
- void addLight(const GpuLight2D& light) {
- if (count_ >= MAX_LIGHTS_2D) return;
+ void addLight(const GpuLight& light) {
+ if (count_ >= MAX_LIGHTS) return;
data_.lights[count_++] = light;
data_.ambient.w = static_cast<f32>(count_);
dirty_ = true;
diff --git a/src/esengine/resource/ShaderParser.cpp b/src/esengine/resource/ShaderParser.cpp
index b2e331689..6de8605e3 100644
--- a/src/esengine/resource/ShaderParser.cpp
+++ b/src/esengine/resource/ShaderParser.cpp
@@ -117,10 +117,10 @@ std::string wgslCanonicalVSOut(bool lit) {
return src;
}
-// WGSL twin of canonical2DVertexStage: same attribute locations, GLSL names
+// WGSL twin of canonicalVertexStage: same attribute locations, GLSL names
// kept behind struct fields (a_position -> v.a_position) so the two stages diff
// cleanly. FrameConstants arrives with the injected headers.
-std::string canonical2DVertexStageWGSL(bool lit) {
+std::string canonicalVertexStageWGSL(bool lit) {
std::string src = wgslCanonicalVSOut(lit);
src +=
"\n"
@@ -241,7 +241,7 @@ std::string canonicalPPVertexStage() {
// Canonical 2D vertex stage for fragment-only .esshaders, in its three VERTEX
// SOURCES: batch (already world space), resident mesh (local + a per-object
// transform), skinned (posed by bones). One material serves all three.
-std::string canonical2DVertexStage(bool lit) {
+std::string canonicalVertexStage(bool lit) {
std::string src =
"layout(location = 0) in vec3 a_position;\n"
"layout(location = 1) in vec4 a_color;\n"
@@ -317,6 +317,18 @@ std::string canonical2DVertexStage(bool lit) {
return src;
}
+/**
+ * A domain a shader was authored against, under the name the engine uses now.
+ * A `.esshader` has no format version to migrate by, so the spelling from before
+ * the lit domains were renamed is answered here: one door, and nothing
+ * downstream sees two names.
+ */
+std::string normalizeDomain(const std::string& authored) {
+ if (authored == "Lit2D") return "Lit";
+ if (authored == "Unlit2D") return "Unlit";
+ return authored;
+}
+
} // namespace
// =============================================================================
@@ -412,7 +424,7 @@ ParsedShader ShaderParser::parse(const std::string& source, const ShaderIncludeR
}
if (directive == "domain") {
- if (!argument.empty()) result.domain = argument;
+ if (!argument.empty()) result.domain = normalizeDomain(argument);
continue;
}
@@ -554,8 +566,8 @@ ParsedShader ShaderParser::parse(const std::string& source, const ShaderIncludeR
if (result.stages.find(ShaderStage::Vertex) == result.stages.end()) {
// Fragment-only authoring: 2D domains get the canonical batch-space
// pass-through, PostProcess the canonical fullscreen pass-through.
- if (result.domain == "Unlit2D" || result.domain == "Lit2D") {
- result.stages[ShaderStage::Vertex] = canonical2DVertexStage(result.domain == "Lit2D");
+ if (result.domain == "Unlit" || result.domain == "Lit") {
+ result.stages[ShaderStage::Vertex] = canonicalVertexStage(result.domain == "Lit");
result.vertexIsCanonical = true;
} else if (result.domain == "PostProcess") {
result.stages[ShaderStage::Vertex] = canonicalPPVertexStage();
@@ -575,8 +587,8 @@ ParsedShader ShaderParser::parse(const std::string& source, const ShaderIncludeR
// VSOut interface. A file with no wgsl sections simply has no twin.
if (result.wgslStages.count(ShaderStage::Fragment) != 0 &&
result.wgslStages.count(ShaderStage::Vertex) == 0) {
- if (result.domain == "Unlit2D" || result.domain == "Lit2D") {
- result.wgslStages[ShaderStage::Vertex] = canonical2DVertexStageWGSL(result.domain == "Lit2D");
+ if (result.domain == "Unlit" || result.domain == "Lit") {
+ result.wgslStages[ShaderStage::Vertex] = canonicalVertexStageWGSL(result.domain == "Lit");
result.wgslVertexIsCanonical = true;
} else if (result.domain == "PostProcess") {
result.wgslStages[ShaderStage::Vertex] = canonicalPPVertexStageWGSL();
@@ -711,9 +723,9 @@ std::string wgslMaterialTextureDecls(const ParsedShader& parsed) {
return src;
}
-// Lit2D injection twin: LightConstants (binding 2) + the lighting/shadow
-// helpers, ported line for line from the GLSL kLit2DHeader. Array strides
-// (Light2D = 64 bytes, vec4f = 16) satisfy WGSL's uniform layout rules, so the
+// Lit injection twin: LightConstants (binding 2) + the lighting/shadow
+// helpers, ported line for line from the GLSL kLitHeader. Array strides
+// (Light = 64 bytes, vec4f = 16) satisfy WGSL's uniform layout rules, so the
// block matches renderer/LightConstants.hpp on both backends. sampleNormal
// takes the de-combined texture+sampler pair and samples mip 0 explicitly,
// keeping calls legal in non-uniform control flow.
@@ -725,10 +737,10 @@ fn linearToSrgb(c : vec3f) -> vec3f {
}
)";
-const char* kLit2DHeaderWGSL = R"(struct Light2D { posDir : vec4f, color : vec4f, spot : vec4f, shadow : vec4f, shadowMap : vec4f };
+const char* kLitHeaderWGSL = R"(struct Light { posDir : vec4f, color : vec4f, spot : vec4f, shadow : vec4f, shadowMap : vec4f };
struct LightConstants {
u_ambient : vec4f,
- u_lights : array<Light2D, 16>,
+ u_lights : array<Light, 16>,
u_occluderCount : vec4f,
u_occluders : array<vec4f, 8>,
u_shadowMatrix : array<mat4x4f, 16>,
@@ -1249,7 +1261,7 @@ ShaderParser::AssembledStage assembleWGSLStage(const ParsedShader& parsed,
headerLines += countNewlines(s);
};
- const bool lit = parsed.domain == "Lit2D";
+ const bool lit = parsed.domain == "Lit";
if (stage == ShaderStage::Fragment && parsed.wgslVertexIsCanonical) {
// The canonical vertex's varying interface (domain-shaped) + the
// engine texture contract — fragment-only twins run under the batch
@@ -1271,7 +1283,7 @@ ShaderParser::AssembledStage assembleWGSLStage(const ParsedShader& parsed,
}
if (stage == ShaderStage::Fragment) {
inject(wgslMaterialTextureDecls(parsed));
- if (lit) inject(kLit2DHeaderWGSL);
+ if (lit) inject(kLitHeaderWGSL);
inject(kColorHelpersWGSL);
}
@@ -1391,21 +1403,21 @@ ShaderParser::AssembledStage ShaderParser::assembleStageEx(const ParsedShader& p
}
}
- // Lit2D domain: inject the shared LightConstants block (std140) + the applyLighting2D()
+ // Lit domain: inject the shared LightConstants block (std140) + the applyLighting2D()
// helper into the fragment stage. Authors write the surface (albedo) and a world-position
// varying, then call the helper — the engine owns the std140 layout so a hand-written struct
// can't silently mismatch renderer/LightConstants.hpp and corrupt lighting. Members + locals
// carry explicit highp for the same reason MaterialConstants does: a fragment shader has no
// default float precision until its `precision` line, which follows this injected header.
- // The light-array size and packing here MUST match renderer/LightConstants.hpp (MAX_LIGHTS_2D,
- // GpuLight2D = four vec4s).
- if (stage == ShaderStage::Fragment && parsed.domain == "Lit2D") {
- static const char* kLit2DHeader =
- "struct Light2D { highp vec4 posDir; highp vec4 color; highp vec4 spot; highp vec4 shadow;"
+ // The light-array size and packing here MUST match renderer/LightConstants.hpp (MAX_LIGHTS,
+ // GpuLight = four vec4s).
+ if (stage == ShaderStage::Fragment && parsed.domain == "Lit") {
+ static const char* kLitHeader =
+ "struct Light { highp vec4 posDir; highp vec4 color; highp vec4 spot; highp vec4 shadow;"
" highp vec4 shadowMap; };\n"
"layout(std140) uniform LightConstants {\n"
" highp vec4 u_ambient;\n"
- " Light2D u_lights[16];\n"
+ " Light u_lights[16];\n"
" highp vec4 u_occluderCount;\n" // x = active occluder count
" highp vec4 u_occluders[8];\n" // world AABBs (minX,minY,maxX,maxY)
" highp mat4 u_shadowMatrix[16];\n" // world -> each atlas tile's clip
@@ -1573,7 +1585,7 @@ ShaderParser::AssembledStage ShaderParser::assembleStageEx(const ParsedShader& p
"#endif\n"
"}\n"
// Engine-owned normal-map convention (RGB[0,1] -> normal[-1,1], normalized), so every
- // Lit2D shader unpacks tangent-space normals the same way. 2D applies it screen-space
+ // Lit shader unpacks tangent-space normals the same way. 2D applies it screen-space
// (no per-sprite tangent frame); a flat surface uses vec3(0,0,1).
"highp vec3 sampleNormal(in highp sampler2D map, in highp vec2 uv) {\n"
" return normalize(texture(map, uv).xyz * 2.0 - 1.0);\n"
@@ -1788,7 +1800,7 @@ ShaderParser::AssembledStage ShaderParser::assembleStageEx(const ParsedShader& p
// environment; a surface's own lights are unobstructed by it.
" highp vec3 lit = envIrradiance(N) * ao;\n"
" highp vec3 gloss = vec3(0.0);\n"
- // A Light2D has no third coordinate, so distance stays in the plane and a
+ // A Light has no third coordinate, so distance stays in the plane and a
// point light's height is its radius. Normal and view are the 3D part.
" for (int i = 0; i < 16; ++i) {\n"
" highp vec4 pd = u_lights[i].posDir;\n"
@@ -1864,8 +1876,8 @@ ShaderParser::AssembledStage ShaderParser::assembleStageEx(const ParsedShader& p
"highp vec3 applyLighting2D(highp vec3 albedo, highp vec3 N, highp vec2 worldPos) {\n"
" return applyLighting2DAO(albedo, N, worldPos, 1.0);\n"
"}\n";
- assembled << kLit2DHeader;
- headerLines += countNewlines(kLit2DHeader);
+ assembled << kLitHeader;
+ headerLines += countNewlines(kLitHeader);
}
if (!platform.empty()) {
diff --git a/src/esengine/resource/ShaderParser.hpp b/src/esengine/resource/ShaderParser.hpp
index 7dba38bf7..6fe55fab9 100644
--- a/src/esengine/resource/ShaderParser.hpp
+++ b/src/esengine/resource/ShaderParser.hpp
@@ -65,7 +65,7 @@ struct SourceLine {
* @details Both languages assemble from one ParsedShader: GLSL stages carry the
* authored GLSL bodies; WGSL stages carry the file's `#pragma vertex
* wgsl` / `#pragma fragment wgsl` twin sections. The injected headers
- * (TimeConstants/MaterialConstants/texture params/Lit2D) and the
+ * (TimeConstants/MaterialConstants/texture params/Lit) and the
* canonical 2D vertex stage are emitted per language.
*/
enum class ShaderTargetLanguage : u8 {
@@ -147,7 +147,7 @@ struct ParsedShader {
std::vector<std::string> features; ///< Declared #pragma feature keywords (compile-time variants)
std::vector<ShaderSwitch> switches; ///< Material-controlled #pragma switch toggles (name + default)
std::vector<ShaderProperty> properties; ///< Exposed material params (#pragma param / properties block)
- std::string domain = "Unlit2D"; ///< #pragma domain (Unlit2D/Lit2D/PostProcess/UI)
+ std::string domain = "Unlit"; ///< #pragma domain (Unlit/Lit/PostProcess/UI)
/// std140 byte size of the generated MaterialConstants block (16-aligned), 0 if no
/// non-texture params. The render path sizes the per-material UBO to this.
u32 materialBlockSize = 0;
diff --git a/tests/renderer/test_shader_variant.cpp b/tests/renderer/test_shader_variant.cpp
index aa7840679..97a7c935c 100644
--- a/tests/renderer/test_shader_variant.cpp
+++ b/tests/renderer/test_shader_variant.cpp
@@ -45,7 +45,7 @@ void main() {
// Fragment-only authoring: `#pragma vertex` is optional for 2D domains.
static const char* FRAG_ONLY_UNLIT = R"(#pragma shader "FragOnly"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma fragment
precision mediump float;
@@ -58,7 +58,7 @@ void main() { fragColor = v_color; }
static const char* FRAG_ONLY_LIT = R"(#pragma shader "FragOnlyLit"
#pragma version 300 es
-#pragma domain Lit2D
+#pragma domain Lit
#pragma fragment
precision mediump float;
@@ -104,7 +104,7 @@ void main() { fragColor = vec4(1.0); }
// feature permutation, and the batch texture contract.
static const char* WGSL_TWIN_UNLIT = R"(#pragma shader "WgslTwin"
#pragma version 300 es
-#pragma domain Unlit2D
+#pragma domain Unlit
#pragma feature GLOW
#pragma param u_progress float default(0)
#pragma param u_edgeColor color default(1,0.5,0,1)
@@ -135,7 +135,7 @@ void main() { fragColor = texture(u_textures[0], v_texCoord) * v_color * u_progr
static const char* WGSL_TWIN_LIT = R"(#pragma shader "WgslLit"
#pragma version 300 es
-#pragma domain Lit2D
+#pragma domain Lit
#pragma fragment
precision mediump float;
@@ -204,7 +204,7 @@ static void testWGSLEmission() {
CHECK(vs.find("@vertex fn vs_main") != std::string::npos, "canonical WGSL vertex emitted");
CHECK(vs.find("@group(0) @binding(0) var<uniform> frame") != std::string::npos,
"canonical WGSL vertex reads FrameConstants at binding 0");
- CHECK(vs.find("v_worldPos") == std::string::npos, "Unlit2D WGSL vertex has no world-pos varying");
+ CHECK(vs.find("v_worldPos") == std::string::npos, "Unlit WGSL vertex has no world-pos varying");
const std::string fs = wgsl(p, ShaderStage::Fragment);
CHECK(fs.find("struct VSOut") != std::string::npos, "canonical varying interface injected");
@@ -225,7 +225,7 @@ static void testWGSLEmission() {
CHECK(fs.find("c = c * m;") != std::string::npos &&
fs.find("tc.u_time.x") == std::string::npos,
"feature off: the #else branch survives");
- CHECK(fs.find("LightConstants") == std::string::npos, "Unlit2D gets no lighting injection");
+ CHECK(fs.find("LightConstants") == std::string::npos, "Unlit gets no lighting injection");
const std::string fsGlow = wgsl(p, ShaderStage::Fragment, {"GLOW"});
CHECK(fsGlow.find("mc.u_edgeColor * tc.u_time.x") != std::string::npos &&
@@ -243,14 +243,14 @@ static void testWGSLEmission() {
// sources, and under MESH the position is local until the model matrix has
// been applied. .xy because 2D lighting works in that plane.
CHECK(litVs.find("out.v_worldPos = world.xy;") != std::string::npos,
- "Lit2D canonical WGSL vertex forwards world position");
+ "Lit canonical WGSL vertex forwards world position");
const std::string litFs = wgsl(lit, ShaderStage::Fragment);
CHECK(litFs.find("@location(2) v_worldPos : vec2f,") != std::string::npos,
- "Lit2D VSOut carries the world-pos varying");
+ "Lit VSOut carries the world-pos varying");
CHECK(litFs.find("fn applyLighting2D") != std::string::npos &&
litFs.find("@group(0) @binding(2) var<uniform> lc : LightConstants;") != std::string::npos &&
- litFs.find("array<Light2D, 16>") != std::string::npos,
- "Lit2D WGSL injection: LightConstants at binding 2 + lighting helpers");
+ litFs.find("array<Light, 16>") != std::string::npos,
+ "Lit WGSL injection: LightConstants at binding 2 + lighting helpers");
ParsedShader pair = ShaderParser::parse(WGSL_TWIN_AUTHORED);
CHECK(pair.valid && !pair.wgslVertexIsCanonical, "authored twin pair skips canonical injection");
@@ -298,7 +298,7 @@ static void testWGSLEmission() {
// assembly skips every injected header — no tc/mc/canonical prelude — and
// returns the body as-is, features resolved.
ParsedShader full = ShaderParser::parse(
- "#pragma shader \"Full\"\n#pragma domain Unlit2D\n"
+ "#pragma shader \"Full\"\n#pragma domain Unlit\n"
"#pragma param u_a float default(0)\n"
"#pragma vertex\nvoid main() { gl_Position = vec4(0.0); }\n#pragma end\n"
"#pragma fragment\nvoid main() {}\n#pragma end\n"
@@ -321,7 +321,7 @@ static void testWGSLEmission() {
// A full twin on one stage composes with a normal twin on the other.
ParsedShader mixed = ShaderParser::parse(
- "#pragma shader \"Mixed\"\n#pragma domain Unlit2D\n"
+ "#pragma shader \"Mixed\"\n#pragma domain Unlit\n"
"#pragma fragment\nvoid main() {}\n#pragma end\n"
"#pragma fragment wgsl full\n"
"@fragment fn fs_main() -> @location(0) vec4<f32> { return vec4<f32>(1.0); }\n#pragma end\n");
@@ -335,7 +335,7 @@ static void testWGSLEmission() {
// std140 offsets == WGSL uniform layout for the param type set: the two
// backends read one buffer. float, vec3 (align 16), float (packs at 28).
ParsedShader layout = ShaderParser::parse(
- "#pragma shader \"L\"\n#pragma domain Unlit2D\n"
+ "#pragma shader \"L\"\n#pragma domain Unlit\n"
"#pragma param u_a float default(0)\n"
"#pragma param u_b vec3 default(0,0,0)\n"
"#pragma param u_c float default(0)\n"
@@ -351,19 +351,19 @@ static void testWGSLEmission() {
static void testFragmentOnly() {
ParsedShader unlit = ShaderParser::parse(FRAG_ONLY_UNLIT);
- CHECK(unlit.valid, "fragment-only Unlit2D shader parses");
+ CHECK(unlit.valid, "fragment-only Unlit shader parses");
const std::string uv = ShaderParser::assembleStage(unlit, ShaderStage::Vertex);
CHECK(uv.find("a_position") != std::string::npos, "canonical vertex stage injected");
CHECK(uv.find("FrameConstants") != std::string::npos, "canonical vertex reads the FrameConstants UBO");
- CHECK(uv.find("v_worldPos") == std::string::npos, "Unlit2D canonical vertex has no world-pos varying");
+ CHECK(uv.find("v_worldPos") == std::string::npos, "Unlit canonical vertex has no world-pos varying");
ParsedShader lit = ShaderParser::parse(FRAG_ONLY_LIT);
- CHECK(lit.valid, "fragment-only Lit2D shader parses");
+ CHECK(lit.valid, "fragment-only Lit shader parses");
const std::string lv = ShaderParser::assembleStage(lit, ShaderStage::Vertex);
CHECK(lv.find("v_worldPos = world.xy;") != std::string::npos,
- "Lit2D canonical vertex forwards world position");
+ "Lit canonical vertex forwards world position");
const std::string lf = ShaderParser::assembleStage(lit, ShaderStage::Fragment);
- CHECK(lf.find("applyLighting2D") != std::string::npos, "Lit2D fragment gets the lighting helper injected");
+ CHECK(lf.find("applyLighting2D") != std::string::npos, "Lit fragment gets the lighting helper injected");
ParsedShader pp = ShaderParser::parse(FRAG_ONLY_POSTPROCESS);
CHECK(pp.valid, "fragment-only PostProcess shader parses");
@@ -375,6 +375,23 @@ static void testFragmentOnly() {
ParsedShader unknownDomain = ShaderParser::parse(FRAG_ONLY_UNKNOWN_DOMAIN);
CHECK(!unknownDomain.valid, "a domain with no canonical vertex still errors");
+ // A .esshader carries no format version, so a shader written before the lit
+ // domains were renamed is answered at the parser or nowhere. It must arrive
+ // as the domain it means, canonical vertex and all — not merely parse.
+ ParsedShader legacyLit = ShaderParser::parse(
+ "#pragma shader \"Old\"\n#pragma version 300 es\n#pragma domain Lit2D\n"
+ "#pragma fragment\nvoid main() { fragColor = vec4(1.0); }\n#pragma end\n");
+ CHECK(legacyLit.valid && legacyLit.domain == "Lit",
+ "a shader authored as Lit2D arrives in the Lit domain");
+ CHECK(ShaderParser::assembleStage(legacyLit, ShaderStage::Fragment)
+ .find("applyLighting2D") != std::string::npos,
+ "and gets that domain's injection, not just its name");
+ ParsedShader legacyUnlit = ShaderParser::parse(
+ "#pragma shader \"OldU\"\n#pragma version 300 es\n#pragma domain Unlit2D\n"
+ "#pragma fragment\nvoid main() { fragColor = vec4(1.0); }\n#pragma end\n");
+ CHECK(legacyUnlit.valid && legacyUnlit.domain == "Unlit",
+ "a shader authored as Unlit2D arrives in the Unlit domain");
+
ParsedShader authored = ShaderParser::parse(SRC);
const std::string av = ShaderParser::assembleStage(authored, ShaderStage::Vertex);
CHECK(av.find("a_pos") != std::string::npos, "an authored vertex stage is untouched");
@@ -386,7 +403,7 @@ static void testFragmentOnly() {
CHECK(af.find("vec4 u_viewport") != std::string::npos, "u_viewport rides the injected block");
ParsedShader reserved = ShaderParser::parse(
- "#pragma shader \"R\"\n#pragma version 300 es\n#pragma domain Unlit2D\n"
+ "#pragma shader \"R\"\n#pragma version 300 es\n#pragma domain Unlit\n"
"#pragma param u_time float default(0)\n"
"#pragma fragment\nvoid main() {}\n#pragma end\n");
CHECK(!reserved.valid && reserved.errorMessage.find("reserved") != std::string::npos,
diff --git a/tests/renderer/webgpu_engine_bringup.cpp b/tests/renderer/webgpu_engine_bringup.cpp
index 0ac58e625..7a433f923 100644
--- a/tests/renderer/webgpu_engine_bringup.cpp
+++ b/tests/renderer/webgpu_engine_bringup.cpp
@@ -78,10 +78,10 @@ void renderFrame() {
}
// Dual-emission compile probe (REARCH_WGSL Phase 3): ONE ParsedShader —
-// Lit2D domain + block params + a texture param + a feature — assembled and
+// Lit domain + block params + a texture param + a feature — assembled and
// compiled in each backend's language. It exercises every WGSL injection the
// emitter owns (canonical vertex, VSOut, batch texture contract, Time/
-// Material constants, material texture bindings, the Lit2D header, and the
+// Material constants, material texture bindings, the Lit header, and the
// assembly-time feature preprocessor) plus the language constructs the SDK's
// template/filter twins rely on (sampleNormal, textureDimensions, nested
// loops with continue, select) against the REAL compiler: a WGSL error
@@ -89,7 +89,7 @@ void renderFrame() {
// error fails shader creation here.
const char* kEmitterProbe = R"(#pragma shader "EmitterProbe"
#pragma version 300 es
-#pragma domain Lit2D
+#pragma domain Lit
#pragma feature GLOW
#pragma param u_progress float default(0.5)
#pragma param u_tint color default(1,1,1,1)
diff --git a/tools/check-shader-blocks.mjs b/tools/check-shader-blocks.mjs
index aec102074..5e6c6b6b2 100644
--- a/tools/check-shader-blocks.mjs
+++ b/tools/check-shader-blocks.mjs
@@ -39,7 +39,7 @@ const parser = readFileSync(path.join(ROOT, PARSER), 'utf8');
* shader rather than a face both backends present, and pulling those in would
* ask a vertex entry point to have a GLSL twin.
*/
-const HEADERS = ['kColorHelpers', 'kFrameHeader', 'kTimeHeader', 'kLit2DHeader'];
+const HEADERS = ['kColorHelpers', 'kFrameHeader', 'kTimeHeader', 'kLitHeader'];
/**
* One header's text as the shader receives it: raw strings taken whole,
@@ -101,7 +101,7 @@ const SIGNATURE_GAPS = {
/** A field name as the comparison sees it: the `u_` a shader adds is not part of it. */
const bare = (name) => name.replace(/^u_/, '');
-/** GLSL: `layout(std140) uniform Name { highp vec4 u_a; Light2D u_b[16]; };` */
+/** GLSL: `layout(std140) uniform Name { highp vec4 u_a; Light u_b[16]; };` */
function glslBlock(name) {
const m = new RegExp(`layout\\(std140\\)\\s+uniform\\s+${name}\\s*\\{([^}]*)\\}`, 'm').exec(text);
if (!m) return null;
@@ -123,7 +123,7 @@ function wgslBlock(name) {
}).filter(Boolean);
}
-/** C++: `struct Name { glm::vec4 a{...}; GpuLight2D b[16]; };` — comments and all. */
+/** C++: `struct Name { glm::vec4 a{...}; GpuLight b[16]; };` — comments and all. */
function cppBlock(name, file) {
const source = readFileSync(path.join(ROOT, file), 'utf8');
const m = new RegExp(`struct\\s+${name}\\s*\\{([\\s\\S]*?)\\n\\};`, 'm').exec(source);
@@ -133,7 +133,7 @@ function cppBlock(name, file) {
.map((f) => `${bare(f[1])}${f[2] ? `[${f[2]}]` : ''}`);
}
-/** `MAX_LIGHTS_2D` and friends, so a C++ array length compares as a number. */
+/** `MAX_LIGHTS` and friends, so a C++ array length compares as a number. */
function constants() {
const out = new Map();
for (const file of new Set(Object.values(BLOCKS))) {