diff --git a/dom/canvas/WebGLContextExtensions.cpp b/dom/canvas/WebGLContextExtensions.cpp index fe9b6fcccd63..749846d97175 100644 --- a/dom/canvas/WebGLContextExtensions.cpp +++ b/dom/canvas/WebGLContextExtensions.cpp @@ -184,7 +184,7 @@ WebGLContext::IsExtensionSupported(WebGLExtensionID ext) const case WebGLExtensionID::EXT_frag_depth: return WebGLExtensionFragDepth::IsSupported(this); case WebGLExtensionID::EXT_shader_texture_lod: - return gl->IsSupported(gl::GLFeature::shader_texture_lod); + return WebGLExtensionShaderTextureLod::IsSupported(this); case WebGLExtensionID::EXT_sRGB: return WebGLExtensionSRGB::IsSupported(this); diff --git a/dom/canvas/WebGLExtensionShaderTextureLod.cpp b/dom/canvas/WebGLExtensionShaderTextureLod.cpp index 55e023a7d588..40a70b4118ed 100644 --- a/dom/canvas/WebGLExtensionShaderTextureLod.cpp +++ b/dom/canvas/WebGLExtensionShaderTextureLod.cpp @@ -14,12 +14,25 @@ namespace mozilla { WebGLExtensionShaderTextureLod::WebGLExtensionShaderTextureLod(WebGLContext* webgl) : WebGLExtensionBase(webgl) { + MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported."); } WebGLExtensionShaderTextureLod::~WebGLExtensionShaderTextureLod() { } +bool +WebGLExtensionShaderTextureLod::IsSupported(const WebGLContext* webgl) +{ + gl::GLContext* gl = webgl->GL(); + if (gl->IsGLES() && gl->Version() >= 300) { + // ANGLE's shader translator doesn't yet translate + // WebGL1+EXT_shader_texture_lod to ES3. (Bug 1491221) + return false; + } + return gl->IsSupported(gl::GLFeature::shader_texture_lod); +} + IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionShaderTextureLod, EXT_shader_texture_lod) } // namespace mozilla diff --git a/dom/canvas/WebGLExtensions.h b/dom/canvas/WebGLExtensions.h index 5bce344c1242..cd2da32c75fb 100644 --- a/dom/canvas/WebGLExtensions.h +++ b/dom/canvas/WebGLExtensions.h @@ -251,6 +251,8 @@ public: explicit WebGLExtensionShaderTextureLod(WebGLContext*); virtual ~WebGLExtensionShaderTextureLod(); + static bool IsSupported(const WebGLContext* context); + DECL_WEBGL_EXTENSION_GOOP };