Skip to main content

DeviceLimits

The device.limits field contains limits object that indicates what the current platform supports.

Background​

Each platform (GPU, driver, browser etc) has different limitations. To avoid limiting applications to a common minimal set of limits, the device limits API lets the application discover what the current platform supports.

Usage​

Access the current Device limits using the device.limits field

import type {DeviceLimits} from '@luma.gl/core';
import {Device} from '@luma.gl/core';

const limits: DeviceLimits = device.limits;
console.log(limits);
if (limits.maxTextureDimension2D > 2048) {
...
}

DeviceLimits​

The stage-specific storage limits matter when an application wants to read storage resources from a vertex or fragment shader. A WebGPU core device can report 0 for vertex-stage storage buffers, so storage-backed vertex rendering should check maxStorageBuffersInVertexStage before choosing that path. For assembled WGSL, see the WGSL Support platform define for the same decision in shader source.

LimitWebGPU
core-max
WebGPU
core
WebGPU
compat
WebGL2WebGL parameter
maxTextureDimension1DN/AN/AN/AN/AWebGL2 does not support 1D textures
maxTextureDimension2DN/AN/AN/AN/AGL.MAX_TEXTURE_SIZE
maxTextureDimension3DN/AN/AN/AN/AGL.MAX_3D_TEXTURE_SIZE
maxTextureArrayLayersN/AN/AN/AN/AGL.MAX_ARRAY_TEXTURE_LAYERS
maxBindGroupsN/AN/AN/AN/AWebGL2 has no bind groups
maxBindGroupsPlusVertexBuffersN/AN/AN/AN/AWebGPU only
maxBindingsPerBindGroupN/AN/AN/AN/AWebGPU only
maxDynamicUniformBuffersPerPipelineLayoutN/AN/AN/AN/AWebGPU only
maxDynamicStorageBuffersPerPipelineLayoutN/AN/AN/AN/AWebGL2 has no storage buffers
maxSampledTexturesPerShaderStageN/AN/AN/AN/AGL.MAX_VERTEX_TEXTURE_IMAGE_UNITS
maxSamplersPerShaderStageN/AN/AN/AN/AGL.MAX_COMBINED_TEXTURE_IMAGE_UNITS
maxStorageBuffersPerShaderStageN/AN/AN/AN/AWebGL2 has no storage buffers
maxStorageBuffersInVertexStageN/AN/AN/AN/AWebGL2 has no storage buffers
maxStorageBuffersInFragmentStageN/AN/AN/AN/AWebGL2 has no storage buffers
maxStorageTexturesPerShaderStageN/AN/AN/AN/AWebGL2 has no storage buffers
maxStorageTexturesInVertexStageN/AN/AN/AN/AWebGL2 has no storage textures
maxStorageTexturesInFragmentStageN/AN/AN/AN/AWebGL2 has no storage textures
maxUniformBuffersPerShaderStageN/AN/AN/AN/AGL.MAX_UNIFORM_BUFFER_BINDINGS
maxUniformBufferBindingSizeN/AN/AN/AN/AGL.MAX_UNIFORM_BLOCK_SIZE
maxStorageBufferBindingSizeN/AN/AN/AN/AWebGL2 has no storage buffers
maxBufferSizeN/AN/AN/AN/AWebGPU reports the requested device limit; WebGL2 uses Number.MAX_SAFE_INTEGER as an unknown-limit sentinel
minUniformBufferOffsetAlignmentN/AN/AN/AN/AGL.UNIFORM_BUFFER_OFFSET_ALIGNMENT
minStorageBufferOffsetAlignmentN/AN/AN/AN/AWebGPU only
maxVertexBuffersN/AN/AN/AN/ASee WebGPU issue
maxVertexAttributesN/AN/AN/AN/AGL.MAX_VERTEX_ATTRIBS
maxVertexBufferArrayStrideN/AN/AN/AN/ACan't be reliably determined on WebGL
maxInterStageShaderVariablesN/AN/AN/AN/AGL.MAX_VARYING_COMPONENTS
maxColorAttachmentsN/AN/AN/AN/AGL.MAX_COLOR_ATTACHMENTS
maxColorAttachmentBytesPerSampleN/AN/AN/AN/AWebGPU only
maxComputeWorkgroupStorageSizeN/AN/AN/AN/AWebGL2 has no compute shaders
maxComputeInvocationsPerWorkgroupN/AN/AN/AN/AWebGL2 has no compute shaders
maxComputeWorkgroupSizeXN/AN/AN/AN/AWebGL2 has no compute shaders
maxComputeWorkgroupSizeYN/AN/AN/AN/AWebGL2 has no compute shaders
maxComputeWorkgroupSizeZN/AN/AN/AN/AWebGL2 has no compute shaders
maxComputeWorkgroupsPerDimensionN/AN/AN/AN/AWebGL2 has no compute shaders
  • Given that queries to driver and GPU are typically expensive in WebGL, the Device will cache any queried limits.