Skip to content

Commit

Permalink
Add EXT_shader_texture_lod extension.
Browse files Browse the repository at this point in the history
Another shader-only extension, with no API changes.

This contribution is funded by https://higharc.com/
  • Loading branch information
null77 committed Oct 2, 2024
1 parent 254da51 commit 1d67e0a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down
14 changes: 14 additions & 0 deletions src/javascript/extensions/ext-shader-texture-lod.js
Original file line number Diff line number Diff line change
@@ -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 }
8 changes: 7 additions & 1 deletion src/javascript/webgl-rendering-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 1d67e0a

Please sign in to comment.