Skip to main content

Module shader_graph

Module shader_graph 

Source
Expand description

Node-based composable shader graph system.

The shader graph compiles a directed acyclic graph of nodes into GLSL fragment shader source code at runtime. Every visual effect in Proof Engine can be described as a graph of mathematical operations.

§Architecture

  • ShaderGraph — owns nodes and edges, validates, compiles
  • ShaderNode — individual processing unit (40+ types)
  • ShaderEdge — connects an output socket to an input socket
  • GraphCompiler — walks the graph and emits GLSL
  • GraphOptimizer — dead-node elimination, constant folding
  • ShaderPreset — named, pre-built graphs for common effects
  • ShaderParameter — runtime-controllable uniform (bound to MathFunction)

§Quick Start

use proof_engine::render::shader_graph::{ShaderGraph, ShaderPreset};
let graph = ShaderPreset::void_protocol();
let glsl  = graph.compile().unwrap();
println!("{}", glsl.fragment_source);

Re-exports§

pub use nodes::ShaderNode;
pub use nodes::NodeType;
pub use nodes::SocketType;
pub use nodes::NodeSocket;
pub use compiler::GraphCompiler;
pub use compiler::CompiledShader;
pub use optimizer::GraphOptimizer;
pub use presets::ShaderPreset;

Modules§

compiler
Shader graph → GLSL compiler.
nodes
Shader graph node types and socket definitions.
optimizer
Shader graph optimizer — dead-node elimination, constant folding, common subexpression sharing, and redundant node removal.
presets
Pre-built shader graph presets for Proof Engine visual effects.

Structs§

EdgeId
GraphStats
NodeId
ShaderEdge
A directed connection from one node’s output socket to another’s input.
ShaderGraph
A directed acyclic graph of shader processing nodes.
ShaderParameter
A runtime-controllable parameter bound to a GLSL uniform.

Enums§

GraphError
ParameterValue