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