Implement ES3.1 glDraw*Indirect entry points for OpenGL

BUG=angleproject:1595
TEST=dEQP-GLES31.functional.draw_indirect.*

Change-Id: I82f5d0864e70d6e7abdccf5f10330ddfa099ec62
Reviewed-on: https://chromium-review.googlesource.com/417250
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index d2d3a2b..5a4b256 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -3051,10 +3051,7 @@
     return true;
 }
 
-static bool ValidateDrawBase(ValidationContext *context,
-                             GLenum mode,
-                             GLsizei count,
-                             GLsizei primcount)
+bool ValidateDrawBase(ValidationContext *context, GLenum mode, GLsizei count)
 {
     switch (mode)
     {
@@ -3191,7 +3188,7 @@
         return false;
     }
 
-    if (!ValidateDrawBase(context, mode, count, primcount))
+    if (!ValidateDrawBase(context, mode, count))
     {
         return false;
     }
@@ -3272,13 +3269,7 @@
     return ValidateDrawArraysInstanced(context, mode, first, count, primcount);
 }
 
-bool ValidateDrawElements(ValidationContext *context,
-                          GLenum mode,
-                          GLsizei count,
-                          GLenum type,
-                          const GLvoid *indices,
-                          GLsizei primcount,
-                          IndexRange *indexRangeOut)
+bool ValidateDrawElementsBase(ValidationContext *context, GLenum type)
 {
     switch (type)
     {
@@ -3310,6 +3301,22 @@
         return false;
     }
 
+    return true;
+}
+
+bool ValidateDrawElements(ValidationContext *context,
+                          GLenum mode,
+                          GLsizei count,
+                          GLenum type,
+                          const GLvoid *indices,
+                          GLsizei primcount,
+                          IndexRange *indexRangeOut)
+{
+    if (!ValidateDrawElementsBase(context, type))
+        return false;
+
+    const State &state = context->getGLState();
+
     // Check for mapped buffers
     if (state.hasMappedBuffer(GL_ELEMENT_ARRAY_BUFFER))
     {
@@ -3361,7 +3368,7 @@
         return false;
     }
 
-    if (!ValidateDrawBase(context, mode, count, primcount))
+    if (!ValidateDrawBase(context, mode, count))
     {
         return false;
     }