diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-02-10 20:05:18 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-02-10 20:05:18 +0000 |
commit | 89ec61e33daa9cbac200d38f7c5bb8b88046999a (patch) | |
tree | b2c86f053b4e466828ae6e241b3d5d7656616188 /include | |
parent | e55fd0f188a2b0b137ddfd9728da58481e2309ef (diff) |
Add GrGLContextInfo
Review URL: http://codereview.appspot.com/5653060/
git-svn-id: http://skia.googlecode.com/svn/trunk@3162 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrGLInterface.h | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/include/gpu/GrGLInterface.h b/include/gpu/GrGLInterface.h index 716cff9cc8..fa284d4a97 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 @@ typedef uint32_t GrGLSLVersion; // 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 void GrGLvoid; 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 @@ struct GR_API GrGLInterface : public GrRefCnt { 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); } |