files/en-us/web/api/gpubindgroup/index.md
{{APIRef("WebGPU API")}}{{SecureContext_Header}}{{AvailableInWorkers}}
The GPUBindGroup interface of the {{domxref("WebGPU API", "WebGPU API", "", "nocode")}} is based on a {{domxref("GPUBindGroupLayout")}} and defines a set of resources to be bound together in a group and how those resources are used in shader stages.
A GPUBindGroup object instance is created using the {{domxref("GPUDevice.createBindGroup()")}} method.
{{InheritanceDiagram}}
[!NOTE] The WebGPU samples feature many more examples.
Our basic compute demo shows an example of creating a bind group layout and then using that as a template when creating a bind group.
// …
const bindGroupLayout = device.createBindGroupLayout({
entries: [
{
binding: 0,
visibility: GPUShaderStage.COMPUTE,
buffer: {
type: "storage",
},
},
],
});
const bindGroup = device.createBindGroup({
layout: bindGroupLayout,
entries: [
{
binding: 0,
resource: {
buffer: output,
},
},
],
});
// …
{{Specifications}}
{{Compat}}