@equinor/videx-3d
    Preparing search index...

    Class GpuTimer

    Tiny GPU timer for WebGL2 built on EXT_disjoint_timer_query_webgl2.

    DEBUG-ONLY instrumentation: it brackets named, non-overlapping segments with TIME_ELAPSED queries and reads the results back asynchronously (a few frames later), reporting a smoothed millisecond figure per segment. Because the GPU runs behind the CPU, results are never available the same frame they are issued, so a small ring of queries per segment is kept in flight.

    Only one timer query can be active at a time per spec, so begin/end calls must be strictly sequential (never nested). All methods are no-ops when the extension is unavailable (older browsers, or the WebGPU renderer), so call sites can leave instrumentation in place unconditionally.

    This is measurement only — it issues no draws and mutates no render state — so it does not affect the rendered result and is safe to leave compiled in behind a flag.

    Index

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    Methods

    • Begin timing a segment. No-op if unsupported or another segment is active.

      Parameters

      • label: string

      Returns void

    • Smoothed elapsed milliseconds for a segment, or -1 if no result yet.

      Parameters

      • label: string

      Returns number

    • Harvest finished queries and update the smoothed timings. Call once per frame (e.g. at the top of the host pass's render). Disjoint frames (GPU context disruption) are discarded.

      Returns void

    • Snapshot of every segment's smoothed timing in milliseconds.

      Returns Record<string, number>