GLES1: gl(Enable|Disable)ClientState

+ Introduce the GL_OES_point_size_array extension for point size array
support.

BUG=angleproject:2306

Change-Id: Ib1a60b7dcd0497eb807f0d3c80bc95b4748d9a96
Reviewed-on: https://chromium-review.googlesource.com/1014282
Commit-Queue: Lingfeng Yang <lfy@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/validationES1.cpp b/src/libANGLE/validationES1.cpp
index dfa817b..6a7730f 100644
--- a/src/libANGLE/validationES1.cpp
+++ b/src/libANGLE/validationES1.cpp
@@ -20,7 +20,7 @@
         return false;                                                 \
     }
 
-namespace
+namespace gl
 {
 
 bool ValidateAlphaFuncCommon(gl::Context *context, gl::AlphaTestFunc func)
@@ -37,12 +37,35 @@
         case gl::AlphaTestFunc::NotEqual:
             return true;
         default:
-            context->handleError(gl::InvalidEnum() << gl::kErrorEnumNotSupported);
+            ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
             return false;
     }
 }
 
-}  // anonymous namespace
+bool ValidateClientStateCommon(gl::Context *context, gl::ClientVertexArrayType arrayType)
+{
+    ANGLE_VALIDATE_IS_GLES1(context);
+    switch (arrayType)
+    {
+        case gl::ClientVertexArrayType::Vertex:
+        case gl::ClientVertexArrayType::Normal:
+        case gl::ClientVertexArrayType::Color:
+        case gl::ClientVertexArrayType::TextureCoord:
+            return true;
+        case gl::ClientVertexArrayType::PointSize:
+            if (!context->getExtensions().pointSizeArray)
+            {
+                ANGLE_VALIDATION_ERR(context, InvalidEnum(), PointSizeArrayExtensionNotEnabled);
+                return false;
+            }
+            return true;
+        default:
+            ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidClientState);
+            return false;
+    }
+}
+
+}  // namespace gl
 
 namespace gl
 {
@@ -129,16 +152,14 @@
     return true;
 }
 
-bool ValidateDisableClientState(Context *context, GLenum array)
+bool ValidateDisableClientState(Context *context, ClientVertexArrayType arrayType)
 {
-    UNIMPLEMENTED();
-    return true;
+    return ValidateClientStateCommon(context, arrayType);
 }
 
-bool ValidateEnableClientState(Context *context, GLenum array)
+bool ValidateEnableClientState(Context *context, ClientVertexArrayType arrayType)
 {
-    UNIMPLEMENTED();
-    return true;
+    return ValidateClientStateCommon(context, arrayType);
 }
 
 bool ValidateFogf(Context *context, GLenum pname, GLfloat param)
@@ -933,4 +954,5 @@
     UNIMPLEMENTED();
     return true;
 }
-}
+
+}  // namespace gl