Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage renderScale.package·originates fromworld 07158574-5…

renderScale

Moves the scene's render scale toward a GPU frame-time budget.

by◐lumi·posted 4mo ago
What it does

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.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

strict

closeWindow( ) → void

clampRange(v: number, lo: number, hi: number) → number

argtypedescription
vnumber
lonumber
hinumber

num(v: any, fallback: number) → number

argtypedescription
vany
fallbacknumber

takeOver(owner: string) → void

Start the tunables over from the defaults, at the scale the renderer has.

argtypedescription
ownerstring

set(opts: Settings?) → State

Take the scale under automatic control and set what it aims for. The scale starts moving on the next `step`, which the `DynamicResolution` component calls for you when it is on an entity. (frames per measurement) — each optional.

argtypedescription
optsSettings?`target` (ms), `min`, `max`, `rate`, `deadband`, `window`

examples

RenderScale.set({ target = 16.6, min = 0.6 })

off( ) → void

Stop stepping and leave the scale where it stands. At a governed quality level the governor takes the scale back under its frame budget (`followBudget`) on its next frame; a world's setting `quality.<level>.dynamic_resolution = false` turns that off.

examples

RenderScale.off()

get( ) → State

What the controller is aiming for and what it last measured.

examples

local s = RenderScale.get()

setScale(scale: number) → number

Set the scale directly, bypassing the controller for this value. The engine clamps to its own bound and reports back what it took, which is what this returns and what `scale()` then reads.

argtypedescription
scalenumberFraction of the display resolution, 0.25 to 1.

examples

RenderScale.setScale(0.7)

tierScale( ) → number

The scale the quality tier in force chose for the scene, at most 1.

holdMode(scale: number) → void

The resolution mode the scale needs: below 1 the scene is brought up to the display's resolution before the UI is drawn, so text stays sharp. The mode is moved only where this driver moved it, and moved back at 1.

argtypedescription
scalenumber

standAside(written: number) → void

Stand aside for a scale someone else wrote: the scale and the resolution mode are theirs until the tier chooses its scale again or `releaseBudget`.

argtypedescription
writtennumber

followBudget(opts: BudgetSettings) → number

Hold the frame to a GPU budget unless a caller drives the scale: the quality governor calls this every frame at a governed level. The scale moves between `min` and the scale the quality tier chose (`renderer.qualityTier().defaults.resolutionScale`), so a frame inside the budget renders exactly as the tier states. A caller's `set` takes the scale over, and a scale someone else writes (`renderer.setResolutionScale`), before or while this holds it, makes this stand aside until the tier chooses its scale again (another tier, or a display of another size, puts the tier's scale in place of the written one) or `releaseBudget`; a new scale from the tier becomes the new ceiling. After a caller's `off` this starts from the scale the caller left.

argtypedescription
optsBudgetSettings`target` (ms) and `min`, the floor.

examples

RenderScale.followBudget({ target = 14, min = 0.5 })

releaseBudget( ) → void

Stop holding the frame to the governor's budget and give the scale back to the quality tier, when the scale in force is still the one the budget set. A scale the budget stood aside for stays. The governor calls this when the level stops being governed.

examples

RenderScale.releaseBudget()

scale( ) → number

The scale in force, read from the renderer rather than from this module's own record of it.

examples

print(RenderScale.scale())

step( ) → number

Count one frame toward the measurement, and once `window` frames have run, move the scale one step toward the target. Reads the GPU's own time per frame (`profiler.frameCost`'s `gpu.own`, its median) over the frames since the last measurement, its mean where the platform gives the window's time as one total; a window in which no GPU frame resolved leaves the scale alone rather than steering on nothing.

examples

RenderScale.step()
⌬ Types
Settings = {State = {BudgetSettings = {

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.