Renderer · interface
PassTimings
Where a frame's milliseconds went, one row per graph pass.
Explained in Hello world.
interface PassTimingsimport type { PassTimings } from '@driftengine/core';In depth
Not a widening of gpuTimer.ts, and that is deliberate. That class is a WebGL2 query pool
over TIME_ELAPSED_EXT, partitioning a frame into three fixed brackets — shadows, reflection,
rest — and it is right for what it measures. A graph pass is not one of three brackets: there
are as many as the frame composes, they are named at record time, and on WebGPU the sample
comes from a timestamp query rather than an elapsed-time extension. Two different measurements
with two different shapes; widening one into the other would leave a class that does neither
well.
What it does inherit from that class is its best rule: unmeasured is not zero. A device
without timestamp queries, or a pass that ran no work, must not read as "took no time" — a
profiler that cannot distinguish those two is a profiler that sends somebody optimising a pass
that never ran. passMs returns null for unmeasured and a number for measured, including zero.
Labels persist and timings reset. A pass that did nothing this frame keeps its name and reports unmeasured, so the profiler's rows stop jumping about as quality settings toggle passes on and off — which is exactly when somebody is reading it.
Properties
| Name | Type | Description |
|---|---|---|
ms | Float64Array | Accumulated milliseconds per pass for the current frame. |
measured | Uint8Array | Whether each pass received a sample this frame. |
labels | string[] | Name per pass, kept across frames. |