WebGL2 Compat: having no 0 divisor is now valid

BUG=angleproject:TBD

Change-Id: Icb19a685290f4313ad567391cab5152eda91a346
Reviewed-on: https://chromium-review.googlesource.com/544545
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index 97c8d85..5fa59c1 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -890,7 +890,7 @@
     return (primcount > 0);
 }
 
-bool ValidateDrawInstancedANGLEAndWebGL(ValidationContext *context)
+bool ValidateDrawInstancedANGLE(ValidationContext *context)
 {
     // Verify there is at least one active attribute with a divisor of zero
     const State &state = context->getGLState();
@@ -2849,13 +2849,7 @@
                                  GLsizei count,
                                  GLsizei primcount)
 {
-    if (!ValidateDrawArraysInstancedBase(context, mode, first, count, primcount))
-    {
-        return false;
-    }
-
-    return !context->getExtensions().webglCompatibility ||
-           ValidateDrawInstancedANGLEAndWebGL(context);
+    return ValidateDrawArraysInstancedBase(context, mode, first, count, primcount);
 }
 
 bool ValidateDrawArraysInstancedANGLE(Context *context,
@@ -2869,7 +2863,7 @@
         return false;
     }
 
-    return ValidateDrawInstancedANGLEAndWebGL(context);
+    return ValidateDrawInstancedANGLE(context);
 }
 
 bool ValidateDrawElementsBase(ValidationContext *context, GLenum type)
@@ -3054,13 +3048,7 @@
                                          const void *indices,
                                          GLsizei primcount)
 {
-    if (!ValidateDrawElementsInstancedBase(context, mode, count, type, indices, primcount))
-    {
-        return false;
-    }
-
-    return !context->getExtensions().webglCompatibility ||
-           ValidateDrawInstancedANGLEAndWebGL(context);
+    return ValidateDrawElementsInstancedBase(context, mode, count, type, indices, primcount);
 }
 
 bool ValidateDrawElementsInstancedANGLE(Context *context,
@@ -3075,7 +3063,7 @@
         return false;
     }
 
-    return ValidateDrawInstancedANGLEAndWebGL(context);
+    return ValidateDrawInstancedANGLE(context);
 }
 
 bool ValidateFramebufferTextureBase(Context *context,
diff --git a/src/tests/gl_tests/WebGLCompatibilityTest.cpp b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
index b810144..d32eebc 100644
--- a/src/tests/gl_tests/WebGLCompatibilityTest.cpp
+++ b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
@@ -1009,7 +1009,7 @@
     ASSERT_GL_NO_ERROR();
 }
 
-// Test that at least one attribute has a zero divisor for WebGL
+// Test that having no attributes with a zero divisor is valid in WebGL2
 TEST_P(WebGL2CompatibilityTest, InstancedDrawZeroDivisor)
 {
     const std::string &vert =
@@ -1040,12 +1040,8 @@
     glEnableVertexAttribArray(posLocation);
     glVertexAttribDivisor(posLocation, 1);
 
-    // Test touching the last element is valid.
     glVertexAttribPointer(0, 1, GL_UNSIGNED_BYTE, GL_FALSE, 0, nullptr);
     glDrawArraysInstanced(GL_POINTS, 0, 1, 4);
-    ASSERT_GL_ERROR(GL_INVALID_OPERATION);
-
-    glVertexAttribDivisor(posLocation, 0);
     ASSERT_GL_NO_ERROR();
 }