Graphene is the name of the underlying procedural graphics engine that powers Graphite. Instead of storing artwork as fixed pixel data or static shapes, Graphene compiles and executes node networks — directed acyclic graphs that describe how artwork is generated from inputs. Every piece of artwork in Graphite is ultimately the output of a node network evaluation, which is re-run whenever an input changes. This procedural approach makes all edits non-destructive by design.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/GraphiteEditor/Graphite/llms.txt
Use this file to discover all available pages before exploring further.
Node Networks
A node network is a finite set of nodes connected together as a directed acyclic graph (DAG). Data flows through the network from left to right: nodes receive typed inputs from the nodes connected to them and produce typed outputs that flow to the next nodes. To interact with the outside world, a network has import connectors (data flowing in from the enclosing context) and export connectors (data flowing out). From outside, a network is a black box — it is fed inputs and can be executed to produce outputs. The root-level network in a document exports to the canvas; subgraph networks may receive an image as input, process it, and export the result. In the Graphene codebase, the term “network” is used instead of “graph” or “subgraph” to avoid ambiguity with user-facing concepts. There is nothing structurally different between a root network and any subgraph — both are instances ofNodeNetwork.
Key Crates
The Graphene engine is spread across several crates in thenode-graph/ directory of the workspace:
graph-craft
Defines the core document types:
NodeNetwork, DocumentNode, NodeInput, NodeId, and ProtoNetwork. Also contains the Compiler struct that transforms a NodeNetwork into a flat ProtoNetwork ready for execution.interpreted-executor
Provides
DynamicExecutor, which takes a ProtoNetwork and evaluates it at runtime using dynamic dispatch. Caches node outputs to avoid redundant re-evaluation when only a portion of the graph changes.node-macro
The
#[node_macro::node] proc-macro crate. Annotate a Rust function with this attribute to define a custom node: the macro generates the type registration, input/output connector wiring, and the node executor boilerplate.graphene-core (gcore)
Fundamental types and traits shared across all nodes. Contains
Context, NodeIO, NodeIOTypes, and the memo/monitor infrastructure. Every node crate depends on this.graphene-std (gstd)
Standard library of utility nodes: rendering infrastructure, web request nodes, animation timing, and rendering pipeline utilities like
RenderConfig and ExportFormat.wgpu-executor
WGPU-based GPU executor. Manages the GPU device, context, and shader execution pipeline. Raster shader nodes compile to SPIRV and run through this executor.
node-graph/nodes/ provide domain-specific nodes: vector, raster, graphic, transform, math, repeat, blending, text, and brush.
Core Type Structures
The central types ingraph-craft that represent a document-level network are:
NodeNetwork is a map from NodeId to DocumentNode, plus metadata about the network’s imports, exports, and UI positioning.
Compilation Pipeline
Before a network can be executed, it must be compiled to a flatProtoNetwork. The pipeline is:
Source NodeNetwork
The document stores a
NodeNetwork with fully nested subgraphs, NodeInput::Import connectors, and UI metadata.Preprocessing
The
preprocessor crate expands subgraph nodes inline, resolving resource hashes and flattening the hierarchy.Compiler (graph-craft)
The
Compiler::compile_single method transforms the preprocessed network into a ProtoNetwork — a flat list of ProtoNode entries with all connections resolved to node IDs..graphite document using graphene-cli:
Node Types
Graphene supports two kinds of nodes, both represented uniformly asDocumentNode in the network:
Native nodes are implemented directly in Rust, annotated with #[node_macro::node]. The macro registers them with a ProtoNodeIdentifier string so the compiler can resolve them by name at compile time.
Subgraph nodes are implemented as nested NodeNetwork instances inside the DocumentNode.implementation field. Double-clicking a subgraph node in the Graphite editor reveals its interior network. Many of the built-in Graphite nodes are subgraphs composed from simpler native nodes.
GPU Acceleration
Graphene includes a WGPU-based GPU execution path for raster operations. Shader nodes are compiled from Rust usingspirv-std to SPIRV shaders and executed on the GPU via the wgpu-executor crate. The GPU path is used automatically for raster image processing nodes when a compatible GPU is available.
The wgpu-executor crate manages the WGPU device and queue. Raster textures are represented as Raster<GPU> and can be converted back to CPU buffers (Raster<CPU>) for encoding to PNG/JPG output.
GPU shader nodes require SPIRV compilation and are only available on native targets (not WebAssembly without WebGPU). The
#[node_macro::node(..., shader_node(...))] attribute instructs the macro to generate both a CPU fallback and a GPU shader variant.