SpecializedWalkEmitter

The emitter of construct-scene-evaluator §EV-A9.2.

In the namespace construct::shader. Declared in src/libs/libconstruct/construct/shader/SpecializedWalkEmitter.hpp.

Detailed description

Runs the interpreted walk of ShaderTreeEvaluator over a symbolic stack: every push and pop of `evaluateSceneTree` depends on the structure alone, so the emitter replays them in their order and writes, for each pop, the code the interpreted walk runs at that pop. What depends on values stays code: the "has an accumulator" test where a running result decides it, the material picks by blend, and every parameter, which is read from the node buffer by a constant node index. The definition index is a constant, so each dispatch switch folds to its one case.

The result is the same image as the interpreted walk's (§EV-A9.5): the same operations in the same order on the same values, a dropped push where the stack of stackDepth would drop one, and the same material globals.

maxPops bounds the code (§EV-A9.4, PF-7). The emitter measures the walk of every start, then takes the starts by their evaluation weight, the heaviest first, while their pops fit: a start's weight is its pops times coverage, the share of the evaluations that reach it. The starts that do not fit stay on the interpreted walk, in the same shader. With no coverage, every start has the same share, and the starts with the most pops go first. A start of fewer than minPops pops stays interpreted, and at most maxStarts are taken. interpretedName is the name the interpreted walk is emitted under.

In this section