Allow enabling GL_EXT_texture_filter_anisotropic.

BUG=angleproject:1721

Change-Id: I7cbc734915cde7d09165a3fcfe9a6bc0d7149aff
Reviewed-on: https://chromium-review.googlesource.com/445959
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Caps.cpp b/src/libANGLE/Caps.cpp
index 8888831..e74cf33 100644
--- a/src/libANGLE/Caps.cpp
+++ b/src/libANGLE/Caps.cpp
@@ -599,7 +599,7 @@
         map["GL_EXT_texture_storage"] = esOnlyExtension(&Extensions::textureStorage);
         map["GL_OES_texture_npot"] = enableableExtension(&Extensions::textureNPOT);
         map["GL_EXT_draw_buffers"] = enableableExtension(&Extensions::drawBuffers);
-        map["GL_EXT_texture_filter_anisotropic"] = esOnlyExtension(&Extensions::textureFilterAnisotropic);
+        map["GL_EXT_texture_filter_anisotropic"] = enableableExtension(&Extensions::textureFilterAnisotropic);
         map["GL_EXT_occlusion_query_boolean"] = esOnlyExtension(&Extensions::occlusionQueryBoolean);
         map["GL_NV_fence"] = esOnlyExtension(&Extensions::fence);
         map["GL_ANGLE_timer_query"] = esOnlyExtension(&Extensions::timerQuery);
diff --git a/src/libANGLE/ContextState.cpp b/src/libANGLE/ContextState.cpp
index ad0c036..5399a76 100644
--- a/src/libANGLE/ContextState.cpp
+++ b/src/libANGLE/ContextState.cpp
@@ -312,7 +312,7 @@
             return true;
         }
         case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
-            if (!getExtensions().maxTextureAnisotropy)
+            if (!getExtensions().textureFilterAnisotropic)
             {
                 return false;
             }
diff --git a/src/tests/gl_tests/WebGLCompatibilityTest.cpp b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
index 844cdb8..d99c51d 100644
--- a/src/tests/gl_tests/WebGLCompatibilityTest.cpp
+++ b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
@@ -149,6 +149,45 @@
     }
 }
 
+// Test enabling the GL_EXT_texture_filter_anisotropic extension
+TEST_P(WebGLCompatibilityTest, EnableExtensionTextureFilterAnisotropic)
+{
+    EXPECT_FALSE(extensionEnabled("GL_EXT_texture_filter_anisotropic"));
+
+    GLfloat maxAnisotropy = 0.0f;
+    glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropy);
+    EXPECT_GL_ERROR(GL_INVALID_ENUM);
+
+    GLTexture texture;
+    glBindTexture(GL_TEXTURE_2D, texture.get());
+    ASSERT_GL_NO_ERROR();
+
+    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0f);
+    EXPECT_GL_ERROR(GL_INVALID_ENUM);
+
+    GLfloat currentAnisotropy = 0.0f;
+    glGetTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, &currentAnisotropy);
+    EXPECT_GL_ERROR(GL_INVALID_ENUM);
+
+    if (extensionRequestable("GL_EXT_texture_filter_anisotropic"))
+    {
+        glRequestExtensionANGLE("GL_EXT_texture_filter_anisotropic");
+        EXPECT_GL_NO_ERROR();
+        EXPECT_TRUE(extensionEnabled("GL_EXT_texture_filter_anisotropic"));
+
+        glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropy);
+        ASSERT_GL_NO_ERROR();
+        EXPECT_GE(maxAnisotropy, 2.0f);
+
+        glGetTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, &currentAnisotropy);
+        ASSERT_GL_NO_ERROR();
+        EXPECT_EQ(1.0f, currentAnisotropy);
+
+        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 2.0f);
+        ASSERT_GL_NO_ERROR();
+    }
+}
+
 // Verify that shaders are of a compatible spec when the extension is enabled.
 TEST_P(WebGLCompatibilityTest, ExtensionCompilerSpec)
 {