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

LimitValueWebGL parameter
maxTextureDimension1DN/AWebGL2 does not support 1D textures
maxTextureDimension2DN/AGL.MAX_TEXTURE_SIZE
maxTextureDimension3DN/AGL.MAX_3D_TEXTURE_SIZE
maxTextureArrayLayersN/AGL.MAX_ARRAY_TEXTURE_LAYERS
maxBindGroupsN/AWebGL2 has no bind groups
maxDynamicUniformBuffersPerPipelineLayoutN/AWebGPU only
maxDynamicStorageBuffersPerPipelineLayoutN/AWebGL2 has no storage buffers
maxSampledTexturesPerShaderStageN/AGL.MAX_VERTEX_TEXTURE_IMAGE_UNITS
maxSamplersPerShaderStageN/AGL.MAX_COMBINED_TEXTURE_IMAGE_UNITS
maxStorageBuffersPerShaderStageN/AWebGL2 has no storage buffers
maxStorageTexturesPerShaderStageN/AWebGL2 has no storage buffers
maxUniformBuffersPerShaderStageN/AGL.MAX_UNIFORM_BUFFER_BINDINGS
maxUniformBufferBindingSizeN/AGL.MAX_UNIFORM_BLOCK_SIZE
maxStorageBufferBindingSizeN/AWebGL2 has no storage buffers
minUniformBufferOffsetAlignmentN/AGL.UNIFORM_BUFFER_OFFSET_ALIGNMENT
minStorageBufferOffsetAlignmentN/AWebGPU only
maxVertexBuffersN/ASee WebGPU issue
maxVertexAttributesN/AGL.MAX_VERTEX_ATTRIBS
maxVertexBufferArrayStrideN/ACant be reliably determined on WebGL
maxInterStageShaderComponentsN/AGL.MAX_VARYING_COMPONENTS
maxComputeWorkgroupStorageSizeN/AWebGL2 has no compute shaders
maxComputeInvocationsPerWorkgroupN/AWebGL2 has no compute shaders
maxComputeWorkgroupSizeXN/AWebGL2 has no compute shaders
maxComputeWorkgroupSizeYN/AWebGL2 has no compute shaders
maxComputeWorkgroupSizeZN/AWebGL2 has no compute shaders
maxComputeWorkgroupsPerDimensionN/AWebGL2 has no compute shaders
  • Given that queries to driver and GPU are typically expensive in WebGL, the Device will cache any queried limits.