ES31: Add glGetProgramInterfaceiv API

Add API entry and validation checks(GLES 3.1 section 7.3).
Add the first 4 interfaces(PROGRAM_INPUT, PROGRAM_OUTPUT,
UNIFORM and UNIFORM_BLOCK) implementation.

BUG=angleproject:1920
TEST=angle_end2end_tests:ProgramInterfaceTestES31.*

Change-Id: Iab80ba332e2a5e2b3e677039359e60a420e3d6b0
Reviewed-on: https://chromium-review.googlesource.com/642729
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/common/utilities.cpp b/src/common/utilities.cpp
index ab1c3ba..03cb57c 100644
--- a/src/common/utilities.cpp
+++ b/src/common/utilities.cpp
@@ -773,6 +773,20 @@
 }
 
 template <>
+GLint ConvertToGLint(uint32_t param)
+{
+    uint32_t max = static_cast<uint32_t>(std::numeric_limits<GLint>::max());
+    return static_cast<GLint>(param >= max ? max : param);
+}
+
+template <>
+GLint ConvertToGLint(uint64_t param)
+{
+    uint64_t max = static_cast<uint64_t>(std::numeric_limits<GLint>::max());
+    return static_cast<GLint>(param >= max ? max : param);
+}
+
+template <>
 GLint ConvertToGLint(GLfloat param)
 {
     return iround<GLint>(param);
diff --git a/src/common/utilities.h b/src/common/utilities.h
index 1f007ca..b3d5d7d 100644
--- a/src/common/utilities.h
+++ b/src/common/utilities.h
@@ -74,6 +74,11 @@
 template <typename outT> outT uiround(GLfloat value) { return static_cast<outT>(value + 0.5f); }
 
 // Helper for converting arbitrary GL types to other GL types used in queries and state setting
+
+// TODO(jie.a.chen@intel.com): Add the conversion rule for all helpers as the spec requires:
+// "If a value is so large in magnitude that it cannot be represented with the requested type,"
+// "then the nearest value representable using the requested type is returned."
+
 template <typename ParamType>
 GLuint ConvertToGLuint(ParamType param)
 {
@@ -87,6 +92,13 @@
 {
     return static_cast<GLint>(param);
 }
+
+template <>
+GLint ConvertToGLint(uint32_t param);
+
+template <>
+GLint ConvertToGLint(uint64_t param);
+
 template <>
 GLint ConvertToGLint(GLfloat param);