CostModel
Predicts a geometry pass's GPU time and learns from measured submissions — construct-scene-evaluator §EV-A4.1.
In the namespace construct::engine. Declared in src/libs/libconstruct/construct/engine/CostModel.hpp.
Detailed description
predicted_ms = overhead_ms + node_evaluations × ms_per_node_evaluation
The overhead term is what made the first version wrong. A submission costs something before it marches anything — the pass setup, the fullscreen quad, the pipeline bind — and the probe measures a band of a few thousand pixels where that term dominates: a 192 by 2 band of the sphere lattice measured 26 ms, which read as 45× the per-pixel cost a full frame of the same scene shows. A model without the intercept then kept every later frame tiny and the refinement could never grow back.
So both terms are fitted, by an exponentially weighted least squares over the (node evaluations, milliseconds) pairs the engine measures: probe bands, refinement bands and whole frames, at every size they run at. Until two measurements of different sizes exist the fit has no slope to find, and the model runs on the per-node cost alone, from the profile's start value.
A pure class: the caller supplies the measurements, GPU timestamps where the backend has them and CPU time around the blocking readback where it does not. One fit per shader tier (the uber shader, a specialized shader).