Vixen
02b45cc4
csharp
public sealed class CompositorGraphCompiler

Turns a compositor graph into the document a renderer builds a frame from.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The framework's walk collects; this class assembles. NodeGraphCompiler`1 visits every node in dependency order with its ports resolved, which is exactly what is needed to instantiate them and let the declarations land. What it cannot do is produce a tree, because it has no notion of one — so Finish walks the flow edges itself, from the frame node outwards.

⚠ A flow output takes one edge. The model lets an output fan out, which is right for a value — two nodes can read one number — and meaningless for an ordering: two nodes cannot both be next. The second edge is reported against the node rather than silently picked between, because the alternative is a frame whose pass order depends on which wire was drawn first.

⚠ A node nothing reaches is reported and left out. An author unhooking a pass while debugging has done something deliberate, and a compiler that quietly dropped it would leave them wondering why the frame is unchanged; one that quietly included it would make unhooking do nothing.

Methods (7)

  • public CompositorGraphCompiler(NodeTypeRegistry registry)

    Compiles against a node library.

  • public static NodeTypeRegistry CreateRegistry()

    A registry holding this assembly's compositor nodes.

  • protected override void Begin(NodeGraphModel graph)

    Called before the walk, to reset whatever the subclass accumulates.

  • protected override void Visit(GraphNode node, NodeTypeDefinition definition, Node instance, NodeBinding binding)

    Called once per node, in dependency order, with its ports already filled.

  • protected override GraphicsCompositorAsset? Finish(NodeGraphModel graph)

    Called after the walk, when nothing went wrong, to produce the artefact.

  • protected override string Constant(ReadOnlySpan<float> value, PortKind kind)
  • protected override string Convert(string expression, PortKind from, PortKind target)

Used by (3)

  • CompositorCompilerTestsVixen.Editor.AssetEditors.Tests
  • CompositorDocumentVixen.Editor.AssetEditors
  • CompositorEditorFactoryVixen.Editor.AssetEditors