In-game tools · function

recordGpuSample

Write one resolved sample over the three rows.

Explained in In-game tools.

function recordGpuSample(timings: PassTimings, sample: GpuSample): void
import { recordGpuSample } from '@driftengine/tools';

Parameters

ParameterTypeDescription
timingsPassTimings
sampleGpuSample

In depth

It resets first, and the first draft did not. recordPassSample accumulates on purpose, because a pass may be sampled several times in one frame — a shadow pass runs per cascade — and the row a reader wants is what that pass cost altogether. A GpuSample is the opposite: it is one resolved frame's three totals, already summed by the timer. Adding it to what was there left the rows climbing forever, which reads as a leak in whatever the game last changed rather than as a defect in the readout. resetPassTimings is how the engine's own frame starts, and the labels survive it, which is why the rows do not flicker.

A caller wanting an average across frames has FrameHistory for it.