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 resolveQuerySet() method of the GPUCommandEncoder interface encodes a command that resolves a GPUQuerySet, copying the results into a specified GPUBuffer.
resolveQuerySet(querySet, firstQuery, queryCount, destination, destinationOffset)
querySetA GPUQuerySet object representing the query set to be resolved.
firstQueryThe index number of the first query value to be copied over to the buffer.
queryCountThe number of queries to be copied over to the buffer, starting from firstQuery.
destinationA GPUBuffer representing the buffer to copy the query values to.
destinationOffsetA number representing the offset, in bytes, from the start of the buffer to start writing the query values at.
None (Undefined).
The following criteria must be met when calling resolveQuerySet(), otherwise a GPUValidationError is generated and the GPUCommandEncoder becomes invalid:
destination.buffer's GPUBuffer.usage includes the GPUBufferUsage.QUERY_RESOLVE flag.firstQuery is smaller than the number of queries in querySet.firstQuery + queryCount is smaller than or equal to the number of queries in querySet.destinationOffset is a multiple of 256.destinationOffset + 8 × queryCount is less than or equal to destination.size.// …
const queryBuffer = device.createBuffer({
size: 1024,
usage: GPUBufferUsage.QUERY_RESOLVE,
});
const querySet = device.createQuerySet({
type: "timestamp",
count: 32,
});
// …
const commandEncoder = device.createCommandEncoder();
// Write timestamps to querySet
commandEncoder.writeTimestamp(querySet, 0);
// …
commandEncoder.writeTimestamp(querySet, 1);
// etc.
// …
commandEncoder.resolveQuerySet(
querySet,
0, // First query to write
16, // Number of queries to count
queryBuffer,
0, // Buffer offset
);
// …
| Specification |
|---|
| WebGPU> # dom-gpucommandencoder-resolvequeryset> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
resolveQuerySet |
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 |
© 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/GPUCommandEncoder/resolveQuerySet