Home | History | Annotate | Download | only in include
      1 /*
      2     Copyright 2011 Google Inc.
      3 
      4     Licensed under the Apache License, Version 2.0 (the "License");
      5     you may not use this file except in compliance with the License.
      6     You may obtain a copy of the License at
      7 
      8          http://www.apache.org/licenses/LICENSE-2.0
      9 
     10     Unless required by applicable law or agreed to in writing, software
     11     distributed under the License is distributed on an "AS IS" BASIS,
     12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13     See the License for the specific language governing permissions and
     14     limitations under the License.
     15  */
     16 
     17 
     18 #ifndef GrGLInterface_DEFINED
     19 #define GrGLInterface_DEFINED
     20 
     21 #include "GrGLConfig.h"
     22 #include "GrTypes.h"
     23 
     24 #if !defined(GR_GL_FUNCTION_TYPE)
     25     #define GR_GL_FUNCTION_TYPE
     26 #endif
     27 
     28 ////////////////////////////////////////////////////////////////////////////////
     29 
     30 /**
     31  * Helpers for glGetString()
     32  */
     33 
     34 void gl_version_from_string(int* major, int* minor,
     35                             const char* versionString);
     36 bool has_gl_extension_from_string(const char* ext,
     37                                   const char* extensionString);
     38 
     39 bool has_gl_extension(const char* ext);
     40 void gl_version(int* major, int* minor);
     41 
     42 
     43 ////////////////////////////////////////////////////////////////////////////////
     44 
     45 /*
     46  * Routines managing the global interface used to invoke OpenGL calls.
     47  */
     48 struct GrGLInterface;
     49 GR_API GrGLInterface* GrGLGetGLInterface();
     50 GR_API void GrGLSetGLInterface(GrGLInterface* gl_interface);
     51 
     52 /*
     53  * This is called when GrGLSetGLInterface() hasn't been called before creating a
     54  * GrGpuGL object. It provides a default implementation. The actual implementation
     55  * depends on which GrGLDefaultInterface_*.cpp has been linked. There are some
     56  * platform-specific implementations provided as well as
     57  * GrGLDefaultInterface_none.cpp which does nothing (effectively requiring an
     58  * explicit GrGLSetGLInterface call by the host).
     59  */
     60 void GrGLSetDefaultGLInterface();
     61 
     62 typedef unsigned int GrGLenum;
     63 typedef unsigned char GrGLboolean;
     64 typedef unsigned int GrGLbitfield;
     65 typedef signed char GrGLbyte;
     66 typedef char GrGLchar;
     67 typedef short GrGLshort;
     68 typedef int GrGLint;
     69 typedef int GrGLsizei;
     70 typedef unsigned char GrGLubyte;
     71 typedef unsigned short GrGLushort;
     72 typedef unsigned int GrGLuint;
     73 typedef float GrGLfloat;
     74 typedef float GrGLclampf;
     75 typedef double GrGLdouble;
     76 typedef double GrGLclampd;
     77 typedef void GrGLvoid;
     78 typedef long GrGLintptr;
     79 typedef long GrGLsizeiptr;
     80 
     81 enum GrGLBinding {
     82     kDesktop_GrGLBinding = 0x01,
     83     kES1_GrGLBinding = 0x02,
     84     kES2_GrGLBinding = 0x04
     85 };
     86 
     87 extern "C" {
     88     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLActiveTextureProc)(GrGLenum texture);
     89     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLAttachShaderProc)(GrGLuint program, GrGLuint shader);
     90     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindAttribLocationProc)(GrGLuint program, GrGLuint index, const char* name);
     91     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindBufferProc)(GrGLenum target, GrGLuint buffer);
     92     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindTextureProc)(GrGLenum target, GrGLuint texture);
     93     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBlendColorProc)(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha);
     94     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBlendFuncProc)(GrGLenum sfactor, GrGLenum dfactor);
     95     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBufferDataProc)(GrGLenum target, GrGLsizeiptr size, const GrGLvoid* data, GrGLenum usage);
     96     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBufferSubDataProc)(GrGLenum target, GrGLintptr offset, GrGLsizeiptr size, const GrGLvoid* data);
     97     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLClearProc)(GrGLbitfield mask);
     98     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLClearColorProc)(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha);
     99     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLClearStencilProc)(GrGLint s);
    100     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLClientActiveTextureProc)(GrGLenum texture);
    101     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLColor4ubProc)(GrGLubyte red, GrGLubyte green, GrGLubyte blue, GrGLubyte alpha);
    102     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLColorMaskProc)(GrGLboolean red, GrGLboolean green, GrGLboolean blue, GrGLboolean alpha);
    103     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLColorPointerProc)(GrGLint size, GrGLenum type, GrGLsizei stride, const GrGLvoid* pointer);
    104     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLCompileShaderProc)(GrGLuint shader);
    105     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLCompressedTexImage2DProc)(GrGLenum target, GrGLint level, GrGLenum internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLsizei imageSize, const GrGLvoid* data);
    106     typedef GrGLuint (GR_GL_FUNCTION_TYPE *GrGLCreateProgramProc)(void);
    107     typedef GrGLuint (GR_GL_FUNCTION_TYPE *GrGLCreateShaderProc)(GrGLenum type);
    108     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLCullFaceProc)(GrGLenum mode);
    109     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteBuffersProc)(GrGLsizei n, const GrGLuint* buffers);
    110     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteProgramProc)(GrGLuint program);
    111     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteShaderProc)(GrGLuint shader);
    112     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteTexturesProc)(GrGLsizei n, const GrGLuint* textures);
    113     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDepthMaskProc)(GrGLboolean flag);
    114     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDisableProc)(GrGLenum cap);
    115     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDisableClientStateProc)(GrGLenum array);
    116     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDisableVertexAttribArrayProc)(GrGLuint index);
    117     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDrawArraysProc)(GrGLenum mode, GrGLint first, GrGLsizei count);
    118     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDrawElementsProc)(GrGLenum mode, GrGLsizei count, GrGLenum type, const GrGLvoid* indices);
    119     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLEnableProc)(GrGLenum cap);
    120     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLEnableClientStateProc)(GrGLenum cap);
    121     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLEnableVertexAttribArrayProc)(GrGLuint index);
    122     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLFrontFaceProc)(GrGLenum mode);
    123     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenBuffersProc)(GrGLsizei n, GrGLuint* buffers);
    124     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenTexturesProc)(GrGLsizei n, GrGLuint* textures);
    125     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetBufferParameterivProc)(GrGLenum target, GrGLenum pname, GrGLint* params);
    126     typedef GrGLenum (GR_GL_FUNCTION_TYPE *GrGLGetErrorProc)(void);
    127     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetIntegervProc)(GrGLenum pname, GrGLint* params);
    128     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetProgramInfoLogProc)(GrGLuint program, GrGLsizei bufsize, GrGLsizei* length, char* infolog);
    129     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetProgramivProc)(GrGLuint program, GrGLenum pname, GrGLint* params);
    130     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetShaderInfoLogProc)(GrGLuint shader, GrGLsizei bufsize, GrGLsizei* length, char* infolog);
    131     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetShaderivProc)(GrGLuint shader, GrGLenum pname, GrGLint* params);
    132     typedef const GrGLubyte* (GR_GL_FUNCTION_TYPE *GrGLGetStringProc)(GrGLenum name);
    133     typedef GrGLint (GR_GL_FUNCTION_TYPE *GrGLGetUniformLocationProc)(GrGLuint program, const char* name);
    134     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLLineWidthProc)(GrGLfloat width);
    135     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLLinkProgramProc)(GrGLuint program);
    136     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLLoadMatrixfProc)(const GrGLfloat* m);
    137     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLMatrixModeProc)(GrGLenum mode);
    138     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLPixelStoreiProc)(GrGLenum pname, GrGLint param);
    139     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLPointSizeProc)(GrGLfloat size);
    140     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLReadPixelsProc)(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLvoid* pixels);
    141     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLScissorProc)(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height);
    142     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLShadeModelProc)(GrGLenum mode);
    143     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLShaderSourceProc)(GrGLuint shader, GrGLsizei count, const char** str, const GrGLint* length);
    144     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilFuncProc)(GrGLenum func, GrGLint ref, GrGLuint mask);
    145     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilFuncSeparateProc)(GrGLenum face, GrGLenum func, GrGLint ref, GrGLuint mask);
    146     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilMaskProc)(GrGLuint mask);
    147     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilMaskSeparateProc)(GrGLenum face, GrGLuint mask);
    148     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilOpProc)(GrGLenum fail, GrGLenum zfail, GrGLenum zpass);
    149     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilOpSeparateProc)(GrGLenum face, GrGLenum fail, GrGLenum zfail, GrGLenum zpass);
    150     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLTexCoordPointerProc)(GrGLint size, GrGLenum type, GrGLsizei stride, const GrGLvoid* pointer);
    151     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLTexEnviProc)(GrGLenum target, GrGLenum pname, GrGLint param);
    152     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLTexImage2DProc)(GrGLenum target, GrGLint level, GrGLint internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLenum format, GrGLenum type, const GrGLvoid* pixels);
    153     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLTexParameteriProc)(GrGLenum target, GrGLenum pname, GrGLint param);
    154     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLTexSubImage2DProc)(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, const GrGLvoid* pixels);
    155     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform1fProc)(GrGLint location, GrGLfloat v0);
    156     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform1iProc)(GrGLint location, GrGLint v0);
    157     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform1fvProc)(GrGLint location, GrGLsizei count, const GrGLfloat* v);
    158     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform1ivProc)(GrGLint location, GrGLsizei count, const GrGLint* v);
    159     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform2fProc)(GrGLint location, GrGLfloat v0, GrGLfloat v1);
    160     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform2iProc)(GrGLint location, GrGLint v0, GrGLint v1);
    161     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform2fvProc)(GrGLint location, GrGLsizei count, const GrGLfloat* v);
    162     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform2ivProc)(GrGLint location, GrGLsizei count, const GrGLint* v);
    163     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform3fProc)(GrGLint location, GrGLfloat v0, GrGLfloat v1, GrGLfloat v2);
    164     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform3iProc)(GrGLint location, GrGLint v0, GrGLint v1, GrGLint v2);
    165     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform3fvProc)(GrGLint location, GrGLsizei count, const GrGLfloat* v);
    166     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform3ivProc)(GrGLint location, GrGLsizei count, const GrGLint* v);
    167     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform4fProc)(GrGLint location, GrGLfloat v0, GrGLfloat v1, GrGLfloat v2, GrGLfloat v3);
    168     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform4iProc)(GrGLint location, GrGLint v0, GrGLint v1, GrGLint v2, GrGLint v3);
    169     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform4fvProc)(GrGLint location, GrGLsizei count, const GrGLfloat* v);
    170     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform4ivProc)(GrGLint location, GrGLsizei count, const GrGLint* v);
    171     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniformMatrix2fvProc)(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value);
    172     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniformMatrix3fvProc)(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value);
    173     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniformMatrix4fvProc)(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value);
    174     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUseProgramProc)(GrGLuint program);
    175     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLVertexAttrib4fvProc)(GrGLuint indx, const GrGLfloat* values);
    176     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLVertexAttribPointerProc)(GrGLuint indx, GrGLint size, GrGLenum type, GrGLboolean normalized, GrGLsizei stride, const GrGLvoid* ptr);
    177     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLVertexPointerProc)(GrGLint size, GrGLenum type, GrGLsizei stride, const GrGLvoid* pointer);
    178     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLViewportProc)(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height);
    179 
    180     // FBO Extension Functions
    181     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindFramebufferProc)(GrGLenum target, GrGLuint framebuffer);
    182     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindRenderbufferProc)(GrGLenum target, GrGLuint renderbuffer);
    183     typedef GrGLenum (GR_GL_FUNCTION_TYPE *GrGLCheckFramebufferStatusProc)(GrGLenum target);
    184     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteFramebuffersProc)(GrGLsizei n, const GrGLuint *framebuffers);
    185     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteRenderbuffersProc)(GrGLsizei n, const GrGLuint *renderbuffers);
    186     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLFramebufferRenderbufferProc)(GrGLenum target, GrGLenum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer);
    187     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLFramebufferTexture2DProc)(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level);
    188     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenFramebuffersProc)(GrGLsizei n, GrGLuint *framebuffers);
    189     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenRenderbuffersProc)(GrGLsizei n, GrGLuint *renderbuffers);
    190     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLRenderbufferStorageProc)(GrGLenum target, GrGLenum internalformat, GrGLsizei width, GrGLsizei height);
    191 
    192     // Multisampling Extension Functions
    193     // same prototype for ARB_FBO, EXT_FBO, GL 3.0, & Apple ES extension
    194     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLRenderbufferStorageMultisampleProc)(GrGLenum target, GrGLsizei samples, GrGLenum internalformat, GrGLsizei width, GrGLsizei height);
    195     // desktop: ext_fbo_blit, arb_fbo, gl 3.0
    196     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBlitFramebufferProc)(GrGLint srcX0, GrGLint srcY0, GrGLint srcX1, GrGLint srcY1, GrGLint dstX0, GrGLint dstY0, GrGLint dstX1, GrGLint dstY1, GrGLbitfield mask, GrGLenum filter);
    197     // apple's es extension
    198     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLResolveMultisampleFramebufferProc)();
    199 
    200     // Buffer mapping (extension in ES).
    201     typedef GrGLvoid* (GR_GL_FUNCTION_TYPE *GrGLMapBufferProc)(GrGLenum target, GrGLenum access);
    202     typedef GrGLboolean (GR_GL_FUNCTION_TYPE *GrGLUnmapBufferProc)(GrGLenum target);
    203 
    204     // Dual source blending
    205     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindFragDataLocationIndexedProc)(GrGLuint program, GrGLuint colorNumber, GrGLuint index, const GrGLchar * name);
    206 }  // extern "C"
    207 
    208 /*
    209  * The following interface exports the OpenGL entry points used by the system.
    210  * Use of OpenGL calls is disallowed.  All calls should be invoked through
    211  * the global instance of this struct, defined above.
    212  *
    213  * IMPORTANT NOTE: The OpenGL entry points exposed here include both core GL
    214  * functions, and extensions.  The system assumes that the address of the
    215  * extension pointer will be valid across contexts.
    216  */
    217 struct GrGLInterface {
    218     bool validate(GrEngine engine) const;
    219 
    220     // Indicator variable specifying the type of GL implementation
    221     // exported:  GLES{1|2} or Desktop.
    222     GrGLBinding fBindingsExported;
    223 
    224     GrGLActiveTextureProc fActiveTexture;
    225     GrGLAttachShaderProc fAttachShader;
    226     GrGLBindAttribLocationProc fBindAttribLocation;
    227     GrGLBindBufferProc fBindBuffer;
    228     GrGLBindTextureProc fBindTexture;
    229     GrGLBlendColorProc fBlendColor;
    230     GrGLBlendFuncProc fBlendFunc;
    231     GrGLBufferDataProc fBufferData;
    232     GrGLBufferSubDataProc fBufferSubData;
    233     GrGLClearProc fClear;
    234     GrGLClearColorProc fClearColor;
    235     GrGLClearStencilProc fClearStencil;
    236     GrGLClientActiveTextureProc fClientActiveTexture;
    237     GrGLColor4ubProc fColor4ub;
    238     GrGLColorMaskProc fColorMask;
    239     GrGLColorPointerProc fColorPointer;
    240     GrGLCompileShaderProc fCompileShader;
    241     GrGLCompressedTexImage2DProc fCompressedTexImage2D;
    242     GrGLCreateProgramProc fCreateProgram;
    243     GrGLCreateShaderProc fCreateShader;
    244     GrGLCullFaceProc fCullFace;
    245     GrGLDeleteBuffersProc fDeleteBuffers;
    246     GrGLDeleteProgramProc fDeleteProgram;
    247     GrGLDeleteShaderProc fDeleteShader;
    248     GrGLDeleteTexturesProc fDeleteTextures;
    249     GrGLDepthMaskProc fDepthMask;
    250     GrGLDisableProc fDisable;
    251     GrGLDisableClientStateProc fDisableClientState;
    252     GrGLDisableVertexAttribArrayProc fDisableVertexAttribArray;
    253     GrGLDrawArraysProc fDrawArrays;
    254     GrGLDrawElementsProc fDrawElements;
    255     GrGLEnableProc fEnable;
    256     GrGLEnableClientStateProc fEnableClientState;
    257     GrGLEnableVertexAttribArrayProc fEnableVertexAttribArray;
    258     GrGLFrontFaceProc fFrontFace;
    259     GrGLGenBuffersProc fGenBuffers;
    260     GrGLGenTexturesProc fGenTextures;
    261     GrGLGetBufferParameterivProc fGetBufferParameteriv;
    262     GrGLGetErrorProc fGetError;
    263     GrGLGetIntegervProc fGetIntegerv;
    264     GrGLGetProgramInfoLogProc fGetProgramInfoLog;
    265     GrGLGetProgramivProc fGetProgramiv;
    266     GrGLGetShaderInfoLogProc fGetShaderInfoLog;
    267     GrGLGetShaderivProc fGetShaderiv;
    268     GrGLGetStringProc fGetString;
    269     GrGLGetUniformLocationProc fGetUniformLocation;
    270     GrGLLineWidthProc fLineWidth;
    271     GrGLLinkProgramProc fLinkProgram;
    272     GrGLLoadMatrixfProc fLoadMatrixf;
    273     GrGLMatrixModeProc fMatrixMode;
    274     GrGLPixelStoreiProc fPixelStorei;
    275     GrGLPointSizeProc fPointSize;
    276     GrGLReadPixelsProc fReadPixels;
    277     GrGLScissorProc fScissor;
    278     GrGLShadeModelProc fShadeModel;
    279     GrGLShaderSourceProc fShaderSource;
    280     GrGLStencilFuncProc fStencilFunc;
    281     GrGLStencilFuncSeparateProc fStencilFuncSeparate;
    282     GrGLStencilMaskProc fStencilMask;
    283     GrGLStencilMaskSeparateProc fStencilMaskSeparate;
    284     GrGLStencilOpProc fStencilOp;
    285     GrGLStencilOpSeparateProc fStencilOpSeparate;
    286     GrGLTexCoordPointerProc fTexCoordPointer;
    287     GrGLTexEnviProc fTexEnvi;
    288     GrGLTexImage2DProc fTexImage2D;
    289     GrGLTexParameteriProc fTexParameteri;
    290     GrGLTexSubImage2DProc fTexSubImage2D;
    291     GrGLUniform1fProc fUniform1f;
    292     GrGLUniform1iProc fUniform1i;
    293     GrGLUniform1fvProc fUniform1fv;
    294     GrGLUniform1ivProc fUniform1iv;
    295     GrGLUniform2fProc fUniform2f;
    296     GrGLUniform2iProc fUniform2i;
    297     GrGLUniform2fvProc  fUniform2fv;
    298     GrGLUniform2ivProc fUniform2iv;
    299     GrGLUniform3fProc fUniform3f;
    300     GrGLUniform3iProc fUniform3i;
    301     GrGLUniform3fvProc fUniform3fv;
    302     GrGLUniform3ivProc fUniform3iv;
    303     GrGLUniform4fProc fUniform4f;
    304     GrGLUniform4iProc fUniform4i;
    305     GrGLUniform4fvProc fUniform4fv;
    306     GrGLUniform4ivProc fUniform4iv;
    307     GrGLUniformMatrix2fvProc fUniformMatrix2fv;
    308     GrGLUniformMatrix3fvProc fUniformMatrix3fv;
    309     GrGLUniformMatrix4fvProc fUniformMatrix4fv;
    310     GrGLUseProgramProc fUseProgram;
    311     GrGLVertexAttrib4fvProc fVertexAttrib4fv;
    312     GrGLVertexAttribPointerProc fVertexAttribPointer;
    313     GrGLVertexPointerProc fVertexPointer;
    314     GrGLViewportProc fViewport;
    315 
    316     // FBO Extension Functions
    317     GrGLBindFramebufferProc fBindFramebuffer;
    318     GrGLBindRenderbufferProc fBindRenderbuffer;
    319     GrGLCheckFramebufferStatusProc fCheckFramebufferStatus;
    320     GrGLDeleteFramebuffersProc fDeleteFramebuffers;
    321     GrGLDeleteRenderbuffersProc fDeleteRenderbuffers;
    322     GrGLFramebufferRenderbufferProc fFramebufferRenderbuffer;
    323     GrGLFramebufferTexture2DProc fFramebufferTexture2D;
    324     GrGLGenFramebuffersProc fGenFramebuffers;
    325     GrGLGenRenderbuffersProc fGenRenderbuffers;
    326     GrGLRenderbufferStorageProc fRenderbufferStorage;
    327 
    328     // Multisampling Extension Functions
    329     // same prototype for ARB_FBO, EXT_FBO, GL 3.0, & Apple ES extension
    330     GrGLRenderbufferStorageMultisampleProc fRenderbufferStorageMultisample;
    331     // desktop: ext_fbo_blit, arb_fbo, gl 3.0
    332     GrGLBlitFramebufferProc fBlitFramebuffer;
    333     // apple's es extension
    334     GrGLResolveMultisampleFramebufferProc fResolveMultisampleFramebuffer;
    335 
    336     // Buffer mapping (extension in ES).
    337     GrGLMapBufferProc fMapBuffer;
    338     GrGLUnmapBufferProc fUnmapBuffer;
    339 
    340     // Dual Source Blending
    341     GrGLBindFragDataLocationIndexedProc fBindFragDataLocationIndexed;
    342 
    343     // Code that initializes this struct using a static initializer should
    344     // make this the last entry in the static initializer. It can help to guard
    345     // against failing to initialize newly-added members of this struct.
    346     enum { kStaticInitEndGuard } fStaticInitEndGuard;
    347 
    348 private:
    349     bool validateShaderFunctions() const;
    350     bool validateFixedFunctions() const;
    351 };
    352 
    353 #endif
    354