Capítulo 780 de 859

Chapter 780: TimestampQueryPool

Core Idea

Abstract base class of a timestamp query pool.

Key Concepts

  • currentQueryIndex : number: How many queries allocated so far.
  • frames : Array.<number>: Stores all timestamp frames.
  • isDisposed : boolean: Whether the pool has been disposed or not.
  • lastValue : number: The total frame duration until the next update.
  • maxQueries : number: Maximum number of queries this pool can hold.
  • pendingResolve : boolean | Promise.<number>: This property is used to avoid multiple concurrent resolve operations. The WebGL backend uses it as a boolean flag. In context of WebGPU, i…
  • queryOffsets : Map.<string, number>: Tracks offsets for different contexts.
  • timestamps : Map.<string, number>: Stores the latest timestamp for each render context.
  • trackTimestamp : boolean: Whether to track timestamps or not.

Reference Tables

Constructor

Signature
new TimestampQueryPool( maxQueries : number ) (abstract)

Properties

PropertyDescription
.currentQueryIndex : numberHow many queries allocated so far.
.frames : Array.<number>Stores all timestamp frames.
.isDisposed : booleanWhether the pool has been disposed or not.
.lastValue : numberThe total frame duration until the next update.
.maxQueries : numberMaximum number of queries this pool can hold.
`.pendingResolve : booleanPromise.<number>`
.queryOffsets : Map.<string, number>Tracks offsets for different contexts.
.timestamps : Map.<string, number>Stores the latest timestamp for each render context.
.trackTimestamp : booleanWhether to track timestamps or not.

Methods

MethodDescription
.allocateQueriesForContext( uid : string, frameId : number ) : number (abstract)Allocate queries for a specific uid.
.dispose() (abstract)Dispose of the query pool.
.getTimestamp( uid : string ) : numberReturns the timestamp for a given render context.
.getTimestampFrames() : Array.<number>Returns all timestamp frames.
.hasTimestampQuery( uid : string ) : booleanReturns whether a timestamp is available for a given render context.
`.resolveQueriesAsync() : Promise.<number>number (async, abstract)`

Key Takeaways

  1. Most relevant properties: currentQueryIndex, frames, isDisposed, lastValue.
  2. Key methods: allocateQueriesForContext, dispose, getTimestamp, getTimestampFrames.

Connects To