feat: compile pipeline-specific render pass cohorts

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-29 14:49:22 +00:00
co-authored by heaust
parent 27e3dd64ae
commit 780f194be4
16 changed files with 1519 additions and 376 deletions
+18 -12
View File
@@ -6,7 +6,7 @@ import { descriptors } from "../static/render-graph/catalog.js";
test("all presets use current schemas, versions, and one frame output", () => {
assert.equal(Object.keys(presets.renderGraphPresets).length, 13);
for (const [name, graph] of Object.entries(presets.renderGraphPresets)) {
assert.deepEqual([graph.schemaVersion, graph.revision], [3, 2], name);
assert.deepEqual([graph.schemaVersion, graph.revision], [3, 3], name);
assert.equal(new Set(graph.nodes.map((node) => node.id)).size, graph.nodes.length, name);
assert.equal(graph.nodes.filter((node) => node.executor.key === "frame_out").length, 1, name);
for (const node of graph.nodes)
@@ -15,7 +15,7 @@ test("all presets use current schemas, versions, and one frame output", () => {
const authoredX4 = Object.entries(presets.renderGraphPresets).flatMap(([name, graph]) =>
graph.nodes.filter((node) => node.parameters?.texture?.sampleCount === 4)
.map((node) => `${name}:${node.id}`));
assert.deepEqual(authoredX4, ["msaa:msaa_hdr"]);
assert.deepEqual(authoredX4, ["msaa:msaa_hdr", "msaa:scene_depth"]);
assert.equal(typeof presets.msaa.nodes.find((node) => node.id === "msaa_hdr")
.parameters.texture.sampleCount, "number");
});
@@ -30,7 +30,7 @@ test("presets classify demo-owned enable and material bits through type.words[0]
assert.deepEqual(byId.pbr_double.inputs.predicate, [{ node: "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, 4);
assert.equal(pipeline.executor.version, 1);
}
}
});
@@ -45,14 +45,20 @@ test("culling adds a local-AABB expression to each material predicate", () => {
assert.equal(byId[id].inputs.inputs.at(-1).node, "not_culled");
});
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);
test("scene pipelines directly share matching explicit color and depth targets", () => {
for (const [name, graph] of Object.entries(presets.renderGraphPresets)) {
const byId = Object.fromEntries(graph.nodes.map((node) => [node.id, node]));
const color = byId.ground.inputs.colorTarget;
const depth = byId.ground.inputs.depthTarget;
for (const id of ["ground", "pbr", "pbr_double"]) {
assert.deepEqual(byId[id].inputs.colorTarget, color, `${name}:${id}`);
assert.deepEqual(byId[id].inputs.depthTarget, depth, `${name}:${id}`);
assert.equal(["ground", "pbr", "pbr_double"].includes(color[0].node), false, name);
}
const colorDescriptor = byId[color[0].node].parameters.texture;
const depthDescriptor = byId[depth[0].node].parameters.texture;
assert.equal(depthDescriptor.format, "depth32_float", name);
assert.deepEqual(depthDescriptor.extent, colorDescriptor.extent, name);
assert.equal(depthDescriptor.sampleCount, colorDescriptor.sampleCount, name);
}
const midnight = Object.fromEntries(presets.midnight.nodes.map((node) => [node.id, node]));
assert.deepEqual(midnight.ground.inputs.colorTarget, [{ node: "ldr", socket: "texture" }]);
});