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