import { DeviceTabs, Feature as F, Limit as L, WebGLLimit as WL, } from '@site/src/react-luma'; # DeviceLimits :::caution The luma.gl v9 API is currently in [public review](/docs/public-review) and may be subject to change. ::: The `device.limits` field contains limits object that indicates what the current platform supports. ## Usage ```typescript 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 | Comments | | ------------------------------------------- | --------------------------------------------------- | -------------------------------------- | | `maxTextureDimension1D` | | WebGL does not support 1D textures | | `maxTextureDimension2D` | | `GL.MAX_TEXTURE_SIZE` | | `maxTextureDimension3D` | | `GL.MAX_3D_TEXTURE_SIZE` | | `maxTextureArrayLayers` | | `GL.MAX_ARRAY_TEXTURE_LAYERS` | | `maxBindGroups` | | WebGPU only | | `maxDynamicUniformBuffersPerPipelineLayout` | | WebGPU only | | `maxDynamicStorageBuffersPerPipelineLayout` | | WebGPU only | | `maxSampledTexturesPerShaderStage` | | `GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS` | | `maxSamplersPerShaderStage` | | `GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS` | | `maxStorageBuffersPerShaderStage` | | WebGPU only | | `maxStorageTexturesPerShaderStage` | | WebGPU only | | `maxUniformBuffersPerShaderStage` | | `GL.MAX_UNIFORM_BUFFER_BINDINGS` | | `maxUniformBufferBindingSize` | | `GL.MAX_UNIFORM_BLOCK_SIZE` | | `maxStorageBufferBindingSize` | | WebGPU only | | `minUniformBufferOffsetAlignment` | | `GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT` | | `minStorageBufferOffsetAlignment` | | WebGPU only | | `maxVertexBuffers` | | | | `maxVertexAttributes` | | `GL.MAX_VERTEX_ATTRIBS` | | `maxVertexBufferArrayStride` | | Cant be reliably determined on WebGL | | `maxInterStageShaderComponents` | | `GL.MAX_VARYING_COMPONENTS` | | `maxComputeWorkgroupStorageSize` | | WebGL does not support compute shaders | | `maxComputeInvocationsPerWorkgroup` | | WebGL does not support compute shaders | | `maxComputeWorkgroupSizeX` | | WebGL does not support compute shaders | | `maxComputeWorkgroupSizeY` | | WebGL does not support compute shaders | | `maxComputeWorkgroupSizeZ` | | WebGL does not support compute shaders | | `maxComputeWorkgroupsPerDimension` | | WebGL does not support compute shaders | ## WebGL If you know that you are running on WebGL, you don't need to go through the luma.gl Device APIs. You can access "raw" WebGL extensions and limits directly. ### Device.webglLimits A luma.gl `WebGLDevice` extracts an object that contains all "raw" WebGL limits. ```typescript import {GL} from '@luma.gl/constants'; import {WebGLDevice} from '@luma.gl/webgl'; const webglDevice = device instanceof WebGLDevice ? device as WebGLDevice: null; console.log(webglDevice ? webglDevice.webglLimits[GL.MAX_VERTEX_ATTRIBS]); ``` | Limits | This
Browser | Description | | -------------------------------------------------- | -------------------------------------------------------- | ------------------------------------ | | **WebGL 1** | | | | `GL.ALIASED_LINE_WIDTH_RANGE` | | Width !== 1 are no longer supported. | | `GL.ALIASED_POINT_SIZE_RANGE` | | `topology`: `'point'` | | `GL.MAX_TEXTURE_SIZE` | | Max width/height of texture | | `GL.MAX_CUBE_MAP_TEXTURE_SIZE` | | Max width/height of cube texture | | `GL.MAX_TEXTURE_IMAGE_UNITS` | | | | `GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS` | | | | `GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS` | | | | `GL.MAX_RENDERBUFFER_SIZE` | | | | `GL.MAX_VARYING_VECTORS` | | | | `GL.MAX_VERTEX_ATTRIBS` | | | | `GL.MAX_VERTEX_UNIFORM_VECTORS` | | | | `GL.MAX_FRAGMENT_UNIFORM_VECTORS` | | | | `GL.MAX_VIEWPORT_DIMS` | | | | `GL.MAX_TEXTURE_MAX_ANISOTROPY_EXT` | | | | **WebGL 2** | | | | `GL.MAX_3D_TEXTURE_SIZE` | | | | `GL.MAX_ARRAY_TEXTURE_LAYERS` | | | | `GL.MAX_CLIENT_WAIT_TIMEOUT_WEBGL` | | | | `GL.MAX_COLOR_ATTACHMENTS` | | | | `GL.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS` | | | | `GL.MAX_COMBINED_UNIFORM_BLOCKS` | | | | `GL.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS` | | | | `GL.MAX_DRAW_BUFFERS` | | | | `GL.MAX_ELEMENT_INDEX` | | | | `GL.MAX_ELEMENTS_INDICES` | | | | `GL.MAX_ELEMENTS_VERTICES` | | | | `GL.MAX_FRAGMENT_INPUT_COMPONENTS` | | | | `GL.MAX_FRAGMENT_UNIFORM_BLOCKS` | | | | `GL.MAX_FRAGMENT_UNIFORM_COMPONENTS` | | | | `GL.MAX_PROGRAM_TEXEL_OFFSET` | | | | `GL.MAX_SAMPLES` | | | | `GL.MAX_SERVER_WAIT_TIMEOUT` | | | | `GL.MAX_TEXTURE_LOD_BIAS` | | | | `GL.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS` | | | | `GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS` | | | | `GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS` | | | | `GL.MAX_UNIFORM_BLOCK_SIZE` | | | | `GL.MAX_UNIFORM_BUFFER_BINDINGS` | | | | `GL.MAX_VARYING_COMPONENTS` | | | | `GL.MAX_VERTEX_OUTPUT_COMPONENTS` | | | | `GL.MAX_VERTEX_UNIFORM_BLOCKS` | | | | `GL.MAX_VERTEX_UNIFORM_COMPONENTS` | | | | `GL.MIN_PROGRAM_TEXEL_OFFSET` | | | | `GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT` | | | ## Remarks - WebGL 1 only supports one color buffer format (RBG32F is deprecated) - WebGL 2 supports multiple color buffer formats - Some extensions will not be enabled until they have been queries. luma always queries on startup to enable, app only needs to query again it wants to test platform. - The capability detection system works regardless of whether the app is running in a browser or in headless mode under Node.js. - Naturally, given that queries to driver and GPU are typically expensive in WebGL, the capabilities system will cache any queries. ['ext_texture_filter_anisotropic']: https://developer.mozilla.org/en-US/docs/Web/API/EXT_texture_filter_anisotropic