Skip to content

Commit bd03e70

Browse files
committed
Add EXT_shader_texture_lod extension.
Another shader-only extension, with no API changes. This contribution is funded by https://higharc.com/
1 parent 254da51 commit bd03e70

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ Only the following for now:
220220
* [`WEBGL_draw_buffers`](https://www.khronos.org/registry/webgl/extensions/WEBGL_draw_buffers/)
221221
* [`EXT_blend_minmax`](https://www.khronos.org/registry/webgl/extensions/EXT_blend_minmax/)
222222
* [`EXT_texture_filter_anisotropic`](https://www.khronos.org/registry/webgl/extensions/EXT_texture_filter_anisotropic/)
223+
* [`EXT_shader_texture_lod`](https://www.khronos.org/registry/webgl/extensions/EXT_shader_texture_lod/)
223224

224225
### How can I keep up to date with what has changed in headless-gl?
225226

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class EXTShaderTextureLod {}
2+
3+
function getEXTShaderTextureLod (context) {
4+
let result = null
5+
const exts = context.getSupportedExtensions()
6+
7+
if (exts && exts.indexOf('EXT_shader_texture_lod') >= 0) {
8+
result = new EXTShaderTextureLod()
9+
}
10+
11+
return result
12+
}
13+
14+
module.exports = { getEXTShaderTextureLod, EXTShaderTextureLod }

src/javascript/webgl-rendering-context.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const { WebGLShader } = require('./webgl-shader')
4040
const { WebGLShaderPrecisionFormat } = require('./webgl-shader-precision-format')
4141
const { WebGLTexture } = require('./webgl-texture')
4242
const { WebGLUniformLocation } = require('./webgl-uniform-location')
43+
const { getEXTShaderTextureLod } = require('./extensions/ext-shader-texture-lod')
4344

4445
// These are defined by the WebGL spec
4546
const MAX_UNIFORM_LENGTH = 256
@@ -65,7 +66,8 @@ const availableExtensions = {
6566
stackgl_resize_drawingbuffer: getSTACKGLResizeDrawingBuffer,
6667
webgl_draw_buffers: getWebGLDrawBuffers,
6768
ext_blend_minmax: getEXTBlendMinMax,
68-
ext_texture_filter_anisotropic: getEXTTextureFilterAnisotropic
69+
ext_texture_filter_anisotropic: getEXTTextureFilterAnisotropic,
70+
ext_shader_texture_lod: getEXTShaderTextureLod,
6971
}
7072

7173
const privateMethods = [
@@ -1227,6 +1229,10 @@ class WebGLRenderingContext extends NativeWebGLRenderingContext {
12271229
exts.push('OES_vertex_array_object')
12281230
}
12291231

1232+
if (supportedExts.indexOf('GL_EXT_shader_texture_lod') >= 0) {
1233+
exts.push('EXT_shader_texture_lod')
1234+
}
1235+
12301236
return exts
12311237
}
12321238

0 commit comments

Comments
 (0)