defaultBuildStages
A CPU-side configuration constant that defines the ordered build stages for TSL to convert a node network into final GLSL code; it is not a shader node itself.
Core Advantages
Its core value is providing an orderly, predictable, and extensible process for shader code generation. This not only prevents compilation errors but also allows advanced users to deeply customize TSL's behavior by adding or rewriting build stages.
Common Uses
Developing complex custom nodes by injecting code at different stages (e.g., declaring variables in 'setup', generating logic in 'generate').
Injecting new functionality into the build process, like custom optimization passes, by adding custom stages.
Debugging initialization and execution order between nodes by logging within each stage's method.
How to adjust
Adjusting it doesn't cause smooth visual transitions but structural changes, often resulting in a 'works' vs. 'fails completely' outcome. For example, reversing stages causes a build failure, while adding a custom stage (e.g., 'my-water-simulation') for a specific node is the key to enabling or disabling a complex visual effect, like a dynamic water surface.
Code Examples
1// Create an array with a custom stage
2const myStages = [ 'setup', 'analyze', 'my-custom-pass', 'generate' ];
3
4// Use it in a custom NodeBuilder
5myBuilder.setBuildStages( myStages );