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
Limit | Value | WebGL parameter |
---|---|---|
maxTextureDimension1D | N/A | WebGL2 does not support 1D textures |
maxTextureDimension2D | N/A | GL.MAX_TEXTURE_SIZE |
maxTextureDimension3D | N/A | GL.MAX_3D_TEXTURE_SIZE |
maxTextureArrayLayers | N/A | GL.MAX_ARRAY_TEXTURE_LAYERS |
maxBindGroups | N/A | WebGL2 has no bind groups |
maxDynamicUniformBuffersPerPipelineLayout | N/A | WebGPU only |
maxDynamicStorageBuffersPerPipelineLayout | N/A | WebGL2 has no storage buffers |
maxSampledTexturesPerShaderStage | N/A | GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS |
maxSamplersPerShaderStage | N/A | GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS |
maxStorageBuffersPerShaderStage | N/A | WebGL2 has no storage buffers |
maxStorageTexturesPerShaderStage | N/A | WebGL2 has no storage buffers |
maxUniformBuffersPerShaderStage | N/A | GL.MAX_UNIFORM_BUFFER_BINDINGS |
maxUniformBufferBindingSize | N/A | GL.MAX_UNIFORM_BLOCK_SIZE |
maxStorageBufferBindingSize | N/A | WebGL2 has no storage buffers |
minUniformBufferOffsetAlignment | N/A | GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT |
minStorageBufferOffsetAlignment | N/A | WebGPU only |
maxVertexBuffers | N/A | See WebGPU issue |
maxVertexAttributes | N/A | GL.MAX_VERTEX_ATTRIBS |
maxVertexBufferArrayStride | N/A | Cant be reliably determined on WebGL |
maxInterStageShaderVariables | N/A | GL.MAX_VARYING_COMPONENTS |
maxComputeWorkgroupStorageSize | N/A | WebGL2 has no compute shaders |
maxComputeInvocationsPerWorkgroup | N/A | WebGL2 has no compute shaders |
maxComputeWorkgroupSizeX | N/A | WebGL2 has no compute shaders |
maxComputeWorkgroupSizeY | N/A | WebGL2 has no compute shaders |
maxComputeWorkgroupSizeZ | N/A | WebGL2 has no compute shaders |
maxComputeWorkgroupsPerDimension | N/A | WebGL2 has no compute shaders |
- Given that queries to driver and GPU are typically expensive in WebGL, the Device will cache any queried limits.