Shader library: fingerprint without node positions, a drag no longer recompiles (#65)
game-maker / suite (push) Successful in 9m5s

shaderFingerprint(graph) covers node id/type/params/ports and edge endpoints only;
x/y, collapsed, folded and edge ids stay out. ShaderLibrary keys on it and counts
compiles (__gm.shaderCompiles()). Measured before: one compile per preview step of a
node drag (12 for a harness drag); after: 0, a param change exactly +1.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
rootandClaude Fable 5.1 committed 2026-09-13 18:00:48 +02:00
1 parent 016e83c9b5
commit 102a649a35
6 files changed
+82 -6

No files matched your search

+33
View File
@@ -18,6 +18,7 @@ export async function shader(t) {
json,
evaluate,
mutate,
drag,
click,
clickText,
locate,
@@ -162,6 +163,38 @@ export async function shader(t) {
a.graph.nodes.find((n) => n.id === ${JSON.stringify(propertyNode?.id)}).params.name = 'glow';`);
await sleep(300);
// 28c-ii. Where a node sits is the editor's business: dropping it somewhere else compiles nothing
// again, a changed param does – once (#65).
const nodeRef = JSON.stringify(propertyNode?.id);
const compiledBefore = await json('__gm.shaderCompiles()');
const grab = await json(`__gm.shader.nodeAt(${nodeRef})`);
await drag(grab.x, grab.y, grab.x + 60, grab.y + 40);
await sleep(300);
const dropped = await json(`__gm.shader.nodeAt(${nodeRef})`);
const compiledAfterMove = await json('__gm.shaderCompiles()');
check(
'dropping a node somewhere else moves it without compiling the graph again',
dropped.x > grab.x + 30 && compiledAfterMove === compiledBefore,
JSON.stringify({ grab, dropped, compiledBefore, compiledAfterMove }),
);
const defaultBefore = await json(
`__gm.state.project.assets.find((x) => x.id === ${JSON.stringify(made.id)}).graph.nodes.find((n) => n.id === ${nodeRef}).params.default`,
);
const setDefault = (value) =>
mutate(`
const a = __gm.state.project.assets.find((x) => x.id === ${JSON.stringify(made.id)});
a.graph.nodes.find((n) => n.id === ${nodeRef}).params.default = ${JSON.stringify(value)};`);
await setDefault(2);
await sleep(300);
const compiledAfterParam = await json('__gm.shaderCompiles()');
check(
'changing a param compiles it again, once',
compiledAfterParam === compiledAfterMove + 1,
JSON.stringify({ compiledAfterMove, compiledAfterParam }),
);
await setDefault(defaultBefore);
await sleep(300);
// 28d. A flat sprite on the camera, drawn on top of everything; its Shader dropdown lists the assets.
await mutate(`
const project = __gm.state.project;