Get to know MDN better
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 setBindGroup() method of the GPUComputePassEncoder interface sets the GPUBindGroup to use for subsequent compute commands, for a given index.
The index to set the bind group at. This matches the n index value of the corresponding @group(n) attribute in the shader code (GPUShaderModule) used in the related pipeline.
bindGroupThe GPUBindGroup to use for subsequent compute commands, or null, in which case any previously-set bind group in the given slot is unset.
dynamicOffsets OptionalA value specifying the offset, in bytes, for each entry in bindGroup with hasDynamicOffset: true set (i.e., in the descriptor of the GPUDevice.createBindGroupLayout() call that created the GPUBindGroupLayout object that the bindGroup is based on). This value can be:
If a Uint32Array value is specified for dynamicOffsets, both of the following parameters are also required:
dynamicOffsetsStartA number specifying the offset, in array elements, into dynamicOffsetsData, where the dynamic offset data begins.
dynamicOffsetsLengthA number specifying the number of dynamic offset values to be read from in dynamicOffsetsData.
None (Undefined).
For setBindGroup() calls that use a Uint32Array value for dynamicOffsets, the call will throw with a RangeError DOMException if:
The following criteria must be met when calling dispatchWorkgroups(), otherwise a GPUValidationError is generated and the GPUComputePassEncoder becomes invalid:
In our basic compute demo, several commands are recorded via a GPUCommandEncoder. Most of these commands originate from the GPUComputePassEncoder created via beginComputePass(). The setBindGroup() call used here is the simplest form, just specifying index and bind group.
| WebGPU # programmable-passes-bind-groups |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Feb 9, 2026 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.