Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The GPUQuerySet interface of the WebGPU API is used to record the results of queries on passes, such as occlusion or timestamp queries.
- Occlusion queries are available on render passes to query whether any fragment samples pass all the per-fragment tests for a set of drawing commands (including scissor, sample mask, alpha to coverage, stencil, and depth tests). To run an occlusion query, an appropriate
GPUQuerySetmust be provided as the value of theocclusionQuerySetdescriptor property when invokingGPUCommandEncoder.beginRenderPass()to run a render pass. - Timestamp queries allow applications to write timestamps to a
GPUQuerySet. To run a timestamp query, appropriateGPUQuerySets must be provided inside the value of thetimestampWritesdescriptor property when invokingGPUCommandEncoder.beginRenderPass()to run a render pass, orGPUCommandEncoder.beginComputePass()to run a compute pass. Alternatively, you can run a single timestamp query at any time by invokingGPUCommandEncoder.writeTimeStamp()with an appropriateGPUQuerySetas a parameter.
A GPUQuerySet object instance is created using the GPUDevice.createQuerySet() method.