From 1d67e0a5c8a47df9addf912bcd1e58d570eb6c8b Mon Sep 17 00:00:00 2001 From: Jamie Madill Date: Wed, 2 Oct 2024 14:50:59 -0400 Subject: [PATCH] Add EXT_shader_texture_lod extension. Another shader-only extension, with no API changes. This contribution is funded by https://higharc.com/ --- README.md | 1 + .../extensions/ext-shader-texture-lod.js | 14 ++++++++++++++ src/javascript/webgl-rendering-context.js | 8 +++++++- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/javascript/extensions/ext-shader-texture-lod.js diff --git a/README.md b/README.md index 50f59dd7..7804b6ac 100644 --- a/README.md +++ b/README.md @@ -220,6 +220,7 @@ Only the following for now: * [`WEBGL_draw_buffers`](https://www.khronos.org/registry/webgl/extensions/WEBGL_draw_buffers/) * [`EXT_blend_minmax`](https://www.khronos.org/registry/webgl/extensions/EXT_blend_minmax/) * [`EXT_texture_filter_anisotropic`](https://www.khronos.org/registry/webgl/extensions/EXT_texture_filter_anisotropic/) +* [`EXT_shader_texture_lod`](https://www.khronos.org/registry/webgl/extensions/EXT_shader_texture_lod/) ### How can I keep up to date with what has changed in headless-gl? diff --git a/src/javascript/extensions/ext-shader-texture-lod.js b/src/javascript/extensions/ext-shader-texture-lod.js new file mode 100644 index 00000000..30d0d2f2 --- /dev/null +++ b/src/javascript/extensions/ext-shader-texture-lod.js @@ -0,0 +1,14 @@ +class EXTShaderTextureLod {} + +function getEXTShaderTextureLod (context) { + let result = null + const exts = context.getSupportedExtensions() + + if (exts && exts.indexOf('EXT_shader_texture_lod') >= 0) { + result = new EXTShaderTextureLod() + } + + return result +} + +module.exports = { getEXTShaderTextureLod, EXTShaderTextureLod } diff --git a/src/javascript/webgl-rendering-context.js b/src/javascript/webgl-rendering-context.js index fd868bcd..62a5b9a6 100644 --- a/src/javascript/webgl-rendering-context.js +++ b/src/javascript/webgl-rendering-context.js @@ -12,6 +12,7 @@ const { getSTACKGLResizeDrawingBuffer } = require('./extensions/stackgl-resize-d const { getWebGLDrawBuffers } = require('./extensions/webgl-draw-buffers') const { getEXTBlendMinMax } = require('./extensions/ext-blend-minmax') const { getEXTTextureFilterAnisotropic } = require('./extensions/ext-texture-filter-anisotropic') +const { getEXTShaderTextureLod } = require('./extensions/ext-shader-texture-lod') const { getOESVertexArrayObject } = require('./extensions/oes-vertex-array-object') const { bindPublics, @@ -65,7 +66,8 @@ const availableExtensions = { stackgl_resize_drawingbuffer: getSTACKGLResizeDrawingBuffer, webgl_draw_buffers: getWebGLDrawBuffers, ext_blend_minmax: getEXTBlendMinMax, - ext_texture_filter_anisotropic: getEXTTextureFilterAnisotropic + ext_texture_filter_anisotropic: getEXTTextureFilterAnisotropic, + ext_shader_texture_lod: getEXTShaderTextureLod } const privateMethods = [ @@ -1227,6 +1229,10 @@ class WebGLRenderingContext extends NativeWebGLRenderingContext { exts.push('OES_vertex_array_object') } + if (supportedExts.indexOf('GL_EXT_shader_texture_lod') >= 0) { + exts.push('EXT_shader_texture_lod') + } + return exts }