Merge pull request #13505 from mike-000/float_linear-fallback

Fallback if `OES_texture_float_linear` is not supported
This commit is contained in:
Tim Schaub
2022-03-25 08:52:00 -06:00
committed by GitHub

View File

@@ -58,7 +58,18 @@ function uploadDataTexture(
interpolate
) {
const gl = helper.getGL();
bindAndConfigure(gl, texture, interpolate);
let textureType;
let canInterpolate;
if (data instanceof Float32Array) {
textureType = gl.FLOAT;
helper.getExtension('OES_texture_float');
const extension = helper.getExtension('OES_texture_float_linear');
canInterpolate = extension !== null;
} else {
textureType = gl.UNSIGNED_BYTE;
canInterpolate = true;
}
bindAndConfigure(gl, texture, interpolate && canInterpolate);
const bytesPerRow = data.byteLength / size[1];
let unpackAlignment = 1;
@@ -93,15 +104,6 @@ function uploadDataTexture(
}
}
let textureType;
if (data instanceof Float32Array) {
textureType = gl.FLOAT;
helper.getExtension('OES_texture_float');
helper.getExtension('OES_texture_float_linear');
} else {
textureType = gl.UNSIGNED_BYTE;
}
const oldUnpackAlignment = gl.getParameter(gl.UNPACK_ALIGNMENT);
gl.pixelStorei(gl.UNPACK_ALIGNMENT, unpackAlignment);
gl.texImage2D(