Feeds one frame's seconds; returns the ratio the renderer should use, unchanged most
frames. Non-finite or non-positive frames are ignored rather than counted either way,
so a parked clock (a timeScale 0 pause) can never drive the policy.
back to the ceiling with both streaks cleared
A new device-fitted ceiling (rotation, display change): the current ratio is clamped down to it, never up - stepping back up stays the streak's job. Returns the ratio.
Frame-time-driven quality scaling over item 360's static fit:
fitResolutionanswers what a device can afford once, and this watches what actually happens, stepping the backing-store ratio down when frames keep missing their budget and stepping back up only after a much longer streak inside it. Pure numbers in and out - the game (seeGame'squalityScalingoption) applies the returned ratio to its renderer, so this stays renderer-free and headless-testable.Stepping up is deliberately an order of magnitude slower than stepping down: a frame inside budget at a reduced ratio proves nothing about the next ratio up, so recovery needs a sustained streak, not a good moment.
Example