Skip to main content

Module shader_graph

Module shader_graph 

Source
Expand description

§Shader Graph System

A node-based shader graph system for the Proof Engine. Provides a visual-programming style interface for constructing GPU shaders from interconnected nodes.

§Architecture

  • Nodes: 40+ node types covering sources, transforms, math, effects, color, noise, and outputs
  • Compiler: Topological sort, dead-node elimination, constant folding, CSE, GLSL codegen
  • Optimizer: Type inference, algebraic simplification, node merging, variant caching
  • Presets: 15+ ready-made shader graphs for common game effects
  • Serialize: Custom text format for saving/loading graphs with round-trip fidelity

Re-exports§

pub use nodes::NodeType;
pub use nodes::ShaderNode;
pub use nodes::Socket;
pub use nodes::SocketDirection;
pub use nodes::DataType;
pub use nodes::SocketId;
pub use nodes::NodeId;
pub use nodes::Connection;
pub use nodes::ShaderGraph;
pub use compiler::CompiledShader;
pub use compiler::CompileError;
pub use compiler::CompileOptions;
pub use compiler::ShaderCompiler;
pub use optimizer::OptimizationPass;
pub use optimizer::OptimizerConfig;
pub use optimizer::ShaderOptimizer;
pub use presets::ShaderPresets;
pub use serialize::GraphSerializer;
pub use serialize::SerializeError;

Modules§

compiler
Shader graph compiler: topological sort, dead-node elimination, constant folding, common subexpression elimination, and GLSL code generation.
nodes
Shader graph node definitions: 40+ node types with input/output sockets, GLSL snippet generation, and default parameter values.
optimizer
Advanced optimization passes for shader graphs: type inference, algebraic simplification, redundant cast removal, loop detection, node merging, instruction count estimation, and shader variant caching.
presets
Preset shader graphs: 15+ ready-made shader graphs built programmatically. Each preset constructs a complete node graph with all connections.
serialize
Graph serialization: custom TOML-like text format for saving/loading shader graphs, with node ID mapping, connection serialization, parameter type tags, and round-trip fidelity.