Chevron Down
Table of Contents
Chevron DownGetting Started
Chevron DownAPI Reference

WebGL Extensions

This section provides an overview of available WebGL extensions. It describes luma's builtin support for extensions (and note that even if no built-in support is provided, the application can always work directly with any extensions it needs). The Khronos group's official list of WebGL Extensions is intimidatingly long, but it can be digested more easily by categorizing them into a few basic categories.

Many extensions are used automatically by luma.gl to polyfill WebGL2 functionality on WebGL1 devices.

General Extensions

These extensions expose optional general capability that was not included in the initial standard perhaps due to performance or security concerns.

ExtensionEnablesluma.gl support
WEBGLsharedresourcesShare resource between WebGL contextsN/A
WEBGLsecuritysensitive_resourcesCross-origin resource loadingN/A

Debug Extensions

These extensions expose additional information and capabilities that help debug and profile a WebGL program. luma.gl carefully uses these extensions under the hood to provide a better debug experience.

ExtensionEnablesluma.gl support
WEBGLlosecontextSimulate context lossN/A
WEBGLdebugrenderer_infoReturns strings identifying GPUglGetDebugInfo, logged to console on startup
WEBGLdebugshadersGives access to translated shader sourceShader class method
EXTdisjointtimer_queryEnables async queries of GPU timingsUsed to implement Query under WebGL1
EXTdisjointtimerquerywebgl2Enables async queries of GPU timingsBuilt into WebGL2 Query object

WebGL1 Extensions

These extensions expose various OpenGL ES 3.0 features that are often available on the target devices that run the OpenGL ES 2.0 based WebGL1 standard today.

Note that many of these extensions are no longer available in WebGL2 as the functionality they enable is provided by default in WebGL2 (which requires an OpenGL ES 3.0 compliant device).

ExtensionEnablesluma.gl support
OES_vertex_array_objectVertexArray in WebGL1Used as WebGL2 polyfill for VertexArray under WebGL1. Note that luma.gl also has a "client side" implmentation of this extenion which is used in case the extension is not available (e.g. under headless gl).
ANGLE_instanced_arraysinstanced draw functions in WebGL1luma's draw function automatically uses this extension when required
OES_texture_floatEnables Float32Array textures
OES_texture_half_floatEnables Uint16Array / HALFFLOATOES textures
OES_standard_derivativesEnables derivative functions in GLSL
WEBGL_depth_textureEnables storing depth buffers in textures
OES_element_index_uintQuerying enables Uint32Array ELEMENTSluma queries on startup to enable, app needs to query again it wants to test platform
EXT_frag_depthEnables fragment shader to control depth value
WEBGL_draw_buffersEnables fragment shaders to draw to multiple framebuffers
OES_texture_half_float_linearEnables linear filter for half float textures
EXT_blend_minmaxExtends blending functionPolyfills WebGL2 MIN and MAX blending modes
EXT_shader_texture_lodenables shader control of LOD
EXT_texture_filter_anisotropicEnables anisotropic filtering
OES_texture_float_linearEnables linear filter for float textures
OES_fbo_render_mipmapRender to specific texture mipmap level
EXT_sRGBsRGB encoded rendering
WEBGL_color_buffer_floatframebuffer render to 32 bit float color buffer
EXT_color_buffer_half_floatframebuffer render to half float color buffer
EXT_float_blendblending with 32-bit floating point color buffers

WebGL2 Extensions

These extensions expose various OpenGL ES 3.1 and 3.2 features that are often available on target devices that run the OpenGL ES 3.0 based WebGL2 standard today. These extensions can bring OpenGL ES 3.1 or 3.2 capabilities to WebGL2 contexts, if the device supports them.

ExtensionEnablesluma.gl support
EXTcolorbuffer_floatframebuffer render to float color buffer

Proposed Extensions

Khronos lists a couple of proposed extensions. They will be considered by luma.gl as they become available in browsers.

ExtensionEnablesluma.gl support
EXT_clip_cull_distance (WebGL2)hardware clip/cull planes (ES3.2)N/A
EXT_texture_storagetexture storage effiencyN/A
WEBGL_debugDebug eventsN/A
WEBGL_dynamic_texturefrequently changin texturesN/A
WEBGL_subarray_uploadsEfficient buffer updateN/A

Compressed Texture Format Extensions

Used to query if the GPU supports specific proprietary compressed texture formats.

The primary advantage of compressed texture formats is that in contrast to JPGs or PNGs, they do not have to be decompressed to be used by the GPU. As a non-scientific guideline, compressed texture formats might achieve about 4x compression, compared to say 16x compression for JPEG. So while they are usually slower to load, but they could allow 4x more textures to be stored in the same amount of GPU memory.

The main issue of compressed texture formats is that they tend to be highly propietary (patent-encumbered) and there tends to be royalty requirements when using them. Note that (presumably due to patent issues), finding a compressed texture format which is supported across a range of target devices can be challenging.

To side-step patent issues when using these formats an application would typically:

  1. generate these in external commercial applications (which have already licensed any supported formats).
  2. load them in binary form without touching the content
  3. Pass them directly to a texture, so that they are processed inside the GPU driver (which also has licensed the formats).

For these reasons, luma.gl leaves the support and handling of compressed texture formats to the application.

ExtensionEnablesluma.gl support
WEBGL_compressed_texture_s3tcCertain S3TC compressed texture formatsN/A
WEBGL_compressed_texture_atcCertain AMD compressed texture formatsN/A
WEBGL_compressed_texture_pvrtcCertain IMG compressed texture formatsN/A
WEBGL_compressed_texture_etc1Certain compressed texture formatsN/A
WEBGL_compressed_texture_etcCertain compressed texture formatsN/A
WEBGL_compressed_texture_astcCertain compressed texture formatsN/A
WEBGL_compressed_texture_s3tc_srgbCertain compressed texture formatsN/A