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 
9 #include "gl/GrGLInterface.h"
10 #include "gl/GrGLExtensions.h"
11 #include "gl/GrGLUtil.h"
12 
13 #include <stdio.h>
14 
15 #if GR_GL_PER_GL_FUNC_CALLBACK
16 namespace {
GrGLDefaultInterfaceCallback(const GrGLInterface *)17 void GrGLDefaultInterfaceCallback(const GrGLInterface*) {}
18 }
19 #endif
20 
GrGLInterfaceAddTestDebugMarker(const GrGLInterface * interface,GrGLInsertEventMarkerProc insertEventMarkerFn,GrGLPushGroupMarkerProc pushGroupMarkerFn,GrGLPopGroupMarkerProc popGroupMarkerFn)21 const GrGLInterface* GrGLInterfaceAddTestDebugMarker(const GrGLInterface* interface,
22                                                      GrGLInsertEventMarkerProc insertEventMarkerFn,
23                                                      GrGLPushGroupMarkerProc pushGroupMarkerFn,
24                                                      GrGLPopGroupMarkerProc popGroupMarkerFn) {
25     GrGLInterface* newInterface = GrGLInterface::NewClone(interface);
26 
27     if (!newInterface->fExtensions.has("GL_EXT_debug_marker")) {
28         newInterface->fExtensions.add("GL_EXT_debug_marker");
29     }
30 
31     newInterface->fFunctions.fInsertEventMarker = insertEventMarkerFn;
32     newInterface->fFunctions.fPushGroupMarker = pushGroupMarkerFn;
33     newInterface->fFunctions.fPopGroupMarker = popGroupMarkerFn;
34 
35     return newInterface;
36 }
37 
GrGLInterfaceRemoveNVPR(const GrGLInterface * interface)38 const GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface* interface) {
39     GrGLInterface* newInterface = GrGLInterface::NewClone(interface);
40 
41     newInterface->fExtensions.remove("GL_NV_path_rendering");
42     newInterface->fFunctions.fPathCommands = NULL;
43     newInterface->fFunctions.fPathCoords = NULL;
44     newInterface->fFunctions.fPathParameteri = NULL;
45     newInterface->fFunctions.fPathParameterf = NULL;
46     newInterface->fFunctions.fGenPaths = NULL;
47     newInterface->fFunctions.fDeletePaths = NULL;
48     newInterface->fFunctions.fIsPath = NULL;
49     newInterface->fFunctions.fPathStencilFunc = NULL;
50     newInterface->fFunctions.fStencilFillPath = NULL;
51     newInterface->fFunctions.fStencilStrokePath = NULL;
52     newInterface->fFunctions.fStencilFillPathInstanced = NULL;
53     newInterface->fFunctions.fStencilStrokePathInstanced = NULL;
54     newInterface->fFunctions.fPathTexGen = NULL;
55     newInterface->fFunctions.fCoverFillPath = NULL;
56     newInterface->fFunctions.fCoverStrokePath = NULL;
57     newInterface->fFunctions.fCoverFillPathInstanced = NULL;
58     newInterface->fFunctions.fCoverStrokePathInstanced = NULL;
59     newInterface->fFunctions.fStencilThenCoverFillPath = NULL;
60     newInterface->fFunctions.fStencilThenCoverStrokePath = NULL;
61     newInterface->fFunctions.fStencilThenCoverFillPathInstanced = NULL;
62     newInterface->fFunctions.fStencilThenCoverStrokePathInstanced = NULL;
63     newInterface->fFunctions.fProgramPathFragmentInputGen = NULL;
64     newInterface->fFunctions.fPathMemoryGlyphIndexArray = NULL;
65     return newInterface;
66 }
67 
GrGLInterface()68 GrGLInterface::GrGLInterface() {
69     fStandard = kNone_GrGLStandard;
70 
71 #if GR_GL_PER_GL_FUNC_CALLBACK
72     fCallback = GrGLDefaultInterfaceCallback;
73     fCallbackData = 0;
74 #endif
75 }
76 
NewClone(const GrGLInterface * interface)77 GrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) {
78     SkASSERT(interface);
79 
80     GrGLInterface* clone = SkNEW(GrGLInterface);
81     clone->fStandard = interface->fStandard;
82     clone->fExtensions = interface->fExtensions;
83     clone->fFunctions = interface->fFunctions;
84 #if GR_GL_PER_GL_FUNC_CALLBACK
85     clone->fCallback = interface->fCallback;
86     clone->fCallbackData = interface->fCallbackData;
87 #endif
88     return clone;
89 }
90 
91 #ifdef SK_DEBUG
92     static int kIsDebug = 1;
93 #else
94     static int kIsDebug = 0;
95 #endif
96 
97 #define RETURN_FALSE_INTERFACE                                                                   \
98     if (kIsDebug) { SkDebugf("%s:%d GrGLInterface::validate() failed.\n", __FILE__, __LINE__); } \
99     return false;
100 
validate() const101 bool GrGLInterface::validate() const {
102 
103     if (kNone_GrGLStandard == fStandard) {
104         RETURN_FALSE_INTERFACE
105     }
106 
107     if (!fExtensions.isInitialized()) {
108         RETURN_FALSE_INTERFACE
109     }
110 
111     // functions that are always required
112     if (NULL == fFunctions.fActiveTexture ||
113         NULL == fFunctions.fAttachShader ||
114         NULL == fFunctions.fBindAttribLocation ||
115         NULL == fFunctions.fBindBuffer ||
116         NULL == fFunctions.fBindTexture ||
117         NULL == fFunctions.fBlendColor ||      // -> GL >= 1.4 or extension, ES >= 2.0
118         NULL == fFunctions.fBlendEquation ||   // -> GL >= 1.4 or extension, ES >= 2.0
119         NULL == fFunctions.fBlendFunc ||
120         NULL == fFunctions.fBufferData ||
121         NULL == fFunctions.fBufferSubData ||
122         NULL == fFunctions.fClear ||
123         NULL == fFunctions.fClearColor ||
124         NULL == fFunctions.fClearStencil ||
125         NULL == fFunctions.fColorMask ||
126         NULL == fFunctions.fCompileShader ||
127         NULL == fFunctions.fCopyTexSubImage2D ||
128         NULL == fFunctions.fCreateProgram ||
129         NULL == fFunctions.fCreateShader ||
130         NULL == fFunctions.fCullFace ||
131         NULL == fFunctions.fDeleteBuffers ||
132         NULL == fFunctions.fDeleteProgram ||
133         NULL == fFunctions.fDeleteShader ||
134         NULL == fFunctions.fDeleteTextures ||
135         NULL == fFunctions.fDepthMask ||
136         NULL == fFunctions.fDisable ||
137         NULL == fFunctions.fDisableVertexAttribArray ||
138         NULL == fFunctions.fDrawArrays ||
139         NULL == fFunctions.fDrawElements ||
140         NULL == fFunctions.fEnable ||
141         NULL == fFunctions.fEnableVertexAttribArray ||
142         NULL == fFunctions.fFrontFace ||
143         NULL == fFunctions.fGenBuffers ||
144         NULL == fFunctions.fGenTextures ||
145         NULL == fFunctions.fGetBufferParameteriv ||
146         NULL == fFunctions.fGenerateMipmap ||
147         NULL == fFunctions.fGetError ||
148         NULL == fFunctions.fGetIntegerv ||
149         NULL == fFunctions.fGetProgramInfoLog ||
150         NULL == fFunctions.fGetProgramiv ||
151         NULL == fFunctions.fGetShaderInfoLog ||
152         NULL == fFunctions.fGetShaderiv ||
153         NULL == fFunctions.fGetString ||
154         NULL == fFunctions.fGetUniformLocation ||
155         NULL == fFunctions.fLinkProgram ||
156         NULL == fFunctions.fLineWidth ||
157         NULL == fFunctions.fPixelStorei ||
158         NULL == fFunctions.fReadPixels ||
159         NULL == fFunctions.fScissor ||
160         NULL == fFunctions.fShaderSource ||
161         NULL == fFunctions.fStencilFunc ||
162         NULL == fFunctions.fStencilMask ||
163         NULL == fFunctions.fStencilOp ||
164         NULL == fFunctions.fTexImage2D ||
165         NULL == fFunctions.fTexParameteri ||
166         NULL == fFunctions.fTexParameteriv ||
167         NULL == fFunctions.fTexSubImage2D ||
168         NULL == fFunctions.fUniform1f ||
169         NULL == fFunctions.fUniform1i ||
170         NULL == fFunctions.fUniform1fv ||
171         NULL == fFunctions.fUniform1iv ||
172         NULL == fFunctions.fUniform2f ||
173         NULL == fFunctions.fUniform2i ||
174         NULL == fFunctions.fUniform2fv ||
175         NULL == fFunctions.fUniform2iv ||
176         NULL == fFunctions.fUniform3f ||
177         NULL == fFunctions.fUniform3i ||
178         NULL == fFunctions.fUniform3fv ||
179         NULL == fFunctions.fUniform3iv ||
180         NULL == fFunctions.fUniform4f ||
181         NULL == fFunctions.fUniform4i ||
182         NULL == fFunctions.fUniform4fv ||
183         NULL == fFunctions.fUniform4iv ||
184         NULL == fFunctions.fUniformMatrix2fv ||
185         NULL == fFunctions.fUniformMatrix3fv ||
186         NULL == fFunctions.fUniformMatrix4fv ||
187         NULL == fFunctions.fUseProgram ||
188         NULL == fFunctions.fVertexAttrib1f ||
189         NULL == fFunctions.fVertexAttrib2fv ||
190         NULL == fFunctions.fVertexAttrib3fv ||
191         NULL == fFunctions.fVertexAttrib4fv ||
192         NULL == fFunctions.fVertexAttribPointer ||
193         NULL == fFunctions.fViewport ||
194         NULL == fFunctions.fBindFramebuffer ||
195         NULL == fFunctions.fBindRenderbuffer ||
196         NULL == fFunctions.fCheckFramebufferStatus ||
197         NULL == fFunctions.fDeleteFramebuffers ||
198         NULL == fFunctions.fDeleteRenderbuffers ||
199         NULL == fFunctions.fFinish ||
200         NULL == fFunctions.fFlush ||
201         NULL == fFunctions.fFramebufferRenderbuffer ||
202         NULL == fFunctions.fFramebufferTexture2D ||
203         NULL == fFunctions.fGetFramebufferAttachmentParameteriv ||
204         NULL == fFunctions.fGetRenderbufferParameteriv ||
205         NULL == fFunctions.fGenFramebuffers ||
206         NULL == fFunctions.fGenRenderbuffers ||
207         NULL == fFunctions.fRenderbufferStorage) {
208         RETURN_FALSE_INTERFACE
209     }
210 
211     GrGLVersion glVer = GrGLGetVersion(this);
212     if (GR_GL_INVALID_VER == glVer) {
213         RETURN_FALSE_INTERFACE
214     }
215 
216     // Now check that baseline ES/Desktop fns not covered above are present
217     // and that we have fn pointers for any advertised fExtensions that we will
218     // try to use.
219 
220     // these functions are part of ES2, we assume they are available
221     // On the desktop we assume they are available if the extension
222     // is present or GL version is high enough.
223     if (kGLES_GrGLStandard == fStandard) {
224         if (NULL == fFunctions.fStencilFuncSeparate ||
225             NULL == fFunctions.fStencilMaskSeparate ||
226             NULL == fFunctions.fStencilOpSeparate) {
227             RETURN_FALSE_INTERFACE
228         }
229     } else if (kGL_GrGLStandard == fStandard) {
230 
231         if (glVer >= GR_GL_VER(2,0)) {
232             if (NULL == fFunctions.fStencilFuncSeparate ||
233                 NULL == fFunctions.fStencilMaskSeparate ||
234                 NULL == fFunctions.fStencilOpSeparate) {
235                 RETURN_FALSE_INTERFACE
236             }
237         }
238         if (glVer >= GR_GL_VER(3,0) && NULL == fFunctions.fBindFragDataLocation) {
239             RETURN_FALSE_INTERFACE
240         }
241         if (glVer >= GR_GL_VER(2,0) || fExtensions.has("GL_ARB_draw_buffers")) {
242             if (NULL == fFunctions.fDrawBuffers) {
243                 RETURN_FALSE_INTERFACE
244             }
245         }
246 
247         if (glVer >= GR_GL_VER(1,5) || fExtensions.has("GL_ARB_occlusion_query")) {
248             if (NULL == fFunctions.fGenQueries ||
249                 NULL == fFunctions.fDeleteQueries ||
250                 NULL == fFunctions.fBeginQuery ||
251                 NULL == fFunctions.fEndQuery ||
252                 NULL == fFunctions.fGetQueryiv ||
253                 NULL == fFunctions.fGetQueryObjectiv ||
254                 NULL == fFunctions.fGetQueryObjectuiv) {
255                 RETURN_FALSE_INTERFACE
256             }
257         }
258         if (glVer >= GR_GL_VER(3,3) ||
259             fExtensions.has("GL_ARB_timer_query") ||
260             fExtensions.has("GL_EXT_timer_query")) {
261             if (NULL == fFunctions.fGetQueryObjecti64v ||
262                 NULL == fFunctions.fGetQueryObjectui64v) {
263                 RETURN_FALSE_INTERFACE
264             }
265         }
266         if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_timer_query")) {
267             if (NULL == fFunctions.fQueryCounter) {
268                 RETURN_FALSE_INTERFACE
269             }
270         }
271     }
272 
273     // optional function on desktop before 1.3
274     if (kGL_GrGLStandard != fStandard ||
275         (glVer >= GR_GL_VER(1,3)) ||
276         fExtensions.has("GL_ARB_texture_compression")) {
277         if (NULL == fFunctions.fCompressedTexImage2D
278 #if 0
279             || NULL == fFunctions.fCompressedTexSubImage2D
280 #endif
281             ) {
282             RETURN_FALSE_INTERFACE
283         }
284     }
285 
286     // part of desktop GL, but not ES
287     if (kGL_GrGLStandard == fStandard &&
288         (NULL == fFunctions.fGetTexLevelParameteriv ||
289          NULL == fFunctions.fDrawBuffer ||
290          NULL == fFunctions.fReadBuffer)) {
291         RETURN_FALSE_INTERFACE
292     }
293 
294     // GL_EXT_texture_storage is part of desktop 4.2
295     // There is a desktop ARB extension and an ES+desktop EXT extension
296     if (kGL_GrGLStandard == fStandard) {
297         if (glVer >= GR_GL_VER(4,2) ||
298             fExtensions.has("GL_ARB_texture_storage") ||
299             fExtensions.has("GL_EXT_texture_storage")) {
300             if (NULL == fFunctions.fTexStorage2D) {
301                 RETURN_FALSE_INTERFACE
302             }
303         }
304     } else if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_texture_storage")) {
305         if (NULL == fFunctions.fTexStorage2D) {
306             RETURN_FALSE_INTERFACE
307         }
308     }
309 
310     // glTextureBarrier is part of desktop 4.5. There are also ARB and NV extensions.
311     if (kGL_GrGLStandard == fStandard) {
312         if (glVer >= GR_GL_VER(4,5) ||
313             fExtensions.has("GL_ARB_texture_barrier") ||
314             fExtensions.has("GL_NV_texture_barrier")) {
315             if (NULL == fFunctions.fTextureBarrier) {
316                 RETURN_FALSE_INTERFACE
317             }
318         }
319     } else if (fExtensions.has("GL_NV_texture_barrier")) {
320         if (NULL == fFunctions.fTextureBarrier) {
321             RETURN_FALSE_INTERFACE
322         }
323     }
324 
325     if (fExtensions.has("GL_KHR_blend_equation_advanced") ||
326         fExtensions.has("GL_NV_blend_equation_advanced")) {
327         if (NULL == fFunctions.fBlendBarrier) {
328             RETURN_FALSE_INTERFACE
329         }
330     }
331 
332     if (fExtensions.has("GL_EXT_discard_framebuffer")) {
333 // FIXME: Remove this once Chromium is updated to provide this function
334 #if 0
335         if (NULL == fFunctions.fDiscardFramebuffer) {
336             RETURN_FALSE_INTERFACE
337         }
338 #endif
339     }
340 
341     // FBO MSAA
342     if (kGL_GrGLStandard == fStandard) {
343         // GL 3.0 and the ARB extension have multisample + blit
344         if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_ARB_framebuffer_object")) {
345             if (NULL == fFunctions.fRenderbufferStorageMultisample ||
346                 NULL == fFunctions.fBlitFramebuffer) {
347                 RETURN_FALSE_INTERFACE
348             }
349         } else {
350             if (fExtensions.has("GL_EXT_framebuffer_blit") &&
351                 NULL == fFunctions.fBlitFramebuffer) {
352                 RETURN_FALSE_INTERFACE
353             }
354             if (fExtensions.has("GL_EXT_framebuffer_multisample") &&
355                 NULL == fFunctions.fRenderbufferStorageMultisample) {
356                 RETURN_FALSE_INTERFACE
357             }
358         }
359     } else {
360         if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_CHROMIUM_framebuffer_multisample")) {
361             if (NULL == fFunctions.fRenderbufferStorageMultisample ||
362                 NULL == fFunctions.fBlitFramebuffer) {
363                 RETURN_FALSE_INTERFACE
364             }
365         }
366         if (fExtensions.has("GL_APPLE_framebuffer_multisample")) {
367             if (NULL == fFunctions.fRenderbufferStorageMultisampleES2APPLE ||
368                 NULL == fFunctions.fResolveMultisampleFramebuffer) {
369                 RETURN_FALSE_INTERFACE
370             }
371         }
372         if (fExtensions.has("GL_IMG_multisampled_render_to_texture") ||
373             fExtensions.has("GL_EXT_multisampled_render_to_texture")) {
374             if (NULL == fFunctions.fRenderbufferStorageMultisampleES2EXT ||
375                 NULL == fFunctions.fFramebufferTexture2DMultisample) {
376                 RETURN_FALSE_INTERFACE
377             }
378         }
379     }
380 
381     // On ES buffer mapping is an extension. On Desktop
382     // buffer mapping was part of original VBO extension
383     // which we require.
384     if (kGL_GrGLStandard == fStandard || fExtensions.has("GL_OES_mapbuffer")) {
385         if (NULL == fFunctions.fMapBuffer ||
386             NULL == fFunctions.fUnmapBuffer) {
387             RETURN_FALSE_INTERFACE
388         }
389     }
390 
391     // Dual source blending
392     if (kGL_GrGLStandard == fStandard &&
393         (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_blend_func_extended"))) {
394         if (NULL == fFunctions.fBindFragDataLocationIndexed) {
395             RETURN_FALSE_INTERFACE
396         }
397     }
398 
399     // glGetStringi was added in version 3.0 of both desktop and ES.
400     if (glVer >= GR_GL_VER(3, 0)) {
401         if (NULL == fFunctions.fGetStringi) {
402             RETURN_FALSE_INTERFACE
403         }
404     }
405 
406     if (kGL_GrGLStandard == fStandard) {
407         if (glVer >= GR_GL_VER(3, 0) || fExtensions.has("GL_ARB_vertex_array_object")) {
408             if (NULL == fFunctions.fBindVertexArray ||
409                 NULL == fFunctions.fDeleteVertexArrays ||
410                 NULL == fFunctions.fGenVertexArrays) {
411                 RETURN_FALSE_INTERFACE
412             }
413         }
414     } else {
415         if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_OES_vertex_array_object")) {
416             if (NULL == fFunctions.fBindVertexArray ||
417                 NULL == fFunctions.fDeleteVertexArrays ||
418                 NULL == fFunctions.fGenVertexArrays) {
419                 RETURN_FALSE_INTERFACE
420             }
421         }
422     }
423 
424     if (fExtensions.has("GL_EXT_debug_marker")) {
425         if (NULL == fFunctions.fInsertEventMarker ||
426             NULL == fFunctions.fPushGroupMarker ||
427             NULL == fFunctions.fPopGroupMarker) {
428             RETURN_FALSE_INTERFACE
429         }
430     }
431 
432     if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,3)) ||
433         fExtensions.has("GL_ARB_invalidate_subdata")) {
434         if (NULL == fFunctions.fInvalidateBufferData ||
435             NULL == fFunctions.fInvalidateBufferSubData ||
436             NULL == fFunctions.fInvalidateFramebuffer ||
437             NULL == fFunctions.fInvalidateSubFramebuffer ||
438             NULL == fFunctions.fInvalidateTexImage ||
439             NULL == fFunctions.fInvalidateTexSubImage) {
440             RETURN_FALSE_INTERFACE;
441         }
442     } else if (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,0)) {
443         // ES 3.0 adds the framebuffer functions but not the others.
444         if (NULL == fFunctions.fInvalidateFramebuffer ||
445             NULL == fFunctions.fInvalidateSubFramebuffer) {
446             RETURN_FALSE_INTERFACE;
447         }
448     }
449 
450     if (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_CHROMIUM_map_sub")) {
451         if (NULL == fFunctions.fMapBufferSubData ||
452             NULL == fFunctions.fMapTexSubImage2D ||
453             NULL == fFunctions.fUnmapBufferSubData ||
454             NULL == fFunctions.fUnmapTexSubImage2D) {
455             RETURN_FALSE_INTERFACE;
456         }
457     }
458 
459     // These functions are added to the 3.0 version of both GLES and GL.
460     if (glVer >= GR_GL_VER(3,0) ||
461         (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_EXT_map_buffer_range")) ||
462         (kGL_GrGLStandard == fStandard && fExtensions.has("GL_ARB_map_buffer_range"))) {
463         if (NULL == fFunctions.fMapBufferRange ||
464             NULL == fFunctions.fFlushMappedBufferRange) {
465             RETURN_FALSE_INTERFACE;
466         }
467     }
468 
469     if ((kGL_GrGLStandard == fStandard && fExtensions.has("GL_EXT_direct_state_access")) ||
470         (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_NV_path_rendering"))) {
471         if (NULL == fFunctions.fMatrixLoadf ||
472             NULL == fFunctions.fMatrixLoadIdentity) {
473             RETURN_FALSE_INTERFACE
474         }
475     }
476 
477     if ((kGL_GrGLStandard == fStandard &&
478          (glVer >= GR_GL_VER(4,3) || fExtensions.has("GL_ARB_program_interface_query"))) ||
479         (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) {
480         if (NULL == fFunctions.fGetProgramResourceLocation) {
481             RETURN_FALSE_INTERFACE
482         }
483     }
484 
485     if (kGLES_GrGLStandard == fStandard || glVer >= GR_GL_VER(4,1) ||
486         fExtensions.has("GL_ARB_ES2_compatibility")) {
487 #if 0 // Enable this once Chrome gives us the function ptr
488         if (NULL == fFunctions.fGetShaderPrecisionFormat) {
489             RETURN_FALSE_INTERFACE
490         }
491 #endif
492     }
493 
494     if (fExtensions.has("GL_NV_path_rendering")) {
495         if (NULL == fFunctions.fPathCommands ||
496             NULL == fFunctions.fPathCoords ||
497             NULL == fFunctions.fPathParameteri ||
498             NULL == fFunctions.fPathParameterf ||
499             NULL == fFunctions.fGenPaths ||
500             NULL == fFunctions.fDeletePaths ||
501             NULL == fFunctions.fIsPath ||
502             NULL == fFunctions.fPathStencilFunc ||
503             NULL == fFunctions.fStencilFillPath ||
504             NULL == fFunctions.fStencilStrokePath ||
505             NULL == fFunctions.fStencilFillPathInstanced ||
506             NULL == fFunctions.fStencilStrokePathInstanced ||
507             NULL == fFunctions.fCoverFillPath ||
508             NULL == fFunctions.fCoverStrokePath ||
509             NULL == fFunctions.fCoverFillPathInstanced ||
510             NULL == fFunctions.fCoverStrokePathInstanced) {
511             RETURN_FALSE_INTERFACE
512         }
513         if (kGL_GrGLStandard == fStandard) {
514             // Some methods only exist on desktop
515             if (NULL == fFunctions.fPathTexGen) {
516                 RETURN_FALSE_INTERFACE
517             }
518         } else {
519             // All additions through v1.3 exist on GLES
520             if (NULL == fFunctions.fStencilThenCoverFillPath ||
521                 NULL == fFunctions.fStencilThenCoverStrokePath ||
522                 NULL == fFunctions.fStencilThenCoverFillPathInstanced ||
523                 NULL == fFunctions.fStencilThenCoverStrokePathInstanced ||
524                 NULL == fFunctions.fProgramPathFragmentInputGen ||
525                 NULL == fFunctions.fPathMemoryGlyphIndexArray) {
526                 RETURN_FALSE_INTERFACE
527             }
528         }
529     }
530 
531     if (fExtensions.has("GL_NV_framebuffer_mixed_samples")) {
532         if (NULL == fFunctions.fCoverageModulation) {
533             RETURN_FALSE_INTERFACE
534         }
535     }
536 
537     return true;
538 }
539