Add GrGLContextInfo

Review URL: http://codereview.appspot.com/5653060/



git-svn-id: http://skia.googlecode.com/svn/trunk@3162 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrGLInterface.h b/include/gpu/GrGLInterface.h
index 716cff9..fa284d4 100644
--- a/include/gpu/GrGLInterface.h
+++ b/include/gpu/GrGLInterface.h
@@ -21,6 +21,22 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 /**
+ * Classifies GL contexts (currently as Desktop vs. ES2). This is a bitfield.
+ * A GrGLInterface (defined below) may support multiple bindings.
+ */
+enum GrGLBinding {
+    kNone_GrGLBinding = 0x0,
+
+    kDesktop_GrGLBinding = 0x01,
+    kES2_GrGLBinding = 0x02,
+
+    // for iteration of GrGLBindings
+    kLastGrGLBinding = kES2_GrGLBinding
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
+/**
  * Helpers for glGetString()
  */
 
@@ -34,11 +50,13 @@
 
 // these variants assume caller already has a string from glGetString()
 GrGLVersion GrGLGetVersionFromString(const char* versionString);
+GrGLBinding GrGLGetBindingInUseFromString(const char* versionString);
 GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString);
 bool GrGLHasExtensionFromString(const char* ext, const char* extensionString);
 
 // these variants call glGetString()
 bool GrGLHasExtension(const GrGLInterface*, const char* ext);
+GrGLBinding GrGLGetBindingInUse(const GrGLInterface*);
 GrGLVersion GrGLGetVersion(const GrGLInterface*);
 GrGLSLVersion GrGLGetGLSLVersion(const GrGLInterface*);
 
@@ -109,11 +127,6 @@
 typedef long GrGLintptr;
 typedef long GrGLsizeiptr;
 
-enum GrGLBinding {
-    kDesktop_GrGLBinding = 0x01,
-    kES2_GrGLBinding = 0x02
-};
-
 extern "C" {
     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLActiveTextureProc)(GrGLenum texture);
     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLAttachShaderProc)(GrGLuint program, GrGLuint shader);
@@ -267,7 +280,11 @@
 
     GrGLInterface();
 
-    bool validate() const;
+    // Validates that the GrGLInterface supports a binding. This means that
+    // the GrGLinterface advertises the binding in fBindingsExported and all
+    // the necessary function pointers have been initialized.
+    bool validate(GrGLBinding binding) const;
+
     bool supportsDesktop() const {
         return 0 != (kDesktop_GrGLBinding & fBindingsExported);
     }