Implement robust the GetIntegeri_v entry point.

BUG=angleproject:1354

Change-Id: I408d0e78064aa4e493d6ca66565384ac585040e1
Reviewed-on: https://chromium-review.googlesource.com/401400
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/validationES3.cpp b/src/libANGLE/validationES3.cpp
index 1581b75..2f93651 100644
--- a/src/libANGLE/validationES3.cpp
+++ b/src/libANGLE/validationES3.cpp
@@ -1930,6 +1930,37 @@
     return ValidateIndexedStateQuery(context, target, index, nullptr);
 }
 
+bool ValidateGetIntegeri_vRobustANGLE(ValidationContext *context,
+                                      GLenum target,
+                                      GLuint index,
+                                      GLsizei bufSize,
+                                      GLsizei *length,
+                                      GLint *data)
+{
+    if (!context->getGLVersion().isES3OrGreater())
+    {
+        context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3.0"));
+        return false;
+    }
+
+    if (!ValidateRobustEntryPoint(context, bufSize))
+    {
+        return false;
+    }
+
+    if (!ValidateIndexedStateQuery(context, target, index, length))
+    {
+        return false;
+    }
+
+    if (!ValidateRobustBufferSize(context, bufSize, *length))
+    {
+        return false;
+    }
+
+    return true;
+}
+
 bool ValidateGetInteger64i_v(ValidationContext *context, GLenum target, GLuint index, GLint64 *data)
 {
     if (!context->getGLVersion().isES3OrGreater())
diff --git a/src/libANGLE/validationES3.h b/src/libANGLE/validationES3.h
index d6ed8e3..414434b 100644
--- a/src/libANGLE/validationES3.h
+++ b/src/libANGLE/validationES3.h
@@ -340,6 +340,12 @@
                                GLuint index,
                                GLsizei *length);
 bool ValidateGetIntegeri_v(ValidationContext *context, GLenum target, GLuint index, GLint *data);
+bool ValidateGetIntegeri_vRobustANGLE(ValidationContext *context,
+                                      GLenum target,
+                                      GLuint index,
+                                      GLsizei bufSize,
+                                      GLsizei *length,
+                                      GLint *data);
 bool ValidateGetInteger64i_v(ValidationContext *context,
                              GLenum target,
                              GLuint index,
diff --git a/src/libGLESv2/entry_points_gles_2_0_ext.cpp b/src/libGLESv2/entry_points_gles_2_0_ext.cpp
index 1ef764e..0afaf83 100644
--- a/src/libGLESv2/entry_points_gles_2_0_ext.cpp
+++ b/src/libGLESv2/entry_points_gles_2_0_ext.cpp
@@ -2681,7 +2681,19 @@
         "(GLenum target = 0x%X, GLuint index = %u, GLsizei bufsize = %d, GLsizei* length = "
         "0x%0.8p, GLint* data = 0x%0.8p)",
         target, index, bufSize, length, data);
-    UNIMPLEMENTED();
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        GLsizei numParams = 0;
+        if (!ValidateGetIntegeri_vRobustANGLE(context, target, index, bufSize, &numParams, data))
+        {
+            return;
+        }
+
+        context->getIntegeri_v(target, index, data);
+        SetRobustLengthParam(length, numParams);
+    }
 }
 
 ANGLE_EXPORT void GL_APIENTRY GetInternalformativRobustANGLE(GLenum target,