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.

test(render): a frame's cost has a ceiling at scale, not just an exact value when small

yhhb7863128c5d0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2b5238d08..908651eff 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -50,6 +50,49 @@ published separately; it ships inside the editor.
### Added
+- **Nothing anywhere put a ceiling on what a frame COSTS.** The counters landed
+ earlier this release, but every one of them is an EXACT value on a scene small
+ enough to enumerate — nine cubes, nineteen sprites. The scale harness
+ (`desktop/tests/scale/`) is headless by construction, so the whole
+ draw-submission half was unmeasured at any size, 2D and 3D alike, and a batcher
+ that stopped merging above some threshold, or a shadow atlas that started
+ drawing per caster, would have reached a shipped game before it reached a check.
+
+ Three gates now ask what a frame costs when the scene is big:
+ `sprite-scale-cost` (9801 sprites → `batch.draws` ≤ 8, measured 1),
+ `mesh-scale-cost` (4225 cubes → ≤ 8, measured 1, with `render.triangles` at
+ 50700 exactly) and `shadow-scale-cost` (3249 shadow casters →
+ `render.shadow.draws` ≤ 8, measured 2). Sabotage-verified together by inverting
+ both merge conditions in `DrawCommand::mergeBlocker`: the three counters go to
+ 9801, 4225 and 3250 while **every pixel probe in all three frames stays exactly
+ right** — which is the whole reason a cost gate has to exist next to a pixel one.
+
+ `ESTELLA_VERIFY_COUNTERS_MAX` is the ceiling form of `ESTELLA_VERIFY_COUNTERS`,
+ and it is a different claim rather than a looser one. An exact value pins a
+ scene whose every draw can be counted, and either direction is a regression. At
+ ten thousand sprites nobody can count them, and the useful question is not how
+ many draws but whether submission stayed bounded — which a ceiling answers and
+ an exact value turns into a number that every benign scene edit rewrites. Both
+ forms fail on a counter the frame never set: a budget nothing reports is not an
+ under-budget frame.
+
+ The scenes are a fixture plus a COUNT (`ESTELLA_VERIFY_SCALE`), not a file. Ten
+ thousand entities of JSON would be a megabyte in every clone of this repository,
+ storing what is a pure function of one small scene and an integer — so each
+ fixture holds ONE of the thing being measured and the host lays `copies` of it
+ on a centred grid. Entities named or componented as furniture (`Camera`,
+ `Light`, a ground plane) are placed once; everything else is the content.
+
+ Two things the geometry had to be measured into rather than reasoned into.
+ `sprite-scale-cost` is 99x99 and not 100x100 because a sprite is two pixels
+ wide at this scale, and an even grid puts the centre of the frame BETWEEN four
+ of them — the middle pixel then reads half coverage, which is a rasteriser's
+ answer and not the engine's. And `shadow-scale-cost` probes only the two edges
+ of its grid: the sun's throw is 100 units and the lattice is 10, so everywhere
+ in between each shadow lands exactly behind the caster ten cells along and the
+ frame is uniformly lit. Bare ground survives only past the left edge, where no
+ caster stands 100 units further left, and past the right, where one does.
+
- **The batcher is held to what it achieves.** `DrawList` has been publishing
`batch.draws`, `batch.merged` and a counter per break REASON for a while, and
nothing read any of them — so the oldest performance promise in the engine, that
diff --git a/fixtures/scenes/scale-meshes.esscene b/fixtures/scenes/scale-meshes.esscene
new file mode 100644
index 000000000..06c7cf1c9
--- /dev/null
+++ b/fixtures/scenes/scale-meshes.esscene
@@ -0,0 +1,44 @@
+{
+ "version": 3,
+ "name": "ScaleMeshes",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 0, "y": 0, "z": 300 } } },
+ { "type": "Camera", "data": { "projectionType": 1, "orthoSize": 300, "isActive": true, "priority": 0 } }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Cube",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": { "x": 0, "y": 0, "z": 0 },
+ "scale": { "x": 0.08, "y": 0.08, "z": 0.08 }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": { "r": 0.2, "g": 0.8, "b": 0.4, "a": 1 },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/scale-shadow.esscene b/fixtures/scenes/scale-shadow.esscene
new file mode 100644
index 000000000..54381e8cd
--- /dev/null
+++ b/fixtures/scenes/scale-shadow.esscene
@@ -0,0 +1,150 @@
+{
+ "version": 3,
+ "name": "ScaleShadow",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 10
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 300,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ground",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": -200
+ },
+ "scale": {
+ "x": 600,
+ "y": 600,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "/scenes/shadow-quad.esmesh",
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Blocker",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "scale": {
+ "x": 0.06,
+ "y": 0.06,
+ "z": 0.06
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Sun",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 1,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 1,
+ "direction": {
+ "x": 0.5,
+ "y": 0
+ },
+ "meshShadows": true
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/scale-sprites.esscene b/fixtures/scenes/scale-sprites.esscene
new file mode 100644
index 000000000..355bf2f90
--- /dev/null
+++ b/fixtures/scenes/scale-sprites.esscene
@@ -0,0 +1,28 @@
+{
+ "version": 3,
+ "name": "ScaleSprites",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 0, "y": 0, "z": 10 } } },
+ { "type": "Camera", "data": { "projectionType": 1, "orthoSize": 300, "isActive": true, "priority": 0 } }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Sprite",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ { "type": "Transform", "data": { "position": { "x": 0, "y": 0, "z": 0 } } },
+ { "type": "Sprite", "data": { "size": { "x": 5, "y": 5 }, "color": { "r": 0.9, "g": 0.4, "b": 0.1, "a": 1 } } }
+ ]
+ }
+ ]
+}
diff --git a/tools/check-render-scenes.mjs b/tools/check-render-scenes.mjs
index 1679bd827..62155a13a 100644
--- a/tools/check-render-scenes.mjs
+++ b/tools/check-render-scenes.mjs
@@ -41,10 +41,13 @@ for (const s of SCENES) {
// An expectation is the whole point: a scene with none passes as long as it
// renders anything at all. Allowed, as a sentence — the same bargain the
// golden corpus strikes with parityGap. A COUNTER is an expectation too, and
- // the sharper kind: what a frame cost is the half no pixel can show.
+ // the sharper kind: what a frame cost is the half no pixel can show — as an
+ // exact value where a scene is small enough to enumerate, and as a CEILING
+ // where it is not.
const asserts = s.env.ESTELLA_VERIFY_EXPECT || s.env.ESTELLA_VERIFY_GRID || s.env.ESTELLA_VERIFY_PREVIEW
|| s.env.ESTELLA_VERIFY_MESH_PREVIEW || s.env.ESTELLA_VERIFY_DEPTH_LAYERS
- || s.env.ESTELLA_VERIFY_COUNTERS || s.env.ESTELLA_VERIFY_DRAW_CALLS
+ || s.env.ESTELLA_VERIFY_COUNTERS || s.env.ESTELLA_VERIFY_COUNTERS_MAX
+ || s.env.ESTELLA_VERIFY_DRAW_CALLS
|| s.env.ESTELLA_VERIFY_YSORT || s.id === 'sprite-default';
if (!asserts && !s.rendersOnly) {
fail(`"${s.id}" asserts nothing — give it an ESTELLA_VERIFY_EXPECT, or say in rendersOnly why it has none`);
diff --git a/tools/render-host/host.ts b/tools/render-host/host.ts
index 413f36008..bb080a320 100644
--- a/tools/render-host/host.ts
+++ b/tools/render-host/host.ts
@@ -24,7 +24,7 @@ import {
RenderTexture, Camera, Sprite,
EditorView, EditorGrid, installEditorGrid, editorViewHalfHeight, setEditorViewHalfHeight,
} from 'esengine';
-import type { App, SceneData, PrefabData, RenderSurfaceSource } from 'esengine';
+import type { App, SceneData, SceneEntityData, PrefabData, RenderSurfaceSource } from 'esengine';
import type { ESEngineModule } from 'esengine/wasm';
import { loadSpineSceneEntities, SpinePlugin } from 'esengine/spine';
import type { RuntimeAssetSource } from 'esengine/spine';
@@ -144,12 +144,103 @@ async function boot(): Promise<void> {
installEditorGrid(app);
}
+/**
+ * @brief What a scale gate copies, so a frame's SIZE is a parameter and not a file.
+ *
+ * @details `copies` of the scene's content on a centred `cols`-wide grid, `spacing`
+ * apart in world units. Ten thousand entities as a file would be a megabyte
+ * of JSON in every clone, for a pure function of one fixture and a count.
+ */
+interface ReplicateSpec {
+ copies: number;
+ cols: number;
+ spacing: [number, number];
+ /** Component types or entity names that are the frame's FURNITURE, not its content. */
+ keep?: string[];
+}
+
+/** What looks at the content or receives it. Ten thousand cameras, lights or
+ * ground planes measures a frame no game draws. */
+const FURNITURE = ['Camera', 'Light'];
+
+/** Adds a world offset to an entity's authored Transform position. */
+function offsetPosition(entity: SceneEntityData, dx: number, dy: number): void {
+ const transform = (entity.components ?? []).find((c) => c.type === 'Transform');
+ if (!transform) return;
+ const pos = (transform.data.position ?? {}) as { x?: number; y?: number; z?: number };
+ transform.data.position = { x: (pos.x ?? 0) + dx, y: (pos.y ?? 0) + dy, z: pos.z ?? 0 };
+}
+
+/**
+ * @brief Lays `spec.copies` copies of the scene's content out on a grid.
+ *
+ * @details EVERY copy is placed, the first included: leaving the authored entity where
+ * it was puts one copy off the lattice. Ids offset by a whole id-span per copy,
+ * so parent/children remap by arithmetic and copy 0 offsets by zero — which is
+ * what keeps the scene file's own ids addressable by a driver.
+ */
+function replicateScene(scene: SceneData, spec: ReplicateSpec): SceneData {
+ const copies = Math.max(1, Math.floor(spec.copies));
+ const cols = Math.max(1, Math.floor(spec.cols));
+ const [spacingX, spacingY] = spec.spacing;
+ const keep = new Set(spec.keep ?? FURNITURE);
+
+ const byId = new Map<number, SceneEntityData>();
+ for (const e of scene.entities) byId.set(e.id, e);
+
+ const fixed: SceneEntityData[] = [];
+ const template: SceneEntityData[] = [];
+ const collect = (e: SceneEntityData): void => {
+ template.push(e);
+ for (const child of e.children ?? []) {
+ const node = byId.get(child);
+ if (node) collect(node);
+ }
+ };
+ for (const e of scene.entities) {
+ if (e.parent !== null && e.parent !== undefined) continue;
+ if (keep.has(e.name) || (e.components ?? []).some((c) => keep.has(c.type))) fixed.push(e);
+ else collect(e);
+ }
+ if (!template.length) {
+ throw new Error('replicate: every root is furniture — the scene has no content to copy');
+ }
+
+ let maxId = 0;
+ for (const e of scene.entities) maxId = Math.max(maxId, e.id);
+ const span = maxId + 1;
+ const rows = Math.ceil(copies / cols);
+
+ const entities: SceneEntityData[] = fixed.slice();
+ for (let k = 0; k < copies; k++) {
+ const dx = ((k % cols) - (cols - 1) / 2) * spacingX;
+ const dy = (Math.floor(k / cols) - (rows - 1) / 2) * spacingY;
+ const offset = k * span;
+ for (const source of template) {
+ const clone = JSON.parse(JSON.stringify(source)) as SceneEntityData;
+ clone.id = source.id + offset;
+ clone.parent = source.parent === null || source.parent === undefined
+ ? null : source.parent + offset;
+ clone.children = (source.children ?? []).map((c) => c + offset);
+ if (clone.parent === null) offsetPosition(clone, dx, dy);
+ entities.push(clone);
+ }
+ }
+ return { ...scene, entities };
+}
+
/**
* Fetch an `.esscene` and load it through the engine's own asset system — one
* asset-resolution path, the same `Assets` the shipped runtime uses. The
* manifest is a uuid→url map beside the scene; without one, refs blank to 0.
+ *
+ * `replicate` scales the fetched scene up before it reaches the World — what a
+ * cost gate asserts against. Assets resolve on the ORIGINAL document, so ten
+ * thousand copies of one sprite preload one texture.
*/
-async function loadScene(sceneUrl: string, manifestUrl?: string): Promise<number> {
+async function loadScene(
+ sceneUrl: string, manifestUrl?: string, replicate?: ReplicateSpec | null,
+): Promise<number> {
if (!app) throw new Error('loadScene before boot');
const res = await fetch(sceneUrl);
if (!res.ok) throw new Error(`scene fetch failed: ${res.status} ${sceneUrl}`);
@@ -168,6 +259,10 @@ async function loadScene(sceneUrl: string, manifestUrl?: string): Promise<number
assets.resolveSceneAssetPaths(resolved, result);
}
+ // Skeletal binding below walks the ORIGINAL document, so only copy 0 of a
+ // skeleton binds. Cost fixtures have none.
+ if (replicate) resolved = replicateScene(resolved, replicate);
+
const map = loadSceneData(app.world, resolved as Parameters<typeof loadSceneData>[1]);
sceneRaw = raw;
sourceToEntity = map as unknown as Map<number, number>;
diff --git a/tools/render-host/run.mjs b/tools/render-host/run.mjs
index 97de06282..2d06e5c37 100644
--- a/tools/render-host/run.mjs
+++ b/tools/render-host/run.mjs
@@ -25,6 +25,8 @@
* ESTELLA_VERIFY_PICK hit-test a viewport point, asserting the entity (JSON)
* ESTELLA_VERIFY_ORBIT turn the editor eye before capture ("yaw,pitch" degrees)
* ESTELLA_VERIFY_COUNTERS engine counters the drawn frame must report (JSON)
+ * ESTELLA_VERIFY_COUNTERS_MAX counters the frame must stay UNDER — a budget (JSON)
+ * ESTELLA_VERIFY_SCALE copy the scene's content onto a grid (JSON), for a cost gate
* ESTELLA_VERIFY_OUTPUT_TRANSFORM the frame's output curve ("aces")
* ESTELLA_VERIFY_TIMEOUT_MS how long this run may take before it reports one
*/
@@ -78,6 +80,8 @@ const OUTPUT_TRANSFORM = process.env.ESTELLA_VERIFY_OUTPUT_TRANSFORM === 'aces'
// A scene whose emitters roll dice has no constant to assert until the run is
// seeded; the engine seeds itself from the clock when nobody says otherwise.
const SEED = process.env.ESTELLA_VERIFY_SEED ?? '';
+// A cost gate's scene is a small fixture plus a count — see the loadScene call.
+const SCALE = process.env.ESTELLA_VERIFY_SCALE ?? '';
// ESTELLA_VERIFY_DEPTH_LAYERS=<mask> turns layers into depth-resolved ones (2.5D).
const DEPTH_LAYERS = process.env.ESTELLA_VERIFY_DEPTH_LAYERS ?? '';
@@ -199,8 +203,12 @@ app.whenReady().then(async () => {
let setField = null;
let pick = null;
await exec('window.__estellaHeadless.ready');
+ // ESTELLA_VERIFY_SCALE = {"copies":N,"cols":C,"spacing":[x,y]}: the fixture holds ONE
+ // of the thing being measured and this lays N of it out on a grid — a scale scene as a
+ // FILE would be a megabyte of JSON in every clone, for a pure function of those two.
const entityCount = await exec(
- `window.__estellaHeadless.api.loadScene(${JSON.stringify(SCENE)}, ${JSON.stringify(MANIFEST)})`,
+ `window.__estellaHeadless.api.loadScene(${JSON.stringify(SCENE)}, ${JSON.stringify(MANIFEST)}`
+ + `${SCALE ? ', ' + JSON.stringify(JSON.parse(SCALE)) : ''})`,
);
// Opt-in play mode (ESTELLA_VERIFY_PLAY=1): runs the SDK plugin updates — particle
// emission/simulation, animation — so time-driven content actually renders.
@@ -209,7 +217,7 @@ app.whenReady().then(async () => {
}
// The engine's per-frame counters are only recorded while profiling is on, and
// it goes on BEFORE the steps: what is read afterwards is the last frame's.
- if (process.env.ESTELLA_VERIFY_COUNTERS) {
+ if (process.env.ESTELLA_VERIFY_COUNTERS || process.env.ESTELLA_VERIFY_COUNTERS_MAX) {
await exec('window.__estellaHeadless.api.setCpuProfiling(true)');
}
// Project render config stand-in: ESTELLA_VERIFY_YSORT = layer bitmask
@@ -516,13 +524,23 @@ app.whenReady().then(async () => {
// What the frame cost where no draw call and no pixel can show it — the passes a
// shadow atlas took. ESTELLA_VERIFY_COUNTERS is a JSON object of counter name → exact
// value; a name the frame never set reports null, which fails rather than reading 0.
+ // ESTELLA_VERIFY_COUNTERS_MAX is the same object read as a CEILING, a different claim:
+ // exact pins a scene small enough to enumerate, a ceiling asks whether cost stayed
+ // bounded where nobody can. Both fail on a counter the frame never set.
let counters = null;
- if (process.env.ESTELLA_VERIFY_COUNTERS) {
- const want = JSON.parse(process.env.ESTELLA_VERIFY_COUNTERS);
+ if (process.env.ESTELLA_VERIFY_COUNTERS || process.env.ESTELLA_VERIFY_COUNTERS_MAX) {
+ const want = JSON.parse(process.env.ESTELLA_VERIFY_COUNTERS ?? '{}');
+ const ceiling = JSON.parse(process.env.ESTELLA_VERIFY_COUNTERS_MAX ?? '{}');
const got = await exec('window.__estellaHeadless.api.getCounters()');
- const points = Object.entries(want).map(([name, value]) => ({
- name, want: value, got: got?.[name] ?? null, ok: got?.[name] === value,
- }));
+ const points = [
+ ...Object.entries(want).map(([name, value]) => ({
+ name, want: value, got: got?.[name] ?? null, ok: got?.[name] === value,
+ })),
+ ...Object.entries(ceiling).map(([name, value]) => ({
+ name, max: value, got: got?.[name] ?? null,
+ ok: typeof got?.[name] === 'number' && got[name] <= value,
+ })),
+ ];
counters = { points, ok: points.every((p) => p.ok) };
}
// Optional color/orientation assertion: ESTELLA_VERIFY_EXPECT is a JSON array of
diff --git a/tools/renderScenes.mjs b/tools/renderScenes.mjs
index b657f16db..4e862e36d 100644
--- a/tools/renderScenes.mjs
+++ b/tools/renderScenes.mjs
@@ -169,6 +169,18 @@ export const SCENES = [
// same mesh and same material, so render.culled is the only place the six can show.
// batch.draws holds the nine to ONE instanced call; render.triangles counts 9 x 12.
{ id: "mesh-cost", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/mesh-cost.esscene", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_COUNTERS: "{\"render.meshes\":9,\"render.culled\":6,\"render.triangles\":108,\"batch.draws\":1}", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.1667,\"y\":0.1667,\"rgb\":[255,0,0],\"tol\":20},{\"x\":0.5,\"y\":0.5,\"rgb\":[255,0,255],\"tol\":20},{\"x\":0.8333,\"y\":0.8333,\"rgb\":[0,255,0],\"tol\":20},{\"x\":0.3,\"y\":0.5,\"rgb\":[0,0,0],\"tol\":10}]" } },
+ // A CEILING, not an exact value: at scale the question is whether submission stays O(1)
+ // in the count, and render.sprites stays exact so a frame that dropped content cannot pass
+ // under it. The grid is odd (99x99) so the centre probe lands ON a 2-pixel sprite.
+ { id: "sprite-scale-cost", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/scale-sprites.esscene", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_SCALE: "{\"copies\":9801,\"cols\":99,\"spacing\":[6,6]}", ESTELLA_VERIFY_COUNTERS: "{\"render.sprites\":9801}", ESTELLA_VERIFY_COUNTERS_MAX: "{\"batch.draws\":8}", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.5,\"y\":0.5,\"rgb\":[230,102,26],\"tol\":20}]" } },
+ // The 3D shape of the same claim: identical geometry merges by INSTANCING, so 4225 cubes
+ // are one draw. A fallback to a draw per mesh leaves the picture identical and moves only
+ // batch.draws, which is why the ceiling is the assertion and render.triangles the witness.
+ { id: "mesh-scale-cost", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/scale-meshes.esscene", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_SCALE: "{\"copies\":4225,\"cols\":65,\"spacing\":[9,9]}", ESTELLA_VERIFY_COUNTERS: "{\"render.meshes\":4225,\"render.triangles\":50700}", ESTELLA_VERIFY_COUNTERS_MAX: "{\"batch.draws\":8}", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.5,\"y\":0.5,\"rgb\":[51,204,102],\"tol\":20}]" } },
+ // Does an atlas draw scale with the CASTER count: 3249 casters are two draws (a ground quad,
+ // then every cube instanced), and a fallback to one draw each changes no pixel. The probes take
+ // the only ground the grid leaves bare — lit past its left edge, shadowed past its right.
+ { id: "shadow-scale-cost", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/scale-shadow.esscene", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_SCALE: "{\"copies\":3249,\"cols\":57,\"spacing\":[10,10],\"keep\":[\"Camera\",\"Light\",\"Ground\"]}", ESTELLA_VERIFY_COUNTERS_MAX: "{\"render.shadow.draws\":8}", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.012,\"y\":0.5,\"rgb\":[228,228,228],\"tol\":20},{\"x\":0.984,\"y\":0.5,\"rgb\":[0,0,0],\"tol\":20}]" } },
// Two opaque cubes overlapping on screen, the red one 120 units nearer. Declares NO
// depth layer and boots LINEAR — the cheap way to engage the post-process capture.
// Opaque sorts front-to-back, so with no attachment the far cube paints over.