Validate that VAO functions are present in ES2 interfaces and add bit to caps indicating VAO support.
Review URL: https://codereview.chromium.org/12447003

git-svn-id: http://skia.googlecode.com/svn/trunk@7979 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index a2f89f0..82b042f 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -37,6 +37,7 @@
     fImagingSupport = false;
     fTwoFormatLimit = false;
     fFragCoordsConventionSupport = false;
+    fVertexArrayObjectSupport = false;
     fUseNonVBOVertexAndIndexDynamicData = false;
     fIsCoreProfile = false;
 }
@@ -69,6 +70,7 @@
     fImagingSupport = caps.fImagingSupport;
     fTwoFormatLimit = caps.fTwoFormatLimit;
     fFragCoordsConventionSupport = caps.fFragCoordsConventionSupport;
+    fVertexArrayObjectSupport = caps.fVertexArrayObjectSupport;
     fUseNonVBOVertexAndIndexDynamicData = caps.fUseNonVBOVertexAndIndexDynamicData;
     fIsCoreProfile = caps.fIsCoreProfile;
 
@@ -185,6 +187,13 @@
         fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_BIT);
     }
 
+    if (kDesktop_GrGLBinding == binding) {
+        fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) ||
+                                    ctxInfo.hasExtension("GL_ARB_vertex_array_object");
+    } else {
+        fVertexArrayObjectSupport = ctxInfo.hasExtension("GL_OES_vertex_array_object");
+    }
+
     this->initFSAASupport(ctxInfo, gli);
     this->initStencilFormats(ctxInfo);
 }
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 31edd65..9168956 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -219,12 +219,15 @@
     /// Is GL_ARB_fragment_coord_conventions supported?
     bool fragCoordConventionsSupport() const { return fFragCoordsConventionSupport; }
 
-    // Use indices or vertices in CPU arrays rather than VBOs for dynamic content.
+    /// Is there support for Vertex Array Objects?
+    bool vertexArrayObjectSupport() const { return fVertexArrayObjectSupport; }
+
+    /// Use indices or vertices in CPU arrays rather than VBOs for dynamic content.
     bool useNonVBOVertexAndIndexDynamicData() const {
         return fUseNonVBOVertexAndIndexDynamicData;
     }
 
-    // Does ReadPixels support the provided format/type combo?
+    /// Does ReadPixels support the provided format/type combo?
     bool readPixelsSupported(const GrGLInterface* intf,
                              GrGLenum format,
                              GrGLenum type) const;
@@ -304,6 +307,7 @@
     bool fImagingSupport  : 1;
     bool fTwoFormatLimit : 1;
     bool fFragCoordsConventionSupport : 1;
+    bool fVertexArrayObjectSupport : 1;
     bool fUseNonVBOVertexAndIndexDynamicData : 1;
     bool fIsCoreProfile : 1;
 };
diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp
index ea9c29e..0119a1e 100644
--- a/src/gpu/gl/GrGLInterface.cpp
+++ b/src/gpu/gl/GrGLInterface.cpp
@@ -358,7 +358,6 @@
             }
         }
     } else {
-#if 0 // Remove this #if once Chromium interfaces set these pointers
         if (extensions.has("GL_OES_vertex_array_object")) {
             if (NULL == fBindVertexArray ||
                 NULL == fDeleteVertexArrays ||
@@ -366,7 +365,6 @@
                 return false;
             }
         }
-#endif
     }
 
     return true;