renderScale.module
This package holds more than this page lists. See all of its files in its world.
README.md
renderScale.module
Moves the scene's render scale toward a GPU frame-time budget.
set(opts) takes the scale under automatic control and states what to aim for:
target in milliseconds, the min/max the scale may move in, the rate a
step takes of the distance, the deadband a frame must exceed before the
scale moves at all, and the window of frames one measurement spans. step()
counts one frame, and once window frames have run it reads the GPU's own time
per frame over them (profiler.frameCost's gpu.own, its median, or its mean
where the platform gives the window's GPU time as one total) and moves
the scale by rate of the way to the scale that would have hit the target.
off() stops stepping and leaves the scale where it stands.
followBudget({ target, min }) is the quality governor's driver: at the
governed levels (medium and low) it holds the frame to the level's GPU budget
every frame, between min and the scale the quality tier chose. A caller's
set always wins over it, a scale written straight to the renderer makes it
stand aside until the tier chooses its scale again, and releaseBudget()
hands the scale back to the tier. get()
names who drives the scale in owner ("caller", "budget" or nil).
setScale(s) sets the scale directly and returns what the renderer took after
its own clamp; scale() reads that back from the renderer; get() reports what
the controller aims for and what it last measured.
Pixel count moves with the square of the scale, which is why a step solves for the square root of the overshoot rather than scaling linearly by it.