GPUSupportedLimits

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 GPUSupportedLimits interface of the WebGPU API describes the limits supported by a GPUAdapter.

The GPUSupportedLimits object for the current adapter is accessed via the GPUAdapter.limits property.

You should note that, rather than reporting the exact limits of each GPU, browsers will likely report different tier values of different limits to reduce the unique information available to drive-by fingerprinting. For example, the tiers of a certain limit might be 2048, 8192, and 32768. If your GPU's actual limit is 16384, the browser will still report 8192.

Given that different browsers will handle this differently and the tier values may change over time, it is hard to provide an accurate account of what limit values to expect — thorough testing is advised.

Instance properties

The following limits are represented by properties in a GPUSupportedLimits object. See the Limits section of the specification for detailed descriptions of what the limits relate to.

Limit nameDefault value
maxTextureDimension1D8192
maxTextureDimension2D8192
maxTextureDimension3D2048
maxTextureArrayLayers256
maxBindGroups4
maxBindingsPerBindGroup640
maxDynamicUniformBuffersPerPipelineLayout8
maxDynamicStorageBuffersPerPipelineLayout4
maxSampledTexturesPerShaderStage16
maxSamplersPerShaderStage16
maxStorageBuffersPerShaderStage8
maxStorageTexturesPerShaderStage4
maxUniformBuffersPerShaderStage12
maxUniformBufferBindingSize65536 bytes
maxStorageBufferBindingSize134217728 bytes (128 MB)
minUniformBufferOffsetAlignment256 bytes
minStorageBufferOffsetAlignment256 bytes
maxVertexBuffers8
maxBufferSize268435456 bytes (256 MB)
maxVertexAttributes16
maxVertexBufferArrayStride2048 bytes
maxInterStageShaderComponents Deprecated Non-standard (use maxInterStageShaderVariables instead, see deprecation notice for more info)60
maxInterStageShaderVariables16
maxColorAttachments8
maxColorAttachmentBytesPerSample32
maxComputeWorkgroupStorageSize16384 bytes
maxComputeInvocationsPerWorkgroup256
maxComputeWorkgroupSizeX256
maxComputeWorkgroupSizeY256
maxComputeWorkgroupSizeZ64
maxComputeWorkgroupsPerDimension65535

Examples

In the following code we query the GPUAdapter.limits value of maxBindGroups to see if it is equal to or greater than 6. Our theoretical example app ideally needs 6 bind groups, so if the returned value is >= 6, we add a maximum limit of 6 to the requiredLimits object. We then request a device with that limit requirement using GPUAdapter.requestDevice():

async function init() {
  if (!navigator.gpu) {
    throw Error("WebGPU not supported.");
  }

  const adapter = await navigator.gpu.requestAdapter();
  if (!adapter) {
    throw Error("Couldn't request WebGPU adapter.");
  }

  const requiredLimits = {};

  // App ideally needs 6 bind groups, so we'll try to request what the app needs
  if (adapter.limits.maxBindGroups >= 6) {
    requiredLimits.maxBindGroups = 6;
  }

  const device = await adapter.requestDevice({
    requiredLimits,
  });

  // …
}

Specifications

Specification
WebGPU
# gpusupportedlimits

Browser compatibility

See also