Rewrite core around shared rows and render graphs

Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a01380-b478-77d0-84a0-102880a5c5ae
This commit is contained in:
Amp
2026-08-19 15:30:32 +00:00
co-authored by heaust
parent d34722d66d
commit f12c7c9603
118 changed files with 687 additions and 34500 deletions
+18 -6
View File
@@ -1,6 +1,18 @@
// FXNode is an optional authoring frontend. Its exporter is intentionally the only
// FXNode-aware code that feeds the canonical AST package.
export {
adaptFxNodeSnapshot,
mapAuthoringDiagnostic,
} from "./adapter.js";
import { createGraphAst } from "@yawn/render-graph-ast";
/** Exports FXNode nodes with a `pass` payload and links as the canonical pass DAG. */
export function adaptFxNodeSnapshot(snapshot, { pipelines = {}, resources = {} } = {}) {
if (!Array.isArray(snapshot?.nodes) || !Array.isArray(snapshot?.links)) throw new TypeError("FXNODE_GRAPH");
const passes = snapshot.nodes.map(node => {
if (!node?.id || !node.pass) throw new TypeError("FXNODE_PASS");
return { ...structuredClone(node.pass), id: node.id, after: [...(node.pass.after ?? [])] };
});
const byId = new Map(passes.map(pass => [pass.id, pass]));
for (const link of snapshot.links) {
const source = link.fromNodeId ?? link.from?.node;
const target = link.toNodeId ?? link.to?.node;
if (!byId.has(source) || !byId.has(target)) throw new TypeError("FXNODE_LINK");
if (!byId.get(target).after.includes(source)) byId.get(target).after.push(source);
}
return createGraphAst({ id: snapshot.graphId ?? "fxnode", pipelines, resources, passes });
}