Skip to main content

Module flow_codegen

Module flow_codegen 

Source
Expand description

FlowGraph → WGSL code generation

Compiles @flow DAG blocks from CSS into executable WGSL shader modules. Supports both fragment (rendering) and compute (simulation) targets.

The codegen pipeline:

  1. Collect which helper functions are needed (SDF, noise, etc.)
  2. Emit uniform/binding declarations
  3. Emit only the used helper functions
  4. Emit vertex shader (for fragment flows)
  5. Emit entry point with node computations in topological order

Functions§

flow_needs_scene_texture
Check if a flow graph uses the sample_scene() function, which requires binding a scene texture to the pipeline.
flow_to_wgsl
Compile a validated FlowGraph into a complete WGSL module string.