Skip to content

Commit

Permalink
Add OES_texture_float_linear extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Blake Jones authored and dhritzkiv committed Sep 25, 2020
1 parent abf2c40 commit 6873ae8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ Only the following for now:
* [`ANGLE_instanced_arrays`](https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/)
* [`OES_element_index_uint`](https://www.khronos.org/registry/webgl/extensions/OES_element_index_uint/)
* [`OES_texture_float`](https://www.khronos.org/registry/webgl/extensions/OES_texture_float/)
* [`OES_texture_float_linear`](https://www.khronos.org/registry/webgl/extensions/OES_texture_float_linear/)
* [`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/)

Expand Down
14 changes: 14 additions & 0 deletions src/javascript/extensions/oes-texture-float-linear.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class OESTextureFloatLinear {}

function getOESTextureFloatLinear (context) {
let result = null
const exts = context.getSupportedExtensions()

if (exts && exts.indexOf('OES_texture_float_linear') >= 0) {
result = new OESTextureFloatLinear()
}

return result
}

module.exports = { getOESTextureFloatLinear, OESTextureFloatLinear }
10 changes: 8 additions & 2 deletions src/javascript/webgl-rendering-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const { getANGLEInstancedArrays } = require('./extensions/angle-instanced-arrays
const { getOESElementIndexUint } = require('./extensions/oes-element-index-unit')
const { getOESStandardDerivatives } = require('./extensions/oes-standard-derivatives')
const { getOESTextureFloat } = require('./extensions/oes-texture-float')
const { getOESTextureFloatLinear } = require('./extensions/oes-texture-float-linear')
const { getSTACKGLDestroyContext } = require('./extensions/stackgl-destroy-context')
const { getSTACKGLResizeDrawingBuffer } = require('./extensions/stackgl-resize-drawing-buffer')
const { getWebGLDrawBuffers } = require('./extensions/webgl-draw-buffers')
Expand Down Expand Up @@ -55,6 +56,7 @@ const availableExtensions = {
angle_instanced_arrays: getANGLEInstancedArrays,
oes_element_index_uint: getOESElementIndexUint,
oes_texture_float: getOESTextureFloat,
oes_texture_float_linear: getOESTextureFloatLinear,
oes_standard_derivatives: getOESStandardDerivatives,
stackgl_destroy_context: getSTACKGLDestroyContext,
stackgl_resize_drawingbuffer: getSTACKGLResizeDrawingBuffer,
Expand Down Expand Up @@ -823,8 +825,8 @@ class WebGLRenderingContext extends NativeWebGLRenderingContext {
texture = unit._bindCube
}

// oes_texture_float
if (this._extensions.oes_texture_float && texture && texture._type === gl.FLOAT && (pname === gl.TEXTURE_MAG_FILTER || pname === gl.TEXTURE_MIN_FILTER) && (param === gl.LINEAR || param === gl.LINEAR_MIPMAP_NEAREST || param === gl.NEAREST_MIPMAP_LINEAR || param === gl.LINEAR_MIPMAP_LINEAR)) {
// oes_texture_float but not oes_texture_float_linear
if (this._extensions.oes_texture_float && !this._extensions.oes_texture_float_linear && texture && texture._type === gl.FLOAT && (pname === gl.TEXTURE_MAG_FILTER || pname === gl.TEXTURE_MIN_FILTER) && (param === gl.LINEAR || param === gl.LINEAR_MIPMAP_NEAREST || param === gl.NEAREST_MIPMAP_LINEAR || param === gl.LINEAR_MIPMAP_LINEAR)) {
texture._complete = false
this.bindTexture(target, texture)
return
Expand Down Expand Up @@ -1212,6 +1214,10 @@ class WebGLRenderingContext extends NativeWebGLRenderingContext {
exts.push('OES_texture_float')
}

if (supportedExts.indexOf('GL_OES_texture_float_linear') >= 0) {
exts.push('OES_texture_float_linear')
}

if (supportedExts.indexOf('EXT_draw_buffers') >= 0) {
exts.push('WEBGL_draw_buffers')
}
Expand Down

0 comments on commit 6873ae8

Please sign in to comment.