GPUDevice: createBindGroup() method

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 in secure contexts (HTTPS), in some or all supporting browsers.

Note: This feature is available in Web Workers.

The createBindGroup() method of the GPUDevice interface creates a GPUBindGroup based on a GPUBindGroupLayout that defines a set of resources to be bound together in a group and how those resources are used in shader stages.

Syntax

js
createBindGroup(descriptor)

Parameters

descriptor

An object containing the following properties:

entries

An array of entry objects describing the resources to expose to the shader. There will be one for each corresponding entry described by the GPUBindGroupLayout referenced in layout. Each entry object has the following properties:

binding

A number representing a unique identifier for this resource binding, which matches the binding value of a corresponding GPUBindGroupLayout entry. In addition, it matches the n index value of the corresponding @binding(n) attribute in the shader (GPUShaderModule) used in the related pipeline.

resource

The resource to bind. This can be one of the following:

label Optional

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

layout

The GPUBindGroupLayout that the entries of this bind group will conform to.

GPUBufferBinding objects

A GPUBufferBinding object can contain the following properties:

buffer

The GPUBuffer object you want to bind.

offset Optional

The offset, in bytes, from the beginning of the buffer to the beginning of the range exposed to the shader by the buffer binding. If omitted, offset defaults to 0.

size Optional

The size, in bytes, of the buffer binding. If omitted, size will be the range starting at offset and ending at the end of the buffer. If both offset and size are omitted, the entire buffer is exposed to the shader.

Return value

A GPUBindGroup object instance.

Validation

The following criteria must be met when calling createBindGroup(), otherwise a GPUValidationError is generated and an invalid GPUBindGroup object is returned:

  • The number of entries in the layout GPUBindGroupLayout equals the number of entry objects in entries.
  • For each entry in the layout GPUBindGroupLayout, the corresponding entry object in entries binds the correct resource type. For example, a buffer resource layout object has a GPUBufferBinding object specified in the corresponding binding.
  • If the resource layout object is a buffer:
    • The corresponding bound GPUBuffer:
      • Has its bound part (as specified by offset and size) contained inside it completely, with a non-zero size.
      • Has a size bigger than the buffer resource layout's minBindingSize.
    • If the resource layout object type is "uniform":
      • The bound GPUBuffer has a usage that includes GPUBufferUsage.UNIFORM.
      • The effective size of the bound buffer segment is less than or equal to the GPUDevice's maxUniformBufferBindingSize limit.
      • The specified GPUBufferBinding offset is a multiple of the GPUDevice's minUniformBufferOffsetAlignment limit.
    • If the resource layout object type is "storage" or "read-only-storage":
      • The bound GPUBuffer has a usage that includes GPUBufferUsage.STORAGE.
      • The effective size of the bound buffer segment is less than or equal to the GPUDevice's maxStorageBufferBindingSize limit.
      • The effective size of the bound buffer segment is a multiple of 4.
      • The specified GPUBufferBinding offset is a multiple of the GPUDevice's minStorageBufferOffsetAlignment limit.
  • If the resource layout object is a storageTexture, the corresponding bound GPUTextureView:
    • Has a dimension equal to the resource layout object's viewDimension (see GPUTexture.createView() for more details of a texture view's settings).
    • Has a format equal to the resource layout object's sampleType.
    • Has a mipLevelCount equal to 1.
    • Is a view of a GPUTexture with a usage that includes GPUTextureUsage.STORAGE_BINDING.
  • If the resource layout object is a texture, the corresponding bound GPUTextureView:
    • Has a dimension equal to the resource layout object's viewDimension (see GPUTexture.createView() for more details of a texture view's settings).
    • Has a format compatible with the resource layout object's sampleType.
    • Is a view of a GPUTexture with a usage that includes GPUTextureUsage.TEXTURE_BINDING.
    • is a view of a GPUTexture with a sampleCount greater than 1 if the resource layout object's multisampled property is true, or equal to 1 if it is false.

Examples

Note: The WebGPU samples feature many more examples.

Basic example

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.

js
// …

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

Specification
WebGPU
# dom-gpudevice-createbindgroup

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
createBindGroup
Chrome – Partial support
Chrome 113 (Release date: 2023-05-02)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Chrome 144.
Edge – Partial support
Edge 113 (Release date: 2023-05-05)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Edge 144.
Firefox – Partial support
Firefox 141 (Release date: 2025-07-22)
footnote Partial support
footnote Supports all contexts except service workers. See bug 1942431.
footnote Supports Windows since Firefox 141. See bug 1972486.
footnote Supports macOS Tahoe on Apple silicon since Firefox 145. See bug 1992212.
footnote Supports older macOS versions on Apple silicon since Firefox 147. See bug 1993341.
footnote Does not support macOS on Intel CPUs. See bug 2004105.
footnote Does not support Linux. See bug 2006676.
Opera – Partial support
Opera 99 (Release date: 2023-05-16)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Opera 128.
Safari – Full support
Safari 26 (Release date: 2025-09-15)
footnote Full support
Chrome Android – Full support
Chrome Android 121 (Release date: 2024-01-23)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 81 (Release date: 2024-03-14)
footnote Full support
Safari on iOS – Full support
Safari on iOS 26 (Release date: 2025-09-15)
footnote Full support
Samsung Internet – Full support
Samsung Internet 25 (Release date: 2024-04-24)
footnote Full support
WebView Android – Full support
WebView Android 121 (Release date: 2024-01-23)
footnote Full support
WebView on iOS – Full support
WebView on iOS 26 (Release date: 2025-09-15)
footnote Full support
Deno – No support
Deno 1.8 – 1.31 (Release date: 2021-03-02)
footnote Removed in 1.32 and later
Deno – No support
Deno 1.39 (Release date: 2023-12-14)
disabled
disabled From version 1.39 users must explicitly set the --unstable-webgpu runtime flag.
descriptor.entries.resource parameter accepts GPUBuffer in place of GPUBufferBinding.
Experimental
Chrome – Partial support
Chrome 138 (Release date: 2025-06-24)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Chrome 144.
Edge – Partial support
Edge 138 (Release date: 2025-06-26)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Edge 144.
Firefox – No support
Firefox
footnote No support
Opera – Partial support
Opera 122 (Release date: 2025-09-11)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Opera 128.
Safari – No support
Safari
footnote No support
Chrome Android – Partial support
Chrome Android 138 (Release date: 2025-06-24)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Chrome Android 144.
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Partial support
Opera Android 91 (Release date: 2025-08-19)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Opera Android 95.
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – Partial support
WebView Android 138 (Release date: 2025-06-24)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since WebView Android 144.
WebView on iOS – No support
WebView on iOS
footnote No support
Deno – No support
Deno
footnote No support
descriptor.entries.resource parameter accepts GPUTextureView (2D, single subresource) in place of GPUExternalTexture.
Experimental
Chrome – Partial support
Chrome 137 (Release date: 2025-05-27)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Chrome 144.
Edge – Partial support
Edge 137 (Release date: 2025-05-29)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Edge 144.
Firefox – No support
Firefox
footnote No support
Opera – Partial support
Opera 121 (Release date: 2025-08-27)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Opera 128.
Safari – No support
Safari
footnote No support
Chrome Android – Partial support
Chrome Android 137 (Release date: 2025-05-27)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Chrome Android 144.
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Partial support
Opera Android 90 (Release date: 2025-06-18)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Opera Android 95.
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – Partial support
WebView Android 137 (Release date: 2025-05-27)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since WebView Android 144.
WebView on iOS – No support
WebView on iOS
footnote No support
Deno – No support
Deno
footnote No support
descriptor.entries.resource parameter accepts GPUTexture in place of GPUTextureView (provided default view is desired).
Experimental
Chrome – Partial support
Chrome 140 (Release date: 2025-09-02)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Chrome 144.
Edge – Partial support
Edge 140 (Release date: 2025-09-05)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Edge 144.
Firefox – No support
Firefox
footnote No support
Opera – Partial support
Opera 124 (Release date: 2025-11-13)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Opera 128.
Safari – No support
Safari
footnote No support
Chrome Android – Partial support
Chrome Android 140 (Release date: 2025-09-02)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Chrome Android 144.
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Partial support
Opera Android 92 (Release date: 2025-10-08)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since Opera Android 95.
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – Partial support
WebView Android 140 (Release date: 2025-09-02)
footnote Partial support
footnote Supported on ChromeOS, macOS, and Windows.
footnote Supported on Linux (Intel Gen12+ GPUs only) since WebView Android 144.
WebView on iOS – No support
WebView on iOS
footnote No support
Deno – No support
Deno
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
Experimental. Expect behavior to change in the future.
User must explicitly enable this feature.
Has more compatibility info.

See also