Home | History | Annotate | Download | only in gl
      1 /*
      2  * Copyright 2011 Google Inc.
      3  *
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  */
      7 
      8 #ifndef GrGLInterface_DEFINED
      9 #define GrGLInterface_DEFINED
     10 
     11 #include "GrGLFunctions.h"
     12 #include "GrGLExtensions.h"
     13 #include "SkRefCnt.h"
     14 
     15 ////////////////////////////////////////////////////////////////////////////////
     16 
     17 typedef void(*GrGLFuncPtr)();
     18 struct GrGLInterface;
     19 
     20 
     21 /**
     22  * Rather than depend on platform-specific GL headers and libraries, we require
     23  * the client to provide a struct of GL function pointers. This struct can be
     24  * specified per-GrContext as a parameter to GrContext::MakeGL. If NULL is
     25  * passed to MakeGL then a "native" GL interface is created. If the native is
     26  * also NULL GrContext creation will fail.
     27  *
     28  * The default interface is returned by GrGLMakeNativeInterface. This function's
     29  * implementation is platform-specific. Several have been provided
     30  * (for GLX, WGL, EGL, etc), along with an implementation that simply returns
     31  * NULL.
     32  */
     33 SK_API sk_sp<const GrGLInterface> GrGLMakeNativeInterface();
     34 // Deprecated alternative to GrGLMakeNativeInterface().
     35 SK_API const GrGLInterface* GrGLCreateNativeInterface();
     36 
     37 /**
     38  * Creates a null GrGLInterface that doesn't draw anything. Used for measuring
     39  * CPU overhead. TODO: We would like to move this to tools/gpu/gl/null but currently
     40  * Chromium is using it in its unit tests.
     41  */
     42 const SK_API GrGLInterface* GrGLCreateNullInterface(bool enableNVPR = false);
     43 
     44 /**
     45  * GrContext uses the following interface to make all calls into OpenGL. When a
     46  * GrContext is created it is given a GrGLInterface. The interface's function
     47  * pointers must be valid for the OpenGL context associated with the GrContext.
     48  * On some platforms, such as Windows, function pointers for OpenGL extensions
     49  * may vary between OpenGL contexts. So the caller must be careful to use a
     50  * GrGLInterface initialized for the correct context. All functions that should
     51  * be available based on the OpenGL's version and extension string must be
     52  * non-NULL or GrContext creation will fail. This can be tested with the
     53  * validate() method when the OpenGL context has been made current.
     54  */
     55 struct SK_API GrGLInterface : public SkRefCnt {
     56 private:
     57     typedef SkRefCnt INHERITED;
     58 
     59 public:
     60     GrGLInterface();
     61 
     62     // Validates that the GrGLInterface supports its advertised standard. This means the necessary
     63     // function pointers have been initialized for both the GL version and any advertised
     64     // extensions.
     65     bool validate() const;
     66 
     67     // Indicates the type of GL implementation
     68     union {
     69         GrGLStandard fStandard;
     70         GrGLStandard fBindingsExported; // Legacy name, will be remove when Chromium is updated.
     71     };
     72 
     73     GrGLExtensions fExtensions;
     74 
     75     bool hasExtension(const char ext[]) const { return fExtensions.has(ext); }
     76 
     77     /**
     78      * The function pointers are in a struct so that we can have a compiler generated assignment
     79      * operator.
     80      */
     81     struct Functions {
     82         GrGLFunction<GrGLActiveTextureProc> fActiveTexture;
     83         GrGLFunction<GrGLAttachShaderProc> fAttachShader;
     84         GrGLFunction<GrGLBeginQueryProc> fBeginQuery;
     85         GrGLFunction<GrGLBindAttribLocationProc> fBindAttribLocation;
     86         GrGLFunction<GrGLBindBufferProc> fBindBuffer;
     87         GrGLFunction<GrGLBindFragDataLocationProc> fBindFragDataLocation;
     88         GrGLFunction<GrGLBindFragDataLocationIndexedProc> fBindFragDataLocationIndexed;
     89         GrGLFunction<GrGLBindFramebufferProc> fBindFramebuffer;
     90         GrGLFunction<GrGLBindRenderbufferProc> fBindRenderbuffer;
     91         GrGLFunction<GrGLBindTextureProc> fBindTexture;
     92         GrGLFunction<GrGLBindImageTextureProc> fBindImageTexture;
     93         GrGLFunction<GrGLBindVertexArrayProc> fBindVertexArray;
     94         GrGLFunction<GrGLBlendBarrierProc> fBlendBarrier;
     95         GrGLFunction<GrGLBlendColorProc> fBlendColor;
     96         GrGLFunction<GrGLBlendEquationProc> fBlendEquation;
     97         GrGLFunction<GrGLBlendFuncProc> fBlendFunc;
     98         GrGLFunction<GrGLBlitFramebufferProc> fBlitFramebuffer;
     99         GrGLFunction<GrGLBufferDataProc> fBufferData;
    100         GrGLFunction<GrGLBufferSubDataProc> fBufferSubData;
    101         GrGLFunction<GrGLCheckFramebufferStatusProc> fCheckFramebufferStatus;
    102         GrGLFunction<GrGLClearProc> fClear;
    103         GrGLFunction<GrGLClearColorProc> fClearColor;
    104         GrGLFunction<GrGLClearStencilProc> fClearStencil;
    105         GrGLFunction<GrGLClearTexImageProc> fClearTexImage;
    106         GrGLFunction<GrGLClearTexSubImageProc> fClearTexSubImage;
    107         GrGLFunction<GrGLColorMaskProc> fColorMask;
    108         GrGLFunction<GrGLCompileShaderProc> fCompileShader;
    109         GrGLFunction<GrGLCompressedTexImage2DProc> fCompressedTexImage2D;
    110         GrGLFunction<GrGLCompressedTexSubImage2DProc> fCompressedTexSubImage2D;
    111         GrGLFunction<GrGLCopyTexSubImage2DProc> fCopyTexSubImage2D;
    112         GrGLFunction<GrGLCreateProgramProc> fCreateProgram;
    113         GrGLFunction<GrGLCreateShaderProc> fCreateShader;
    114         GrGLFunction<GrGLCullFaceProc> fCullFace;
    115         GrGLFunction<GrGLDeleteBuffersProc> fDeleteBuffers;
    116         GrGLFunction<GrGLDeleteFramebuffersProc> fDeleteFramebuffers;
    117         GrGLFunction<GrGLDeleteProgramProc> fDeleteProgram;
    118         GrGLFunction<GrGLDeleteQueriesProc> fDeleteQueries;
    119         GrGLFunction<GrGLDeleteRenderbuffersProc> fDeleteRenderbuffers;
    120         GrGLFunction<GrGLDeleteShaderProc> fDeleteShader;
    121         GrGLFunction<GrGLDeleteTexturesProc> fDeleteTextures;
    122         GrGLFunction<GrGLDeleteVertexArraysProc> fDeleteVertexArrays;
    123         GrGLFunction<GrGLDepthMaskProc> fDepthMask;
    124         GrGLFunction<GrGLDisableProc> fDisable;
    125         GrGLFunction<GrGLDisableVertexAttribArrayProc> fDisableVertexAttribArray;
    126         GrGLFunction<GrGLDrawArraysProc> fDrawArrays;
    127         GrGLFunction<GrGLDrawArraysIndirectProc> fDrawArraysIndirect;
    128         GrGLFunction<GrGLDrawArraysInstancedProc> fDrawArraysInstanced;
    129         GrGLFunction<GrGLDrawBufferProc> fDrawBuffer;
    130         GrGLFunction<GrGLDrawBuffersProc> fDrawBuffers;
    131         GrGLFunction<GrGLDrawElementsProc> fDrawElements;
    132         GrGLFunction<GrGLDrawElementsIndirectProc> fDrawElementsIndirect;
    133         GrGLFunction<GrGLDrawElementsInstancedProc> fDrawElementsInstanced;
    134         GrGLFunction<GrGLDrawRangeElementsProc> fDrawRangeElements;
    135         GrGLFunction<GrGLEnableProc> fEnable;
    136         GrGLFunction<GrGLEnableVertexAttribArrayProc> fEnableVertexAttribArray;
    137         GrGLFunction<GrGLEndQueryProc> fEndQuery;
    138         GrGLFunction<GrGLFinishProc> fFinish;
    139         GrGLFunction<GrGLFlushProc> fFlush;
    140         GrGLFunction<GrGLFlushMappedBufferRangeProc> fFlushMappedBufferRange;
    141         GrGLFunction<GrGLFramebufferRenderbufferProc> fFramebufferRenderbuffer;
    142         GrGLFunction<GrGLFramebufferTexture2DProc> fFramebufferTexture2D;
    143         GrGLFunction<GrGLFramebufferTexture2DMultisampleProc> fFramebufferTexture2DMultisample;
    144         GrGLFunction<GrGLFrontFaceProc> fFrontFace;
    145         GrGLFunction<GrGLGenBuffersProc> fGenBuffers;
    146         GrGLFunction<GrGLGenFramebuffersProc> fGenFramebuffers;
    147         GrGLFunction<GrGLGenerateMipmapProc> fGenerateMipmap;
    148         GrGLFunction<GrGLGenQueriesProc> fGenQueries;
    149         GrGLFunction<GrGLGenRenderbuffersProc> fGenRenderbuffers;
    150         GrGLFunction<GrGLGenTexturesProc> fGenTextures;
    151         GrGLFunction<GrGLGenVertexArraysProc> fGenVertexArrays;
    152         GrGLFunction<GrGLGetBufferParameterivProc> fGetBufferParameteriv;
    153         GrGLFunction<GrGLGetErrorProc> fGetError;
    154         GrGLFunction<GrGLGetFramebufferAttachmentParameterivProc> fGetFramebufferAttachmentParameteriv;
    155         GrGLFunction<GrGLGetIntegervProc> fGetIntegerv;
    156         GrGLFunction<GrGLGetMultisamplefvProc> fGetMultisamplefv;
    157         GrGLFunction<GrGLGetProgramBinaryProc> fGetProgramBinary;
    158         GrGLFunction<GrGLGetProgramInfoLogProc> fGetProgramInfoLog;
    159         GrGLFunction<GrGLGetProgramivProc> fGetProgramiv;
    160         GrGLFunction<GrGLGetQueryObjecti64vProc> fGetQueryObjecti64v;
    161         GrGLFunction<GrGLGetQueryObjectivProc> fGetQueryObjectiv;
    162         GrGLFunction<GrGLGetQueryObjectui64vProc> fGetQueryObjectui64v;
    163         GrGLFunction<GrGLGetQueryObjectuivProc> fGetQueryObjectuiv;
    164         GrGLFunction<GrGLGetQueryivProc> fGetQueryiv;
    165         GrGLFunction<GrGLGetRenderbufferParameterivProc> fGetRenderbufferParameteriv;
    166         GrGLFunction<GrGLGetShaderInfoLogProc> fGetShaderInfoLog;
    167         GrGLFunction<GrGLGetShaderivProc> fGetShaderiv;
    168         GrGLFunction<GrGLGetShaderPrecisionFormatProc> fGetShaderPrecisionFormat;
    169         GrGLFunction<GrGLGetStringProc> fGetString;
    170         GrGLFunction<GrGLGetStringiProc> fGetStringi;
    171         GrGLFunction<GrGLGetTexLevelParameterivProc> fGetTexLevelParameteriv;
    172         GrGLFunction<GrGLGetUniformLocationProc> fGetUniformLocation;
    173         GrGLFunction<GrGLInsertEventMarkerProc> fInsertEventMarker;
    174         GrGLFunction<GrGLInvalidateBufferDataProc> fInvalidateBufferData;
    175         GrGLFunction<GrGLInvalidateBufferSubDataProc> fInvalidateBufferSubData;
    176         GrGLFunction<GrGLInvalidateFramebufferProc> fInvalidateFramebuffer;
    177         GrGLFunction<GrGLInvalidateSubFramebufferProc> fInvalidateSubFramebuffer;
    178         GrGLFunction<GrGLInvalidateTexImageProc> fInvalidateTexImage;
    179         GrGLFunction<GrGLInvalidateTexSubImageProc> fInvalidateTexSubImage;
    180         GrGLFunction<GrGLIsTextureProc> fIsTexture;
    181         GrGLFunction<GrGLLineWidthProc> fLineWidth;
    182         GrGLFunction<GrGLLinkProgramProc> fLinkProgram;
    183         GrGLFunction<GrGLProgramBinaryProc> fProgramBinary;
    184         GrGLFunction<GrGLProgramParameteriProc> fProgramParameteri;
    185         GrGLFunction<GrGLMapBufferProc> fMapBuffer;
    186         GrGLFunction<GrGLMapBufferRangeProc> fMapBufferRange;
    187         GrGLFunction<GrGLMapBufferSubDataProc> fMapBufferSubData;
    188         GrGLFunction<GrGLMapTexSubImage2DProc> fMapTexSubImage2D;
    189         GrGLFunction<GrGLMemoryBarrierProc> fMemoryBarrier;
    190         GrGLFunction<GrGLMemoryBarrierByRegionProc> fMemoryBarrierByRegion;
    191         GrGLFunction<GrGLMultiDrawArraysIndirectProc> fMultiDrawArraysIndirect;
    192         GrGLFunction<GrGLMultiDrawElementsIndirectProc> fMultiDrawElementsIndirect;
    193         GrGLFunction<GrGLPixelStoreiProc> fPixelStorei;
    194         GrGLFunction<GrGLPolygonModeProc> fPolygonMode;
    195         GrGLFunction<GrGLPopGroupMarkerProc> fPopGroupMarker;
    196         GrGLFunction<GrGLPushGroupMarkerProc> fPushGroupMarker;
    197         GrGLFunction<GrGLQueryCounterProc> fQueryCounter;
    198         GrGLFunction<GrGLRasterSamplesProc> fRasterSamples;
    199         GrGLFunction<GrGLReadBufferProc> fReadBuffer;
    200         GrGLFunction<GrGLReadPixelsProc> fReadPixels;
    201         GrGLFunction<GrGLRenderbufferStorageProc> fRenderbufferStorage;
    202 
    203         //  On OpenGL ES there are multiple incompatible extensions that add support for MSAA
    204         //  and ES3 adds MSAA support to the standard. On an ES3 driver we may still use the
    205         //  older extensions for performance reasons or due to ES3 driver bugs. We want the function
    206         //  that creates the GrGLInterface to provide all available functions and internally
    207         //  we will select among them. They all have a method called glRenderbufferStorageMultisample*.
    208         //  So we have separate function pointers for GL_IMG/EXT_multisampled_to_texture,
    209         //  GL_CHROMIUM/ANGLE_framebuffer_multisample/ES3, and GL_APPLE_framebuffer_multisample
    210         //  variations.
    211         //
    212         //  If a driver supports multiple GL_ARB_framebuffer_multisample-style extensions then we will
    213         //  assume the function pointers for the standard (or equivalent GL_ARB) version have
    214         //  been preferred over GL_EXT, GL_CHROMIUM, or GL_ANGLE variations that have reduced
    215         //  functionality.
    216 
    217         //  GL_EXT_multisampled_render_to_texture (preferred) or GL_IMG_multisampled_render_to_texture
    218         GrGLFunction<GrGLRenderbufferStorageMultisampleProc> fRenderbufferStorageMultisampleES2EXT;
    219         //  GL_APPLE_framebuffer_multisample
    220         GrGLFunction<GrGLRenderbufferStorageMultisampleProc> fRenderbufferStorageMultisampleES2APPLE;
    221 
    222         //  This is used to store the pointer for GL_ARB/EXT/ANGLE/CHROMIUM_framebuffer_multisample or
    223         //  the standard function in ES3+ or GL 3.0+.
    224         GrGLFunction<GrGLRenderbufferStorageMultisampleProc> fRenderbufferStorageMultisample;
    225 
    226         // Pointer to BindUniformLocationCHROMIUM from the GL_CHROMIUM_bind_uniform_location extension.
    227         GrGLFunction<GrGLBindUniformLocationProc> fBindUniformLocation;
    228 
    229         GrGLFunction<GrGLResolveMultisampleFramebufferProc> fResolveMultisampleFramebuffer;
    230         GrGLFunction<GrGLScissorProc> fScissor;
    231         GrGLFunction<GrGLShaderSourceProc> fShaderSource;
    232         GrGLFunction<GrGLStencilFuncProc> fStencilFunc;
    233         GrGLFunction<GrGLStencilFuncSeparateProc> fStencilFuncSeparate;
    234         GrGLFunction<GrGLStencilMaskProc> fStencilMask;
    235         GrGLFunction<GrGLStencilMaskSeparateProc> fStencilMaskSeparate;
    236         GrGLFunction<GrGLStencilOpProc> fStencilOp;
    237         GrGLFunction<GrGLStencilOpSeparateProc> fStencilOpSeparate;
    238         GrGLFunction<GrGLTexBufferProc> fTexBuffer;
    239         GrGLFunction<GrGLTexBufferRangeProc> fTexBufferRange;
    240         GrGLFunction<GrGLTexImage2DProc> fTexImage2D;
    241         GrGLFunction<GrGLTexParameteriProc> fTexParameteri;
    242         GrGLFunction<GrGLTexParameterivProc> fTexParameteriv;
    243         GrGLFunction<GrGLTexSubImage2DProc> fTexSubImage2D;
    244         GrGLFunction<GrGLTexStorage2DProc> fTexStorage2D;
    245         GrGLFunction<GrGLTextureBarrierProc> fTextureBarrier;
    246         GrGLFunction<GrGLDiscardFramebufferProc> fDiscardFramebuffer;
    247         GrGLFunction<GrGLUniform1fProc> fUniform1f;
    248         GrGLFunction<GrGLUniform1iProc> fUniform1i;
    249         GrGLFunction<GrGLUniform1fvProc> fUniform1fv;
    250         GrGLFunction<GrGLUniform1ivProc> fUniform1iv;
    251         GrGLFunction<GrGLUniform2fProc> fUniform2f;
    252         GrGLFunction<GrGLUniform2iProc> fUniform2i;
    253         GrGLFunction<GrGLUniform2fvProc> fUniform2fv;
    254         GrGLFunction<GrGLUniform2ivProc> fUniform2iv;
    255         GrGLFunction<GrGLUniform3fProc> fUniform3f;
    256         GrGLFunction<GrGLUniform3iProc> fUniform3i;
    257         GrGLFunction<GrGLUniform3fvProc> fUniform3fv;
    258         GrGLFunction<GrGLUniform3ivProc> fUniform3iv;
    259         GrGLFunction<GrGLUniform4fProc> fUniform4f;
    260         GrGLFunction<GrGLUniform4iProc> fUniform4i;
    261         GrGLFunction<GrGLUniform4fvProc> fUniform4fv;
    262         GrGLFunction<GrGLUniform4ivProc> fUniform4iv;
    263         GrGLFunction<GrGLUniformMatrix2fvProc> fUniformMatrix2fv;
    264         GrGLFunction<GrGLUniformMatrix3fvProc> fUniformMatrix3fv;
    265         GrGLFunction<GrGLUniformMatrix4fvProc> fUniformMatrix4fv;
    266         GrGLFunction<GrGLUnmapBufferProc> fUnmapBuffer;
    267         GrGLFunction<GrGLUnmapBufferSubDataProc> fUnmapBufferSubData;
    268         GrGLFunction<GrGLUnmapTexSubImage2DProc> fUnmapTexSubImage2D;
    269         GrGLFunction<GrGLUseProgramProc> fUseProgram;
    270         GrGLFunction<GrGLVertexAttrib1fProc> fVertexAttrib1f;
    271         GrGLFunction<GrGLVertexAttrib2fvProc> fVertexAttrib2fv;
    272         GrGLFunction<GrGLVertexAttrib3fvProc> fVertexAttrib3fv;
    273         GrGLFunction<GrGLVertexAttrib4fvProc> fVertexAttrib4fv;
    274         GrGLFunction<GrGLVertexAttribDivisorProc> fVertexAttribDivisor;
    275         GrGLFunction<GrGLVertexAttribIPointerProc> fVertexAttribIPointer;
    276         GrGLFunction<GrGLVertexAttribPointerProc> fVertexAttribPointer;
    277         GrGLFunction<GrGLViewportProc> fViewport;
    278 
    279         /* GL_NV_path_rendering */
    280         GrGLFunction<GrGLMatrixLoadfProc> fMatrixLoadf;
    281         GrGLFunction<GrGLMatrixLoadIdentityProc> fMatrixLoadIdentity;
    282         GrGLFunction<GrGLGetProgramResourceLocationProc> fGetProgramResourceLocation;
    283         GrGLFunction<GrGLPathCommandsProc> fPathCommands;
    284         GrGLFunction<GrGLPathParameteriProc> fPathParameteri;
    285         GrGLFunction<GrGLPathParameterfProc> fPathParameterf;
    286         GrGLFunction<GrGLGenPathsProc> fGenPaths;
    287         GrGLFunction<GrGLDeletePathsProc> fDeletePaths;
    288         GrGLFunction<GrGLIsPathProc> fIsPath;
    289         GrGLFunction<GrGLPathStencilFuncProc> fPathStencilFunc;
    290         GrGLFunction<GrGLStencilFillPathProc> fStencilFillPath;
    291         GrGLFunction<GrGLStencilStrokePathProc> fStencilStrokePath;
    292         GrGLFunction<GrGLStencilFillPathInstancedProc> fStencilFillPathInstanced;
    293         GrGLFunction<GrGLStencilStrokePathInstancedProc> fStencilStrokePathInstanced;
    294         GrGLFunction<GrGLCoverFillPathProc> fCoverFillPath;
    295         GrGLFunction<GrGLCoverStrokePathProc> fCoverStrokePath;
    296         GrGLFunction<GrGLCoverFillPathInstancedProc> fCoverFillPathInstanced;
    297         GrGLFunction<GrGLCoverStrokePathInstancedProc> fCoverStrokePathInstanced;
    298         // NV_path_rendering v1.2
    299         GrGLFunction<GrGLStencilThenCoverFillPathProc> fStencilThenCoverFillPath;
    300         GrGLFunction<GrGLStencilThenCoverStrokePathProc> fStencilThenCoverStrokePath;
    301         GrGLFunction<GrGLStencilThenCoverFillPathInstancedProc> fStencilThenCoverFillPathInstanced;
    302         GrGLFunction<GrGLStencilThenCoverStrokePathInstancedProc> fStencilThenCoverStrokePathInstanced;
    303         // NV_path_rendering v1.3
    304         GrGLFunction<GrGLProgramPathFragmentInputGenProc> fProgramPathFragmentInputGen;
    305         // CHROMIUM_path_rendering
    306         GrGLFunction<GrGLBindFragmentInputLocationProc> fBindFragmentInputLocation;
    307 
    308         /* NV_framebuffer_mixed_samples */
    309         GrGLFunction<GrGLCoverageModulationProc> fCoverageModulation;
    310 
    311         /* NV_bindless_texture */
    312         // We use the NVIDIA verson for now because it does not require dynamically uniform handles.
    313         // We may switch the the ARB version and/or omit methods in the future.
    314         GrGLFunction<GrGLGetTextureHandleProc> fGetTextureHandle;
    315         GrGLFunction<GrGLGetTextureSamplerHandleProc> fGetTextureSamplerHandle;
    316         GrGLFunction<GrGLMakeTextureHandleResidentProc> fMakeTextureHandleResident;
    317         GrGLFunction<GrGLMakeTextureHandleNonResidentProc> fMakeTextureHandleNonResident;
    318         GrGLFunction<GrGLGetImageHandleProc> fGetImageHandle;
    319         GrGLFunction<GrGLMakeImageHandleResidentProc> fMakeImageHandleResident;
    320         GrGLFunction<GrGLMakeImageHandleNonResidentProc> fMakeImageHandleNonResident;
    321         GrGLFunction<GrGLIsTextureHandleResidentProc> fIsTextureHandleResident;
    322         GrGLFunction<GrGLIsImageHandleResidentProc> fIsImageHandleResident;
    323         GrGLFunction<GrGLUniformHandleui64Proc> fUniformHandleui64;
    324         GrGLFunction<GrGLUniformHandleui64vProc> fUniformHandleui64v;
    325         GrGLFunction<GrGLProgramUniformHandleui64Proc> fProgramUniformHandleui64;
    326         GrGLFunction<GrGLProgramUniformHandleui64vProc> fProgramUniformHandleui64v;
    327 
    328         /* ARB_sample_shading */
    329         GrGLFunction<GrGLMinSampleShadingProc> fMinSampleShading;
    330 
    331         /* EXT_direct_state_access */
    332         // We use the EXT verson because it is more expansive and interacts with more extensions
    333         // than the ARB or core (4.5) versions. We may switch and/or omit methods in the future.
    334         GrGLFunction<GrGLTextureParameteriProc> fTextureParameteri;
    335         GrGLFunction<GrGLTextureParameterivProc> fTextureParameteriv;
    336         GrGLFunction<GrGLTextureParameterfProc> fTextureParameterf;
    337         GrGLFunction<GrGLTextureParameterfvProc> fTextureParameterfv;
    338         GrGLFunction<GrGLTextureImage1DProc> fTextureImage1D;
    339         GrGLFunction<GrGLTextureImage2DProc> fTextureImage2D;
    340         GrGLFunction<GrGLTextureSubImage1DProc> fTextureSubImage1D;
    341         GrGLFunction<GrGLTextureSubImage2DProc> fTextureSubImage2D;
    342         GrGLFunction<GrGLCopyTextureImage1DProc> fCopyTextureImage1D;
    343         GrGLFunction<GrGLCopyTextureImage2DProc> fCopyTextureImage2D;
    344         GrGLFunction<GrGLCopyTextureSubImage1DProc> fCopyTextureSubImage1D;
    345         GrGLFunction<GrGLCopyTextureSubImage2DProc> fCopyTextureSubImage2D;
    346         GrGLFunction<GrGLGetTextureImageProc> fGetTextureImage;
    347         GrGLFunction<GrGLGetTextureParameterfvProc> fGetTextureParameterfv;
    348         GrGLFunction<GrGLGetTextureParameterivProc> fGetTextureParameteriv;
    349         GrGLFunction<GrGLGetTextureLevelParameterfvProc> fGetTextureLevelParameterfv;
    350         GrGLFunction<GrGLGetTextureLevelParameterivProc> fGetTextureLevelParameteriv;
    351         // OpenGL 1.2
    352         GrGLFunction<GrGLTextureImage3DProc> fTextureImage3D;
    353         GrGLFunction<GrGLTextureSubImage3DProc> fTextureSubImage3D;
    354         GrGLFunction<GrGLCopyTextureSubImage3DProc> fCopyTextureSubImage3D;
    355         GrGLFunction<GrGLCompressedTextureImage3DProc> fCompressedTextureImage3D;
    356         GrGLFunction<GrGLCompressedTextureImage2DProc> fCompressedTextureImage2D;
    357         GrGLFunction<GrGLCompressedTextureImage1DProc> fCompressedTextureImage1D;
    358         GrGLFunction<GrGLCompressedTextureSubImage3DProc> fCompressedTextureSubImage3D;
    359         GrGLFunction<GrGLCompressedTextureSubImage2DProc> fCompressedTextureSubImage2D;
    360         GrGLFunction<GrGLCompressedTextureSubImage1DProc> fCompressedTextureSubImage1D;
    361         GrGLFunction<GrGLGetCompressedTextureImageProc> fGetCompressedTextureImage;
    362         // OpenGL 1.5
    363         GrGLFunction<GrGLNamedBufferDataProc> fNamedBufferData;
    364         GrGLFunction<GrGLNamedBufferSubDataProc> fNamedBufferSubData;
    365         GrGLFunction<GrGLMapNamedBufferProc> fMapNamedBuffer;
    366         GrGLFunction<GrGLUnmapNamedBufferProc> fUnmapNamedBuffer;
    367         GrGLFunction<GrGLGetNamedBufferParameterivProc> fGetNamedBufferParameteriv;
    368         GrGLFunction<GrGLGetNamedBufferPointervProc> fGetNamedBufferPointerv;
    369         GrGLFunction<GrGLGetNamedBufferSubDataProc> fGetNamedBufferSubData;
    370         // OpenGL 2.0
    371         GrGLFunction<GrGLProgramUniform1fProc> fProgramUniform1f;
    372         GrGLFunction<GrGLProgramUniform2fProc> fProgramUniform2f;
    373         GrGLFunction<GrGLProgramUniform3fProc> fProgramUniform3f;
    374         GrGLFunction<GrGLProgramUniform4fProc> fProgramUniform4f;
    375         GrGLFunction<GrGLProgramUniform1iProc> fProgramUniform1i;
    376         GrGLFunction<GrGLProgramUniform2iProc> fProgramUniform2i;
    377         GrGLFunction<GrGLProgramUniform3iProc> fProgramUniform3i;
    378         GrGLFunction<GrGLProgramUniform4iProc> fProgramUniform4i;
    379         GrGLFunction<GrGLProgramUniform1fvProc> fProgramUniform1fv;
    380         GrGLFunction<GrGLProgramUniform2fvProc> fProgramUniform2fv;
    381         GrGLFunction<GrGLProgramUniform3fvProc> fProgramUniform3fv;
    382         GrGLFunction<GrGLProgramUniform4fvProc> fProgramUniform4fv;
    383         GrGLFunction<GrGLProgramUniform1ivProc> fProgramUniform1iv;
    384         GrGLFunction<GrGLProgramUniform2ivProc> fProgramUniform2iv;
    385         GrGLFunction<GrGLProgramUniform3ivProc> fProgramUniform3iv;
    386         GrGLFunction<GrGLProgramUniform4ivProc> fProgramUniform4iv;
    387         GrGLFunction<GrGLProgramUniformMatrix2fvProc> fProgramUniformMatrix2fv;
    388         GrGLFunction<GrGLProgramUniformMatrix3fvProc> fProgramUniformMatrix3fv;
    389         GrGLFunction<GrGLProgramUniformMatrix4fvProc> fProgramUniformMatrix4fv;
    390         // OpenGL 2.1
    391         GrGLFunction<GrGLProgramUniformMatrix2x3fvProc> fProgramUniformMatrix2x3fv;
    392         GrGLFunction<GrGLProgramUniformMatrix3x2fvProc> fProgramUniformMatrix3x2fv;
    393         GrGLFunction<GrGLProgramUniformMatrix2x4fvProc> fProgramUniformMatrix2x4fv;
    394         GrGLFunction<GrGLProgramUniformMatrix4x2fvProc> fProgramUniformMatrix4x2fv;
    395         GrGLFunction<GrGLProgramUniformMatrix3x4fvProc> fProgramUniformMatrix3x4fv;
    396         GrGLFunction<GrGLProgramUniformMatrix4x3fvProc> fProgramUniformMatrix4x3fv;
    397         // OpenGL 3.0
    398         GrGLFunction<GrGLNamedRenderbufferStorageProc> fNamedRenderbufferStorage;
    399         GrGLFunction<GrGLGetNamedRenderbufferParameterivProc> fGetNamedRenderbufferParameteriv;
    400         GrGLFunction<GrGLNamedRenderbufferStorageMultisampleProc> fNamedRenderbufferStorageMultisample;
    401         GrGLFunction<GrGLCheckNamedFramebufferStatusProc> fCheckNamedFramebufferStatus;
    402         GrGLFunction<GrGLNamedFramebufferTexture1DProc> fNamedFramebufferTexture1D;
    403         GrGLFunction<GrGLNamedFramebufferTexture2DProc> fNamedFramebufferTexture2D;
    404         GrGLFunction<GrGLNamedFramebufferTexture3DProc> fNamedFramebufferTexture3D;
    405         GrGLFunction<GrGLNamedFramebufferRenderbufferProc> fNamedFramebufferRenderbuffer;
    406         GrGLFunction<GrGLGetNamedFramebufferAttachmentParameterivProc> fGetNamedFramebufferAttachmentParameteriv;
    407         GrGLFunction<GrGLGenerateTextureMipmapProc> fGenerateTextureMipmap;
    408         GrGLFunction<GrGLFramebufferDrawBufferProc> fFramebufferDrawBuffer;
    409         GrGLFunction<GrGLFramebufferDrawBuffersProc> fFramebufferDrawBuffers;
    410         GrGLFunction<GrGLFramebufferReadBufferProc> fFramebufferReadBuffer;
    411         GrGLFunction<GrGLGetFramebufferParameterivProc> fGetFramebufferParameteriv;
    412         GrGLFunction<GrGLNamedCopyBufferSubDataProc> fNamedCopyBufferSubData;
    413         GrGLFunction<GrGLVertexArrayVertexOffsetProc> fVertexArrayVertexOffset;
    414         GrGLFunction<GrGLVertexArrayColorOffsetProc> fVertexArrayColorOffset;
    415         GrGLFunction<GrGLVertexArrayEdgeFlagOffsetProc> fVertexArrayEdgeFlagOffset;
    416         GrGLFunction<GrGLVertexArrayIndexOffsetProc> fVertexArrayIndexOffset;
    417         GrGLFunction<GrGLVertexArrayNormalOffsetProc> fVertexArrayNormalOffset;
    418         GrGLFunction<GrGLVertexArrayTexCoordOffsetProc> fVertexArrayTexCoordOffset;
    419         GrGLFunction<GrGLVertexArrayMultiTexCoordOffsetProc> fVertexArrayMultiTexCoordOffset;
    420         GrGLFunction<GrGLVertexArrayFogCoordOffsetProc> fVertexArrayFogCoordOffset;
    421         GrGLFunction<GrGLVertexArraySecondaryColorOffsetProc> fVertexArraySecondaryColorOffset;
    422         GrGLFunction<GrGLVertexArrayVertexAttribOffsetProc> fVertexArrayVertexAttribOffset;
    423         GrGLFunction<GrGLVertexArrayVertexAttribIOffsetProc> fVertexArrayVertexAttribIOffset;
    424         GrGLFunction<GrGLEnableVertexArrayProc> fEnableVertexArray;
    425         GrGLFunction<GrGLDisableVertexArrayProc> fDisableVertexArray;
    426         GrGLFunction<GrGLEnableVertexArrayAttribProc> fEnableVertexArrayAttrib;
    427         GrGLFunction<GrGLDisableVertexArrayAttribProc> fDisableVertexArrayAttrib;
    428         GrGLFunction<GrGLGetVertexArrayIntegervProc> fGetVertexArrayIntegerv;
    429         GrGLFunction<GrGLGetVertexArrayPointervProc> fGetVertexArrayPointerv;
    430         GrGLFunction<GrGLGetVertexArrayIntegeri_vProc> fGetVertexArrayIntegeri_v;
    431         GrGLFunction<GrGLGetVertexArrayPointeri_vProc> fGetVertexArrayPointeri_v;
    432         GrGLFunction<GrGLMapNamedBufferRangeProc> fMapNamedBufferRange;
    433         GrGLFunction<GrGLFlushMappedNamedBufferRangeProc> fFlushMappedNamedBufferRange;
    434         // OpenGL 3.1
    435         GrGLFunction<GrGLTextureBufferProc> fTextureBuffer;
    436 
    437         /* ARB_sync */
    438         GrGLFunction<GrGLFenceSyncProc> fFenceSync;
    439         GrGLFunction<GrGLIsSyncProc> fIsSync;
    440         GrGLFunction<GrGLClientWaitSyncProc> fClientWaitSync;
    441         GrGLFunction<GrGLWaitSyncProc> fWaitSync;
    442         GrGLFunction<GrGLDeleteSyncProc> fDeleteSync;
    443 
    444         /* ARB_internalforamt_query */
    445         GrGLFunction<GrGLGetInternalformativProc> fGetInternalformativ;
    446 
    447         /* KHR_debug */
    448         GrGLFunction<GrGLDebugMessageControlProc> fDebugMessageControl;
    449         GrGLFunction<GrGLDebugMessageInsertProc> fDebugMessageInsert;
    450         GrGLFunction<GrGLDebugMessageCallbackProc> fDebugMessageCallback;
    451         GrGLFunction<GrGLGetDebugMessageLogProc> fGetDebugMessageLog;
    452         GrGLFunction<GrGLPushDebugGroupProc> fPushDebugGroup;
    453         GrGLFunction<GrGLPopDebugGroupProc> fPopDebugGroup;
    454         GrGLFunction<GrGLObjectLabelProc> fObjectLabel;
    455 
    456         /* EXT_window_rectangles */
    457         GrGLFunction<GrGLWindowRectanglesProc> fWindowRectangles;
    458 
    459         /* EGL functions */
    460         GrGLFunction<GrEGLCreateImageProc> fEGLCreateImage;
    461         GrGLFunction<GrEGLDestroyImageProc> fEGLDestroyImage;
    462     } fFunctions;
    463 
    464     // This exists for internal testing.
    465     virtual void abandon() const {}
    466 };
    467 
    468 #endif
    469