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 in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
The createQuerySet() method of the GPUDevice interface creates a GPUQuerySet that can be used to record the results of queries on passes, such as occlusion or timestamp queries.
createQuerySet(descriptor)
descriptorAn object containing the following properties:
countA number specifying the number of queries to be managed by the resulting GPUQuerySet.
label OptionalA string providing a label that can be used to identify the object, for example in GPUError messages or console warnings.
typeAn enumerated value specifying the type of queries to be managed by the resulting GPUQuerySet. Possible values are:
"occlusion"Occlusion queries are available on render passes to query the number of fragment samples that 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 GPUQuerySet must be provided as the value of the occlusionQuerySet descriptor property when invoking GPUCommandEncoder.beginRenderPass() to run a render pass.
"timestamp"Timestamp queries allow applications to write timestamps to a GPUQuerySet. To run a timestamp query, appropriate GPUQuerySets must be provided inside the value of the timestampWrites descriptor property when invoking GPUCommandEncoder.beginRenderPass() to run a render pass, or GPUCommandEncoder.beginComputePass() to run a compute pass. Alternatively, you can run a single timestamp query at any time by invoking GPUCommandEncoder.writeTimeStamp() with an appropriate GPUQuerySet as a parameter.
Note: The timestamp-query feature needs to be enabled to use timestamp queries.
A GPUQuerySet object instance.
The following criteria must be met when calling createQuerySet(), otherwise a GPUValidationError is generated and an invalid GPUQuerySet object is returned:
count is less than or equal to 4096.The following snippet creates a GPUQuerySet that holds 32 occlusion query results:
const querySet = device.createQuerySet({
type: "occlusion",
count: 32,
});
| Specification |
|---|
| WebGPU> # dom-gpudevice-createqueryset> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
createQuerySet |
113Currently supported on ChromeOS, macOS, and Windows only. |
113Currently supported on ChromeOS, macOS, and Windows only. |
141Currently supported on Windows only, in all contexts except for service workers. |
99Currently supported on ChromeOS, macOS, and Windows only. |
26 | 121 | No | 81 | 26 | 25.0 | 121 | 26 |
timestamp |
121Currently supported on ChromeOS, macOS, and Windows only. |
121Currently supported on ChromeOS, macOS, and Windows only. |
No | 107Currently supported on ChromeOS, macOS, and Windows only. |
No | 121 | No | 81 | No | 25.0 | 121 | No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/createQuerySet