Skip to main content

DeviceFeatures

The luma.gl Device provides a device "feature" system that allows applications to check whether specific advanced capabilities are present on the current browser or GPU.

Background

Both WebGL 2 and WebGPU provide extension mechanisms that allow implementations to expose additional capabilities that may not be supported on all browsers and GPUs. This allows new GPU features to be provided without waiting for new official versions of the WebGL or WebGPU standards to be approved and published.

Device.features

luma.gl provides a unified feature detection system across WebGPU, WebGL, WGLSL and GLSL. Each device has a device.features field that holds a DeviceFeatures object with an API similar to Set<DeviceFeature>.

Feature NameThis
Browser
DescriptionWebGL counterpart
WebGPU Extensions
depth-clip-controlN/ADisable depth clipping via unclippedDepthWEBGL_depth_texture
indirect-first-instanceN/ASpecify instance index via GPU bufferN/A
timestamp-queryN/AGPU timer query supportN/A
WebGL Extensions
timer-query-webglN/AGPU timer supportEXT_disjoint_timer_query
compilation-status-async-webglN/ANon-blocking compile/link statusKHR_parallel_shader_compile
polygon-mode-webglN/AWireframe rendering parameters (debug only)WEBGL_polygon_mode
provoking-vertex-webglN/APrimitive vertex used for flat shadingWEBGL_provoking_vertex
Shader Extensions
shader-f16N/AWGSL supports f16N/A
shader-noperspective-interpolation-webglN/AGLSL noperspective interpolation qualifierNV_shader_noperspective_interpolation
shader-conservative-depth-webglN/AGLSL enable early depth test optimizationsEXT_conservative_depth
shader-clip-cull-distance-webglN/AGLSL gl_ClipDistance[]/gl_CullDistance[]WEBGL_clip_cull_distance
Texture Extensions
depth32float-stencil8N/AN/A
rg11b10ufloat-renderableN/Arg11b10ufloat textures renderableN/A
float32-renderable-webglN/Afloat32 textures renderableEXT_color_buffer_float
float16-renderable-webglN/Afloat16 textures renderableEXT_color_buffer_half_float
rgb9e5ufloat-renderable-webglN/Argb9e5ufloat renderable'WEBGL_render_shared_exponent'
snorm8-renderable-webglN/Ar,rg,rgba8snorm renderableEXT_render_snorm
norm16-renderable-webglN/Ar,rg,rgba16norm renderable[EXT_texture_norm16][EXT_texture_norm16]
snorm16-renderable-webglN/Ar,rg,rgba16snorm renderable[EXT_texture_norm16][EXT_texture_norm16], EXT_render_snorm
float32-filterableN/Afloat32 textures are filterableOES_texture_float_linear
float16-filterable-webglN/Afloat16 textures are filterableOES_texture_half_float_linear
texture-filterable-anisotropic-webglN/Aanisotropic filtering, commonEXT_texture_filter_anisotropic
bgra8unorm-storageN/Acan be used as storage binding.
texture-blend-float-webglN/Afloat texture blendingEXT_float_blend
Compressed Texture Support
texture-compression-bcN/ADXT (BC1-BC7). Desktops.
texture-compression-bc5-webglN/ADXT (BC1-BC5). Desktops.
texture-compression-etc2N/APerformance caveats.
texture-compression-astcN/AASTC.
texture-compression-etc1-webglN/AQualcomm Snapdragon. Android.
texture-compression-pvrtc-webglN/APowerVR GPUs, iOS devices.
texture-compression-atc-webglN/AQualcomm Adreno GPUs. Android.

The table above uses the luma.gl Device.feature field to check the capabilities of your current browser. You can open this page in different browsers and on different machines to compare capabilities.

Remarks

  • On WebGL, extensions will not be enabled until they have been queried.
  • Given that queries to driver and GPU are typically expensive in WebGL, the Device will cache any queried extensions.
  • A substantial set of features are devoted to texture capabilites, however these can also be queried on a per-texture basis.
  • Both WebGL2 and WebGPU are continuously developing new extensions. The feature list will be updated as new extensions are added to the standards.

Usage

An example of feature detection

// Checks if `Query` objects can do async queries of GPU timings
if (device.features.has('timer-query-webgl')) {
...
}
// Alternatively - do the same query using raw WebGL extensions
if (webglDevice.gl.getExtension('EXT_disjoint_timer_query_webgl2')) {
...
}

Check native extensions