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.

fix(gates): two pixel claims that were about the runner, not the frame

esengine21bc0872573a
diff --git a/tools/check-render-scenes.mjs b/tools/check-render-scenes.mjs
index a631dda41..3b2d03e8a 100644
--- a/tools/check-render-scenes.mjs
+++ b/tools/check-render-scenes.mjs
@@ -46,7 +46,10 @@ for (const s of SCENES) {
// where it is not.
// A SEAM is an expectation too, and the kind a point probe cannot state: a
// column that behaves unlike its neighbours on a grid is not a pixel colour.
- const asserts = s.env.ESTELLA_VERIFY_EXPECT || s.env.ESTELLA_VERIFY_SEAM
+ // A COUNT is an expectation too, and the one a point probe cannot make: how
+ // much of a colour the frame holds does not depend on where a font put it.
+ const asserts = s.env.ESTELLA_VERIFY_EXPECT || s.env.ESTELLA_VERIFY_COUNT
+ || s.env.ESTELLA_VERIFY_SEAM
|| 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_COUNTERS_MAX
diff --git a/tools/render-host/run.mjs b/tools/render-host/run.mjs
index b4a110597..b69253e78 100644
--- a/tools/render-host/run.mjs
+++ b/tools/render-host/run.mjs
@@ -200,7 +200,8 @@ function finish(result, server) {
// which no pixel in the frame can show.
const pickOk = !result.pick || result.pick.hit === result.pick.want;
const renderedOk = result.capture?.rendered ?? false;
- const ok = result.ok && renderedOk && (result.expect?.ok ?? true) && (result.seam?.ok ?? true) &&
+ const ok = result.ok && renderedOk && (result.expect?.ok ?? true) && (result.count?.ok ?? true) &&
+ (result.seam?.ok ?? true) &&
(result.resize?.ok ?? true) && (result.preview?.ok ?? true) &&
(result.meshPreview?.ok ?? true) && (result.grid?.ok ?? true) &&
(result.draws?.ok ?? true) && (result.counters?.ok ?? true) &&
@@ -661,6 +662,28 @@ app.whenReady().then(async () => {
return { points: out, ok: out.every((o) => o.ok) };
`);
}
+ // ESTELLA_VERIFY_COUNT is a JSON array of { rgb:[r,g,b], tol?, atLeast?, atMost? }:
+ // HOW MANY pixels of the frame are that colour, rather than which ones — a
+ // point probe cannot ask that without also naming where a font put them.
+ let count = null;
+ if (process.env.ESTELLA_VERIFY_COUNT) {
+ count = await readFrame(`
+ const specs = ${JSON.stringify(JSON.parse(process.env.ESTELLA_VERIFY_COUNT))};
+ const rows = specs.map((s) => {
+ const tol = s.tol ?? 24;
+ let n = 0;
+ for (let i = 0; i < px.length; i += 4) {
+ if (Math.abs(px[i] - s.rgb[0]) <= tol
+ && Math.abs(px[i + 1] - s.rgb[1]) <= tol
+ && Math.abs(px[i + 2] - s.rgb[2]) <= tol) n++;
+ }
+ const ok = (s.atLeast === undefined || n >= s.atLeast)
+ && (s.atMost === undefined || n <= s.atMost);
+ return { rgb: s.rgb, tol, count: n, atLeast: s.atLeast ?? null, atMost: s.atMost ?? null, ok };
+ });
+ return { rows, ok: rows.every((r) => r.ok) };
+ `);
+ }
// ESTELLA_VERIFY_SEAM is JSON { period, phase, band:{y0,y1}, limit?, atLeast? }
// in TOP-DOWN screen pixels. The pixels come back to node so seamProbe stays
// one implementation rather than being re-typed into an injected script.
@@ -820,7 +843,7 @@ app.whenReady().then(async () => {
};
`);
}
- finish({ ok: true, entityCount, drawCalls, draws, counters, profile, capture, expect, seam, resize, preview, meshPreview, grid, deviceLoss, meshResident, meshAsset, meshMaterial, meshPrefab, setField, animator, pick, cameraTarget }, server);
+ finish({ ok: true, entityCount, drawCalls, draws, counters, profile, capture, expect, count, seam, resize, preview, meshPreview, grid, deviceLoss, meshResident, meshAsset, meshMaterial, meshPrefab, setField, animator, pick, cameraTarget }, server);
} catch (e) {
finish({ ok: false, error: String((e && e.stack) || e) }, server);
}
diff --git a/tools/renderScenes.mjs b/tools/renderScenes.mjs
index f15126202..3e96e6487 100644
--- a/tools/renderScenes.mjs
+++ b/tools/renderScenes.mjs
@@ -270,7 +270,10 @@ export const SCENES = [
// HUD TEXT, which the SDK submits itself — the one screen primitive that could
// be left in a camera's list while the panel under it moved. Under this
// perspective camera such text lands nowhere and the panel comes back blue.
- { id: "ui-screen-text", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_PLAY: "1", ESTELLA_VERIFY_SCENE: "/scenes/ui-screen-text.esscene", ESTELLA_VERIFY_MANIFEST: "/scenes/ui-screen-text.textures.json", ESTELLA_VERIFY_W: "640", ESTELLA_VERIFY_H: "360", ESTELLA_VERIFY_STEPS: "6", ESTELLA_VERIFY_EXPECT: "[{\"x\": 0.4, \"y\": 0.5, \"rgb\": [255, 255, 0], \"tol\": 40}, {\"x\": 0.525, \"y\": 0.5, \"rgb\": [255, 255, 0], \"tol\": 40}, {\"x\": 0.5, \"y\": 0.5, \"rgb\": [0, 0, 153], \"tol\": 40}, {\"x\": 0.05, \"y\": 0.5, \"rgb\": [0, 0, 153], \"tol\": 40}]" } },
+ // Asked as HOW MUCH yellow, not where: which stroke covers x=0.4 is a fact
+ // about the runner's fonts, and probes at named strokes read the panel on
+ // Linux while the text was drawn. 13282 pixels here; the floor of 2000 stands.
+ { id: "ui-screen-text", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_PLAY: "1", ESTELLA_VERIFY_SCENE: "/scenes/ui-screen-text.esscene", ESTELLA_VERIFY_MANIFEST: "/scenes/ui-screen-text.textures.json", ESTELLA_VERIFY_W: "640", ESTELLA_VERIFY_H: "360", ESTELLA_VERIFY_STEPS: "6", ESTELLA_VERIFY_EXPECT: "[{\"x\": 0.05, \"y\": 0.5, \"rgb\": [0, 0, 153], \"tol\": 40}]", ESTELLA_VERIFY_COUNT: "[{\"rgb\": [255, 255, 0], \"tol\": 40, \"atLeast\": 2000}]" } },
// A Canvas and NO Camera. The screen is a surface and a design fit, so neither
// the layout NOR the presentation needs a view to exist — this is the scene
// that keeps that a promise rather than an accident of the mask union.
@@ -510,13 +513,16 @@ export const SCENES = [
// SSAO: one unlit grey floor read at seven places. Contact, corner and
// step come back darker than the open floor they are made of, the floating
// box does not, and the wall behind a silhouette keeps its colour.
+ // Every tolerance is set against how far its point MOVES with the effect off:
+ // the corner travels 49 and the step 47, so 22 and 20 still read the absence,
+ // while the shallow face at 0.627 travels 19 and keeps a tight 9.
// A quad turned 20 degrees on black, read twice: the SAME values with and
// without a post chain is the claim. WebGPU has no MSAA yet, so both its
// halves read the hard step — still the claim, that the chain changes nothing.
{ id: "aa-edge", tier: "pr", webgpu: { ESTELLA_VERIFY_EXPECT: "[{\"x\":0.2353,\"y\":0.502,\"rgb\":[0,0,0],\"tol\":6},{\"x\":0.2392,\"y\":0.502,\"rgb\":[255,255,255],\"tol\":6},{\"x\":0.749,\"y\":0.502,\"rgb\":[255,255,255],\"tol\":6},{\"x\":0.7529,\"y\":0.502,\"rgb\":[0,0,0],\"tol\":6},{\"x\":0.502,\"y\":0.502,\"rgb\":[255,255,255],\"tol\":6},{\"x\":0.0784,\"y\":0.0784,\"rgb\":[0,0,0],\"tol\":6}]" }, env: { ESTELLA_VERIFY_SCENE: "/scenes/aa-edge.esscene", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.2353,\"y\":0.502,\"rgb\":[128,128,128],\"tol\":64},{\"x\":0.2392,\"y\":0.502,\"rgb\":[128,128,128],\"tol\":64},{\"x\":0.749,\"y\":0.502,\"rgb\":[128,128,128],\"tol\":64},{\"x\":0.7529,\"y\":0.502,\"rgb\":[128,128,128],\"tol\":64},{\"x\":0.502,\"y\":0.502,\"rgb\":[255,255,255],\"tol\":6},{\"x\":0.0784,\"y\":0.0784,\"rgb\":[0,0,0],\"tol\":6}]" } },
// The other half: the same edges, read through an identity post chain.
{ id: "aa-edge-post", tier: "pr", webgpu: { ESTELLA_VERIFY_EXPECT: "[{\"x\":0.2353,\"y\":0.502,\"rgb\":[0,0,0],\"tol\":6},{\"x\":0.2392,\"y\":0.502,\"rgb\":[255,255,255],\"tol\":6},{\"x\":0.749,\"y\":0.502,\"rgb\":[255,255,255],\"tol\":6},{\"x\":0.7529,\"y\":0.502,\"rgb\":[0,0,0],\"tol\":6},{\"x\":0.502,\"y\":0.502,\"rgb\":[255,255,255],\"tol\":6},{\"x\":0.0784,\"y\":0.0784,\"rgb\":[0,0,0],\"tol\":6}]" }, env: { ESTELLA_VERIFY_SCENE: "/scenes/aa-edge-post.esscene", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.2353,\"y\":0.502,\"rgb\":[128,128,128],\"tol\":64},{\"x\":0.2392,\"y\":0.502,\"rgb\":[128,128,128],\"tol\":64},{\"x\":0.749,\"y\":0.502,\"rgb\":[128,128,128],\"tol\":64},{\"x\":0.7529,\"y\":0.502,\"rgb\":[128,128,128],\"tol\":64},{\"x\":0.502,\"y\":0.502,\"rgb\":[255,255,255],\"tol\":6},{\"x\":0.0784,\"y\":0.0784,\"rgb\":[0,0,0],\"tol\":6}]" } },
- { id: "ssao", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/ssao.esscene", ESTELLA_VERIFY_W: "320", ESTELLA_VERIFY_H: "240", ESTELLA_VERIFY_STEPS: "4", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.5016,\"y\":0.8996,\"rgb\":[191,191,191],\"tol\":6},{\"x\":0.3762,\"y\":0.4937,\"rgb\":[144,144,144],\"tol\":9},{\"x\":0.627,\"y\":0.4812,\"rgb\":[172,172,172],\"tol\":9},{\"x\":0.8527,\"y\":0.4686,\"rgb\":[147,147,147],\"tol\":9},{\"x\":0.1881,\"y\":0.5272,\"rgb\":[123,141,113],\"tol\":9},{\"x\":0.1285,\"y\":0.1967,\"rgb\":[133,136,148],\"tol\":9},{\"x\":0.627,\"y\":0.2008,\"rgb\":[179,184,199],\"tol\":5}]" } },
+ { id: "ssao", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/ssao.esscene", ESTELLA_VERIFY_W: "320", ESTELLA_VERIFY_H: "240", ESTELLA_VERIFY_STEPS: "4", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.5016,\"y\":0.8996,\"rgb\":[191,191,191],\"tol\":6},{\"x\":0.3762,\"y\":0.4937,\"rgb\":[144,144,144],\"tol\":20},{\"x\":0.627,\"y\":0.4812,\"rgb\":[172,172,172],\"tol\":9},{\"x\":0.8527,\"y\":0.4686,\"rgb\":[147,147,147],\"tol\":9},{\"x\":0.1881,\"y\":0.5272,\"rgb\":[123,141,113],\"tol\":22},{\"x\":0.1285,\"y\":0.1967,\"rgb\":[133,136,148],\"tol\":9},{\"x\":0.627,\"y\":0.2008,\"rgb\":[179,184,199],\"tol\":5}]" } },
{ id: "depth-outline-flat", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/depth-outline-flat.esscene", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.5,\"y\":0.5,\"rgb\":[230,102,26],\"tol\":20}]" } },
{ id: "mesh-opaque", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/mesh-depth.esscene", ESTELLA_VERIFY_MANIFEST: "/scenes/mesh-depth.textures.json", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "4", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.42,\"y\":0.5,\"rgb\":[0,255,0],\"tol\":40},{\"x\":0.58,\"y\":0.5,\"rgb\":[255,0,0],\"tol\":40}]" } },
{ id: "mesh-opaque-off", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SET_FIELD: "{\"entity\":2,\"component\":\"MeshRenderer\",\"key\":\"opaque\",\"value\":false}", ESTELLA_VERIFY_SCENE: "/scenes/mesh-depth.esscene", ESTELLA_VERIFY_MANIFEST: "/scenes/mesh-depth.textures.json", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "4", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.42,\"y\":0.5,\"rgb\":[0,255,0],\"tol\":40},{\"x\":0.58,\"y\":0.5,\"rgb\":[0,255,0],\"tol\":40}]" } },