Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

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, and the deadband a frame must exceed before the scale moves at all. step() performs one step: it reads profiler.gpuFrame().frame_span_ms — the median across the profiler's window, so the controller steers on the frame's cost rather than on one frame's noise — 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.

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.