Renderer · class

FrameBudget

Every ceiling a backend imposes, counted for the frame just drawn.

Explained in Hello world.

class FrameBudget
import { FrameBudget } from '@driftengine/core';

In depth

The lines and the array holding them are allocated once and updated in place, so a consumer reading this every frame allocates nothing — which is what AGENTS.md requires of anything on a per-frame path, and a budget nobody can afford to read every frame is a budget nobody reads.

Accessors

NameTypeDescription
linesgetreadonly BudgetLine[]Every line, in the order declared. The same array every frame.
droppedgetbooleanWhether anything at all was refused this frame.
More

The one thing worth asserting on, and the reason it is a field rather than a walk over lines: a consumer's headless check wants expect(renderer.frameBudget.dropped).toBe(false) on every scene it renders, and a check that has to know which lines exist is a check that misses the line added after it was written.

Methods

line

line(name: string, ceiling: number | null): BudgetCounter

Declare a line. Called at construction, never in a frame.

ParameterTypeDescription
namestring
ceilingnumber | null
More

ceiling is null for a backend that imposes none — reported rather than omitted, because a line that disappears on one backend is a line a cross-backend check cannot compare.

markDropped

markDropped(): void

reset

reset(): void

Start a frame. Keeps every line object; clears what they hold.