Use indexed extensions on ES3.

R=jvanverth@google.com

Author: bsalomon@google.com

Review URL: https://chromiumcodereview.appspot.com/23359002

git-svn-id: http://skia.googlecode.com/svn/trunk/src@10899 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/gl/GrGLExtensions.cpp b/gpu/gl/GrGLExtensions.cpp
index e886aff..5ebab14 100644
--- a/gpu/gl/GrGLExtensions.cpp
+++ b/gpu/gl/GrGLExtensions.cpp
@@ -26,15 +26,15 @@
     if (NULL == getString) {
         return false;
     }
-    bool indexed = false;
-    if (kDesktop_GrGLBinding == binding) {
-        const GrGLubyte* verString = getString(GR_GL_VERSION);
-        if (NULL == verString) {
-            return false;
-        }
-        GrGLVersion version = GrGLGetVersionFromString((const char*) verString);
-        indexed = version >= GR_GL_VER(3, 0);
+
+    // glGetStringi and indexed extensions were added in version 3.0 of desktop GL and ES.
+    const GrGLubyte* verString = getString(GR_GL_VERSION);
+    if (NULL == verString) {
+        return false;
     }
+    GrGLVersion version = GrGLGetVersionFromString((const char*) verString);
+    bool indexed = version >= GR_GL_VER(3, 0);
+
     if (indexed) {
         if (NULL == getStringi || NULL == getIntegerv) {
             return false;
diff --git a/gpu/gl/GrGLInterface.cpp b/gpu/gl/GrGLInterface.cpp
index d69f5c7..a5ddd9f 100644
--- a/gpu/gl/GrGLInterface.cpp
+++ b/gpu/gl/GrGLInterface.cpp
@@ -363,7 +363,8 @@
         }
     }
 
-    if (kDesktop_GrGLBinding == binding && glVer >= GR_GL_VER(3, 0)) {
+    // glGetStringi was added in version 3.0 of both desktop and ES.
+    if (glVer >= GR_GL_VER(3, 0)) {
         if (NULL == fGetStringi) {
             return false;
         }
diff --git a/gpu/gl/android/GrGLCreateNativeInterface_android.cpp b/gpu/gl/android/GrGLCreateNativeInterface_android.cpp
index 5ad867c..05c93a3 100644
--- a/gpu/gl/android/GrGLCreateNativeInterface_android.cpp
+++ b/gpu/gl/android/GrGLCreateNativeInterface_android.cpp
@@ -21,7 +21,14 @@
     static SkAutoTUnref<GrGLInterface> glInterface;
     if (!glInterface.get()) {
         GrGLExtensions extensions;
-        if (!extensions.init(kES_GrGLBinding, glGetString, NULL, glGetIntegerv)) {
+        GrGLGetStringiProc getStringi;
+#if GL_ES_VERSION_3_0
+        getStringi = glGetStringi;
+#else
+        getStringi = (GrGLGetStringiProc) eglGetProcAddress("glGetStringi");
+#endif
+
+        if (!extensions.init(kES_GrGLBinding, glGetString, getStringi, glGetIntegerv)) {
             return NULL;
         }
         const char* verStr = reinterpret_cast<const char*>(glGetString(GR_GL_VERSION));
@@ -80,6 +87,7 @@
         interface->fGetShaderInfoLog = glGetShaderInfoLog;
         interface->fGetShaderiv = glGetShaderiv;
         interface->fGetString = glGetString;
+        interface->fGetStringi = getStringi; // located above
         interface->fGetUniformLocation = glGetUniformLocation;
         interface->fLineWidth = glLineWidth;
         interface->fLinkProgram = glLinkProgram;