Bug 1609579 - WebGLSamplers should handle TEXTURE_MAX_ANISOTROPY. r=lsalzman
☠☠ backed out by 75b2943f6e6a ☠ ☠
authorJeff Gilbert <jgilbert@mozilla.com>
Thu, 16 Jan 2020 04:52:32 +0000
changeset 510436 7f724ded7131469ea1264a47871de593cf189b11
parent 510435 ce4e1638e4721dd20ddd587b082bd5eca8b0503a
child 510437 f41766fb940707b210530250d9017acca09ca40f
push id37021
push userrmaries@mozilla.com
push dateThu, 16 Jan 2020 09:46:51 +0000
treeherdermozilla-central@7541d616ff87 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsalzman
bugs1609579
milestone74.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1609579 - WebGLSamplers should handle TEXTURE_MAX_ANISOTROPY. r=lsalzman Differential Revision: https://phabricator.services.mozilla.com/D60092
dom/canvas/WebGLSampler.cpp
--- a/dom/canvas/WebGLSampler.cpp
+++ b/dom/canvas/WebGLSampler.cpp
@@ -21,17 +21,17 @@ WebGLSampler::WebGLSampler(WebGLContext*
 WebGLSampler::~WebGLSampler() {
   if (!mContext) return;
   mContext->gl->fDeleteSamplers(1, &mGLName);
 }
 
 static bool ValidateSamplerParameterParams(WebGLContext* webgl, GLenum pname,
                                            const FloatOrInt& param) {
   const auto& paramInt = param.i;
-
+  bool pnameValid = true;
   switch (pname) {
     case LOCAL_GL_TEXTURE_MIN_FILTER:
       switch (paramInt) {
         case LOCAL_GL_NEAREST:
         case LOCAL_GL_LINEAR:
         case LOCAL_GL_NEAREST_MIPMAP_NEAREST:
         case LOCAL_GL_NEAREST_MIPMAP_LINEAR:
         case LOCAL_GL_LINEAR_MIPMAP_NEAREST:
@@ -95,19 +95,32 @@ static bool ValidateSamplerParameterPara
         case LOCAL_GL_NEVER:
           return true;
 
         default:
           break;
       }
       break;
 
+    case LOCAL_GL_TEXTURE_MAX_ANISOTROPY:
+      if (webgl->IsExtensionEnabled(
+              WebGLExtensionID::EXT_texture_filter_anisotropic)) {
+        return true;
+      }
+      pnameValid = false;
+      break;
+
     default:
-      webgl->ErrorInvalidEnumInfo("pname", pname);
-      return false;
+      pnameValid = false;
+      break;
+  }
+
+  if (!pnameValid) {
+    webgl->ErrorInvalidEnumInfo("pname", pname);
+    return false;
   }
 
   webgl->ErrorInvalidEnumInfo("param", paramInt);
   return false;
 }
 
 void WebGLSampler::SamplerParameter(GLenum pname, const FloatOrInt& param) {
   if (!ValidateSamplerParameterParams(mContext, pname, param)) return;