Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. GPUQuerySet

GPUQuerySet

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.

Note: This feature is available inWeb Workers.

TheGPUQuerySet interface of theWebGPU 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 appropriateGPUQuerySet must be provided as the value of theocclusionQuerySet descriptor property when invokingGPUCommandEncoder.beginRenderPass() to run a render pass.

  • Timestamp queries allow applications to write timestamps to aGPUQuerySet. To run a timestamp query, appropriateGPUQuerySets must be provided inside the value of thetimestampWrites descriptor property when invokingGPUCommandEncoder.beginRenderPass() to run a render pass, orGPUCommandEncoder.beginComputePass() to run a compute pass.

Note:Thetimestamp-queryfeature needs to be enabled to use timestamp queries.

AGPUQuerySet object instance is created using theGPUDevice.createQuerySet() method.

Instance properties

countRead only

A number specifying the number of queries managed by theGPUQuerySet.

label

A string providing a label that can be used to identify the object, for example inGPUError messages or console warnings.

typeRead only

An enumerated value specifying the type of queries managed by theGPUQuerySet.

Instance methods

destroy()

Destroys theGPUQuerySet.

Examples

The following snippet creates aGPUQuerySet that holds 32 occlusion query results, and then returns thetype andcount:

js
const querySet = device.createQuerySet({  type: "occlusion",  count: 32,});console.log(querySet.count); // 32console.log(querySet.type); // "occlusion"

Specifications

Specification
WebGPU
# gpuqueryset

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp