feat: synthesize default graph attachments

Amp-Thread-ID: https://ampcode.com/threads/T-019f9d91-77c1-7206-a60f-ed6554ce92ab

Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
This commit is contained in:
Amp
2026-07-28 23:08:26 +00:00
co-authored by heaust
parent f6d6af7a17
commit eb640f0183
10 changed files with 1363 additions and 196 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ test("production render graph composition passes fxnode's public validator", asy
result.ok ? undefined : JSON.stringify(result.issues, null, 2),
);
assert.equal(fxNodeComposition.schemaVersion, 2);
assert.equal(fxNodeComposition.version, 8);
assert.equal(fxNodeComposition.version, 9);
assert.equal(Object.keys(fxNodeComposition.nodes).length, 42);
assert.ok(
Object.values(fxNodeComposition.nodes).every(
+13 -4
View File
@@ -5,14 +5,14 @@ import {
CATALOG_VERSION, semanticCatalog, nodeDefinitions, descriptors,
} from "../static/render-graph/catalog.js";
test("catalog v8 exposes the final mesh, pipeline, and typed-expression contracts", () => {
assert.equal(CATALOG_VERSION, 8);
test("catalog v9 exposes the final mesh, pipeline, and typed-expression contracts", () => {
assert.equal(CATALOG_VERSION, 9);
assert.deepEqual(semanticCatalog.mesh.outputs, {
mesh: { type: "mesh_data" }, type: { type: "u32x16" }, localAabb: { type: "local_aabb" },
});
assert.equal(semanticCatalog.mesh.version, 2);
assert.equal(nodeDefinitions.mesh.sockets.localAabb.title, "Local AABB");
assert.equal(semanticCatalog.pipeline.version, 2);
assert.equal(semanticCatalog.pipeline.version, 3);
assert.equal(semanticCatalog.pipeline.inputs.predicate.required, false);
for (const key of ["and", "xnor", "equals_f32", "greater_than_u32", "combine_vec4",
"separate_mat4", "combine_u32_bits", "separate_u32x16", "separate_local_aabb"])
@@ -27,10 +27,19 @@ test("current culling fixture uses type-bit predicates and final socket versions
const byId = Object.fromEntries(culling.nodes.map((node) => [node.id, node]));
assert.deepEqual(byId.cull.inputs.localAabb, { node: "mesh", socket: "localAabb" });
assert.deepEqual(byId.type_words.inputs.value, { node: "mesh", socket: "type" });
assert.equal(byId.ground.executor.version, 2);
assert.equal(byId.ground.executor.version, 3);
assert.equal(byId.ground.inputs.predicate.node, "ground_final");
});
test("compiler texture sockets expose policy metadata without literal widgets", () => {
for (const socket of ["colorTarget", "depthTarget"]) {
assert.equal(semanticCatalog.pipeline.inputs[socket].defaultPolicy, "compiler_texture");
assert.equal(nodeDefinitions.pipeline.sockets[socket].default, undefined);
}
assert.equal(semanticCatalog.pipeline.inputs.predicate.defaultPolicy, "parameter_literal");
assert.notEqual(nodeDefinitions.pipeline.sockets.predicate.default, null);
});
test("removed architecture is absent from the authoring catalog", () => {
for (const removed of ["mesh_query", "pipeline_registry"])
assert.equal(semanticCatalog[removed], undefined);
+13 -1
View File
@@ -25,7 +25,7 @@ test("presets classify visibility and material through type.words[0] predicates"
assert.deepEqual(byId.pbr_double.inputs.predicate, { node: name === "culling" ? "pbr_double_final" : "double_class", socket: "value" }, name);
for (const pipeline of [byId.ground, byId.pbr, byId.pbr_double]) {
assert.deepEqual(pipeline.inputs.mesh, { node: "mesh", socket: "mesh" });
assert.equal(pipeline.executor.version, 2);
assert.equal(pipeline.executor.version, 3);
}
}
});
@@ -39,3 +39,15 @@ test("culling adds a local-AABB expression to each material predicate", () => {
for (const id of ["ground", "pbr", "pbr_double"])
assert.equal(byId[id].inputs.predicate.node.endsWith("_final"), true);
});
test("implicit presets start disconnected and then chain both attachments", () => {
for (const name of ["hdr", "culling", "grading"]) {
const byId = Object.fromEntries(presets[name].nodes.map((node) => [node.id, node]));
assert.equal("colorTarget" in byId.ground.inputs, false, name);
assert.equal("depthTarget" in byId.ground.inputs, false, name);
assert.deepEqual(byId.pbr.inputs.colorTarget, { node: "ground", socket: "color" }, name);
assert.deepEqual(byId.pbr.inputs.depthTarget, { node: "ground", socket: "depth" }, name);
}
const midnight = Object.fromEntries(presets.midnight.nodes.map((node) => [node.id, node]));
assert.deepEqual(midnight.ground.inputs.colorTarget, { node: "ldr", socket: "texture" });
});