C++ Shader Tracer (Program-from-lambda)
Write shader in C++ code
- Convert lambda expressions to shaders (Program from lambda)
- in glow-extras
- Use expression trees ("traced glm types")
- Tag variables as
uniform
orconstant
- Probabilistic error checking (only uniforms and constants are allowed to change, start with checking every invocation, then decay into less frequent checking)
Conditions:
- If a traced variable (or uniform) is converted to bool, it creates two subnodes in the expression tree (for true and false)
- It then returns one of the results to trace that specific sub tree
- The lambda is re-traced until tree is complete
- Bool nodes that are re-visited just choose a different option
- If both sides are traced we choose an incomplete side
Loops:
- Naively, loops are just unrolled by the expression tracing
- When depending on a traced variable it will generate an infinite tree (true/false nodes)
- Subtree hashing should be able to detect this infinite pattern and merge back loops