Skip to content
Snippets Groups Projects
Commit f8c1a1ec authored by Marshall Quander's avatar Marshall Quander
Browse files

Don't do extra work for float texture support

parent 4d5559d2
No related branches found
No related tags found
No related merge requests found
...@@ -16,20 +16,21 @@ function checkFloatTextureSupport() { ...@@ -16,20 +16,21 @@ function checkFloatTextureSupport() {
renderer.dispose(); renderer.dispose();
return result; return result;
} }
const supportsFloatTextures = checkFloatTextureSupport();
export function patchWebGLRenderingContext() { export function patchWebGLRenderingContext() {
const originalGetExtension = WebGLRenderingContext.prototype.getExtension; if (/Android.+Firefox/.test(navigator.userAgent)) {
function patchedGetExtension(name) {
// It appears that Galaxy S6 devices falsely report that they support // It appears that Galaxy S6 devices falsely report that they support
// OES_texture_float in Firefox. This workaround disables float textures // OES_texture_float in Firefox. This workaround disables float textures
// for those devices. // for those devices.
// See https://github.com/mozilla/hubs/issues/32 and // See https://github.com/mozilla/hubs/issues/32 and
// https://bugzilla.mozilla.org/show_bug.cgi?id=1338656 // https://bugzilla.mozilla.org/show_bug.cgi?id=1338656
if (name === "OES_texture_float" && /Android.+Firefox/.test(navigator.userAgent) && !supportsFloatTextures) { const originalGetExtension = WebGLRenderingContext.prototype.getExtension;
return null; const supportsFloatTextures = checkFloatTextureSupport();
} WebGLRenderingContext.prototype.getExtension = function patchedGetExtension(name) {
return originalGetExtension.call(this, name); if (name === "OES_texture_float" && !supportsFloatTextures) {
return null;
}
return originalGetExtension.call(this, name);
};
} }
WebGLRenderingContext.prototype.getExtension = patchedGetExtension;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment