UWAL / GPUTiming
Classes
GPUTiming
Utility class levering the "timestamp-query" feature when available to monitor GPU timings. Feel free to consult WebGPU Timing Performance lesson for its usefulness and common pitfalls, and this example for the basic usage.
Constructors
Constructor
new GPUTiming(stage): GPUTiming;Parameters
| Parameter | Type | Description |
|---|---|---|
stage | RenderStage | ComputeStage | Computation or Renderer instance used for monitoring |
Returns
Throws
ERROR.TIMESTAMP_QUERY_NOT_FOUND when "timestamp-query" feature is not supported.
Methods
ResolveAndSubmit()
ResolveAndSubmit(): Promise<number>;Copy timestamp results to a GPUBuffer and measure the duration between the current and the previous pass.
NOTE: Must be called after Computation.Compute or Renderer.Render (with the submit flag set to false).
Returns
Promise<number>
GPU duration of the current pass; NaN if the measurement failed for configuration reasons.
Destroy()
Destroy(): void;Destroy the query set, GPUBuffers and reset internal state.
Returns
void
Accessors
QuerySet
Get Signature
get QuerySet(): Promise<GPUQuerySet | undefined>;Throws
ERROR.TIMESTAMP_QUERY_NOT_FOUND when "timestamp-query" feature is not supported.
Returns
Promise<GPUQuerySet | undefined>
A query set to use in Computation|Renderer.CreateTimestampWrites method.
Enabled
Get Signature
get Enabled(): boolean;Returns
boolean
true if "timestamp-query" feature is available after initialization, false otherwise.