feat: compile multisampled 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-29 00:48:35 +00:00
co-authored by heaust
parent eb640f0183
commit b5366d8b77
14 changed files with 985 additions and 179 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, 9);
assert.equal(fxNodeComposition.version, 10);
assert.equal(Object.keys(fxNodeComposition.nodes).length, 42);
assert.ok(
Object.values(fxNodeComposition.nodes).every(
+5 -4
View File
@@ -5,15 +5,16 @@ import {
CATALOG_VERSION, semanticCatalog, nodeDefinitions, descriptors,
} from "../static/render-graph/catalog.js";
test("catalog v9 exposes the final mesh, pipeline, and typed-expression contracts", () => {
assert.equal(CATALOG_VERSION, 9);
test("catalog v10 exposes the final mesh, pipeline, and typed-expression contracts", () => {
assert.equal(CATALOG_VERSION, 10);
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, 3);
assert.equal(semanticCatalog.pipeline.version, 4);
assert.equal(semanticCatalog.pipeline.inputs.predicate.required, false);
assert.deepEqual(nodeDefinitions.texture.parameters.sampleCount.enum, ["1", "4"]);
for (const key of ["and", "xnor", "equals_f32", "greater_than_u32", "combine_vec4",
"separate_mat4", "combine_u32_bits", "separate_u32x16", "separate_local_aabb"])
assert.equal(semanticCatalog[key].execution, "expression", key);
@@ -27,7 +28,7 @@ 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, 3);
assert.equal(byId.ground.executor.version, 4);
assert.equal(byId.ground.inputs.predicate.node, "ground_final");
});
+8 -2
View File
@@ -4,7 +4,7 @@ import * as presets from "../static/render-graph/presets.js";
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, 12);
assert.equal(Object.keys(presets.renderGraphPresets).length, 13);
for (const [name, graph] of Object.entries(presets.renderGraphPresets)) {
assert.deepEqual([graph.schemaVersion, graph.revision], [2, 1], name);
assert.equal(new Set(graph.nodes.map((node) => node.id)).size, graph.nodes.length, name);
@@ -12,6 +12,12 @@ test("all presets use current schemas, versions, and one frame output", () => {
for (const node of graph.nodes)
assert.equal(node.executor.version, descriptors[node.executor.key].version, `${name}:${node.id}`);
}
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.equal(typeof presets.msaa.nodes.find((node) => node.id === "msaa_hdr")
.parameters.texture.sampleCount, "number");
});
test("presets classify visibility and material through type.words[0] predicates", () => {
@@ -25,7 +31,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, 3);
assert.equal(pipeline.executor.version, 4);
}
}
});