1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #include "WebGLExtensions.h"
7 
8 #include "GLContext.h"
9 #include "mozilla/dom/WebGLRenderingContextBinding.h"
10 #include "WebGLContext.h"
11 
12 namespace mozilla {
13 
WebGLExtensionShaderTextureLod(WebGLContext * webgl)14 WebGLExtensionShaderTextureLod::WebGLExtensionShaderTextureLod(
15     WebGLContext* webgl)
16     : WebGLExtensionBase(webgl) {
17   MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");
18 }
19 
IsSupported(const WebGLContext * webgl)20 bool WebGLExtensionShaderTextureLod::IsSupported(const WebGLContext* webgl) {
21   if (webgl->IsWebGL2()) return false;
22 
23   gl::GLContext* gl = webgl->GL();
24   if (gl->IsGLES() && gl->Version() >= 300) {
25     // ANGLE's shader translator doesn't yet translate
26     // WebGL1+EXT_shader_texture_lod to ES3. (Bug 1491221)
27     return false;
28   }
29   return gl->IsSupported(gl::GLFeature::shader_texture_lod);
30 }
31 
32 }  // namespace mozilla
33