• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  * THIS FILE IS AUTOGENERATED
8  * Make edits to tools/gpu/gl/interface/templates.go or they will
9  * be overwritten.
10  */
11 
12 #include "include/gpu/gl/GrGLExtensions.h"
13 #include "include/gpu/gl/GrGLInterface.h"
14 #include "src/gpu/gl/GrGLUtil.h"
15 
16 #include <stdio.h>
17 
GrGLInterface()18 GrGLInterface::GrGLInterface() {
19     fStandard = kNone_GrGLStandard;
20 }
21 
22 #if GR_GL_CHECK_ERROR
get_error_string(GrGLenum err)23 static const char* get_error_string(GrGLenum err) {
24     switch (err) {
25         case GR_GL_NO_ERROR:
26             return "";
27         case GR_GL_INVALID_ENUM:
28             return "Invalid Enum";
29         case GR_GL_INVALID_VALUE:
30             return "Invalid Value";
31         case GR_GL_INVALID_OPERATION:
32             return "Invalid Operation";
33         case GR_GL_OUT_OF_MEMORY:
34             return "Out of Memory";
35         case GR_GL_CONTEXT_LOST:
36             return "Context Lost";
37     }
38     return "Unknown";
39 }
40 
checkError(const char * location,const char * call) const41 GrGLenum GrGLInterface::checkError(const char* location, const char* call) const {
42     GrGLenum error = fFunctions.fGetError();
43     if (error != GR_GL_NO_ERROR && !fSuppressErrorLogging) {
44         SkDebugf("---- glGetError 0x%x(%s)", error, get_error_string(error));
45         if (location) {
46             SkDebugf(" at\n\t%s", location);
47         }
48         if (call) {
49             SkDebugf("\n\t\t%s", call);
50         }
51         SkDebugf("\n");
52         if (error == GR_GL_OUT_OF_MEMORY) {
53             fOOMed = true;
54         }
55     }
56     return error;
57 }
58 
checkAndResetOOMed() const59 bool GrGLInterface::checkAndResetOOMed() const {
60     if (fOOMed) {
61         fOOMed = false;
62         return true;
63     }
64     return false;
65 }
66 
suppressErrorLogging()67 void GrGLInterface::suppressErrorLogging() { fSuppressErrorLogging = true; }
68 #endif
69 
70 #define RETURN_FALSE_INTERFACE                                                 \
71     SkDEBUGF("%s:%d GrGLInterface::validate() failed.\n", __FILE__, __LINE__); \
72     return false
73 
validate() const74 bool GrGLInterface::validate() const {
75 
76     if (kNone_GrGLStandard == fStandard) {
77         RETURN_FALSE_INTERFACE;
78     }
79 
80     if (!fExtensions.isInitialized()) {
81         RETURN_FALSE_INTERFACE;
82     }
83 
84     GrGLVersion glVer = GrGLGetVersion(this);
85     if (GR_GL_INVALID_VER == glVer) {
86         RETURN_FALSE_INTERFACE;
87     }
88     // Autogenerated content follows
89     if (!fFunctions.fActiveTexture ||
90         !fFunctions.fAttachShader ||
91         !fFunctions.fBindAttribLocation ||
92         !fFunctions.fBindBuffer ||
93         !fFunctions.fBindTexture ||
94         !fFunctions.fBlendColor ||
95         !fFunctions.fBlendEquation ||
96         !fFunctions.fBlendFunc ||
97         !fFunctions.fBufferData ||
98         !fFunctions.fBufferSubData ||
99         !fFunctions.fClear ||
100         !fFunctions.fClearColor ||
101         !fFunctions.fClearStencil ||
102         !fFunctions.fColorMask ||
103         !fFunctions.fCompileShader ||
104         !fFunctions.fCompressedTexImage2D ||
105         !fFunctions.fCompressedTexSubImage2D ||
106         !fFunctions.fCopyTexSubImage2D ||
107         !fFunctions.fCreateProgram ||
108         !fFunctions.fCreateShader ||
109         !fFunctions.fCullFace ||
110         !fFunctions.fDeleteBuffers ||
111         !fFunctions.fDeleteProgram ||
112         !fFunctions.fDeleteShader ||
113         !fFunctions.fDeleteTextures ||
114         !fFunctions.fDepthMask ||
115         !fFunctions.fDisable ||
116         !fFunctions.fDisableVertexAttribArray ||
117         !fFunctions.fDrawArrays ||
118         !fFunctions.fDrawElements ||
119         !fFunctions.fEnable ||
120         !fFunctions.fEnableVertexAttribArray ||
121         !fFunctions.fFinish ||
122         !fFunctions.fFlush ||
123         !fFunctions.fFrontFace ||
124         !fFunctions.fGenBuffers ||
125         !fFunctions.fGenTextures ||
126         !fFunctions.fGetBufferParameteriv ||
127         !fFunctions.fGetError ||
128         !fFunctions.fGetIntegerv ||
129         !fFunctions.fGetProgramInfoLog ||
130         !fFunctions.fGetProgramiv ||
131         !fFunctions.fGetShaderInfoLog ||
132         !fFunctions.fGetShaderiv ||
133         !fFunctions.fGetString ||
134         !fFunctions.fGetUniformLocation ||
135         !fFunctions.fIsTexture ||
136         !fFunctions.fLineWidth ||
137         !fFunctions.fLinkProgram ||
138         !fFunctions.fPixelStorei ||
139         !fFunctions.fReadPixels ||
140         !fFunctions.fScissor ||
141         !fFunctions.fShaderSource ||
142         !fFunctions.fStencilFunc ||
143         !fFunctions.fStencilFuncSeparate ||
144         !fFunctions.fStencilMask ||
145         !fFunctions.fStencilMaskSeparate ||
146         !fFunctions.fStencilOp ||
147         !fFunctions.fStencilOpSeparate ||
148         !fFunctions.fTexImage2D ||
149         !fFunctions.fTexParameterf ||
150         !fFunctions.fTexParameterfv ||
151         !fFunctions.fTexParameteri ||
152         !fFunctions.fTexParameteriv ||
153         !fFunctions.fTexSubImage2D ||
154         !fFunctions.fUniform1f ||
155         !fFunctions.fUniform1fv ||
156         !fFunctions.fUniform1i ||
157         !fFunctions.fUniform1iv ||
158         !fFunctions.fUniform2f ||
159         !fFunctions.fUniform2fv ||
160         !fFunctions.fUniform2i ||
161         !fFunctions.fUniform2iv ||
162         !fFunctions.fUniform3f ||
163         !fFunctions.fUniform3fv ||
164         !fFunctions.fUniform3i ||
165         !fFunctions.fUniform3iv ||
166         !fFunctions.fUniform4f ||
167         !fFunctions.fUniform4fv ||
168         !fFunctions.fUniform4i ||
169         !fFunctions.fUniform4iv ||
170         !fFunctions.fUniformMatrix2fv ||
171         !fFunctions.fUniformMatrix3fv ||
172         !fFunctions.fUniformMatrix4fv ||
173         !fFunctions.fUseProgram ||
174         !fFunctions.fVertexAttrib1f ||
175         !fFunctions.fVertexAttrib2fv ||
176         !fFunctions.fVertexAttrib3fv ||
177         !fFunctions.fVertexAttrib4fv ||
178         !fFunctions.fVertexAttribPointer ||
179         !fFunctions.fViewport) {
180         RETURN_FALSE_INTERFACE;
181     }
182 
183     if (GR_IS_GR_GL(fStandard)) {
184         if (!fFunctions.fDrawBuffer ||
185             !fFunctions.fPolygonMode) {
186             RETURN_FALSE_INTERFACE;
187         }
188     }
189 
190     if ((GR_IS_GR_GL(fStandard) && (
191           (glVer >= GR_GL_VER(3,0)))) ||
192        (GR_IS_GR_GL_ES(fStandard) && (
193           (glVer >= GR_GL_VER(3,0)))) ||
194        (GR_IS_GR_WEBGL(fStandard) && (
195           (glVer >= GR_GL_VER(2,0))))) {
196         if (!fFunctions.fGetStringi) {
197             RETURN_FALSE_INTERFACE;
198         }
199     }
200 
201     if ((GR_IS_GR_GL(fStandard) && (
202           (glVer >= GR_GL_VER(4,2)))) ||
203        (GR_IS_GR_GL_ES(fStandard) && (
204           (glVer >= GR_GL_VER(3,1))))) {
205         // all functions were marked optional or test_only
206     }
207 
208     if ((GR_IS_GR_GL(fStandard) && (
209           (glVer >= GR_GL_VER(3,0)) ||
210           fExtensions.has("GL_ARB_vertex_array_object") ||
211           fExtensions.has("GL_APPLE_vertex_array_object"))) ||
212        (GR_IS_GR_GL_ES(fStandard) && (
213           (glVer >= GR_GL_VER(3,0)) ||
214           fExtensions.has("GL_OES_vertex_array_object"))) ||
215        (GR_IS_GR_WEBGL(fStandard) && (
216           (glVer >= GR_GL_VER(2,0)) ||
217           fExtensions.has("GL_OES_vertex_array_object") ||
218           fExtensions.has("OES_vertex_array_object")))) {
219         if (!fFunctions.fBindVertexArray ||
220             !fFunctions.fDeleteVertexArrays ||
221             !fFunctions.fGenVertexArrays) {
222             RETURN_FALSE_INTERFACE;
223         }
224     }
225 
226     if ((GR_IS_GR_GL(fStandard) && (
227           (glVer >= GR_GL_VER(4,0)) ||
228           fExtensions.has("GL_ARB_tessellation_shader"))) ||
229        (GR_IS_GR_GL_ES(fStandard) && (
230           (glVer >= GR_GL_VER(3,2)) ||
231           fExtensions.has("GL_OES_tessellation_shader")))) {
232         if (!fFunctions.fPatchParameteri) {
233             RETURN_FALSE_INTERFACE;
234         }
235     }
236 
237     if ((GR_IS_GR_GL(fStandard) && (
238           (glVer >= GR_GL_VER(3,0)))) ||
239        (GR_IS_GR_GL_ES(fStandard) && (
240           (glVer >= GR_GL_VER(3,0) && fExtensions.has("GL_EXT_blend_func_extended"))))) {
241         if (!fFunctions.fBindFragDataLocation) {
242             RETURN_FALSE_INTERFACE;
243         }
244     }
245 
246     if ((GR_IS_GR_GL(fStandard) && (
247           (glVer >= GR_GL_VER(3,3)) ||
248           fExtensions.has("GL_ARB_blend_func_extended"))) ||
249        (GR_IS_GR_GL_ES(fStandard) && (
250           (glVer >= GR_GL_VER(3,0) && fExtensions.has("GL_EXT_blend_func_extended"))))) {
251         if (!fFunctions.fBindFragDataLocationIndexed) {
252             RETURN_FALSE_INTERFACE;
253         }
254     }
255 
256     if ((GR_IS_GR_GL(fStandard) && (
257           fExtensions.has("GL_KHR_blend_equation_advanced") ||
258           fExtensions.has("GL_NV_blend_equation_advanced"))) ||
259        (GR_IS_GR_GL_ES(fStandard) && (
260           fExtensions.has("GL_KHR_blend_equation_advanced") ||
261           fExtensions.has("GL_NV_blend_equation_advanced")))) {
262         if (!fFunctions.fBlendBarrier) {
263             RETURN_FALSE_INTERFACE;
264         }
265     }
266 
267     if ((GR_IS_GR_GL(fStandard) && (
268           (glVer >= GR_GL_VER(4,4)) ||
269           fExtensions.has("GL_ARB_clear_texture"))) ||
270        (GR_IS_GR_GL_ES(fStandard) && (
271           fExtensions.has("GL_EXT_clear_texture")))) {
272         // all functions were marked optional or test_only
273     }
274 
275     if ((GR_IS_GR_GL(fStandard) && (
276           (glVer >= GR_GL_VER(3,1)) ||
277           fExtensions.has("GL_ARB_draw_instanced") ||
278           fExtensions.has("GL_EXT_draw_instanced"))) ||
279        (GR_IS_GR_GL_ES(fStandard) && (
280           (glVer >= GR_GL_VER(3,0)) ||
281           fExtensions.has("GL_EXT_draw_instanced") ||
282           fExtensions.has("GL_ANGLE_instanced_arrays"))) ||
283        (GR_IS_GR_WEBGL(fStandard) && (
284           (glVer >= GR_GL_VER(2,0))))) {
285         if (!fFunctions.fDrawArraysInstanced ||
286             !fFunctions.fDrawElementsInstanced) {
287             RETURN_FALSE_INTERFACE;
288         }
289     }
290 
291     if ((GR_IS_GR_GL(fStandard) && (
292           (glVer >= GR_GL_VER(4,2)) ||
293           fExtensions.has("GL_ARB_base_instance"))) ||
294        (GR_IS_GR_GL_ES(fStandard) && (
295           fExtensions.has("GL_EXT_base_instance") ||
296           fExtensions.has("GL_ANGLE_base_vertex_base_instance"))) ||
297        (GR_IS_GR_WEBGL(fStandard) && (
298           fExtensions.has("GL_WEBGL_draw_instanced_base_vertex_base_instance")))) {
299         if (!fFunctions.fDrawArraysInstancedBaseInstance ||
300             !fFunctions.fDrawElementsInstancedBaseVertexBaseInstance) {
301             RETURN_FALSE_INTERFACE;
302         }
303     }
304 
305     if (GR_IS_GR_GL(fStandard) ||
306        (GR_IS_GR_GL_ES(fStandard) && (
307           (glVer >= GR_GL_VER(3,0)))) ||
308        (GR_IS_GR_WEBGL(fStandard) && (
309           (glVer >= GR_GL_VER(2,0))))) {
310         if (!fFunctions.fDrawBuffers ||
311             !fFunctions.fReadBuffer) {
312             RETURN_FALSE_INTERFACE;
313         }
314     }
315 
316     if ((GR_IS_GR_GL(fStandard) && (
317           (glVer >= GR_GL_VER(4,0)) ||
318           fExtensions.has("GL_ARB_draw_indirect"))) ||
319        (GR_IS_GR_GL_ES(fStandard) && (
320           (glVer >= GR_GL_VER(3,1))))) {
321         if (!fFunctions.fDrawArraysIndirect ||
322             !fFunctions.fDrawElementsIndirect) {
323             RETURN_FALSE_INTERFACE;
324         }
325     }
326 
327     if ((GR_IS_GR_GL_ES(fStandard) && (
328           fExtensions.has("GL_ANGLE_base_vertex_base_instance"))) ||
329        (GR_IS_GR_WEBGL(fStandard) && (
330           fExtensions.has("GL_WEBGL_multi_draw_instanced_base_vertex_base_instance")))) {
331         if (!fFunctions.fMultiDrawArraysInstancedBaseInstance ||
332             !fFunctions.fMultiDrawElementsInstancedBaseVertexBaseInstance) {
333             RETURN_FALSE_INTERFACE;
334         }
335     }
336 
337     if (GR_IS_GR_GL(fStandard) ||
338        (GR_IS_GR_GL_ES(fStandard) && (
339           (glVer >= GR_GL_VER(3,0)))) ||
340        (GR_IS_GR_WEBGL(fStandard) && (
341           (glVer >= GR_GL_VER(2,0))))) {
342         if (!fFunctions.fDrawRangeElements) {
343             RETURN_FALSE_INTERFACE;
344         }
345     }
346 
347     if ((GR_IS_GR_GL(fStandard) && (
348           (glVer >= GR_GL_VER(3,2)) ||
349           fExtensions.has("GL_ARB_texture_multisample"))) ||
350        (GR_IS_GR_GL_ES(fStandard) && (
351           (glVer >= GR_GL_VER(3,1))))) {
352         if (!fFunctions.fGetMultisamplefv) {
353             RETURN_FALSE_INTERFACE;
354         }
355     }
356 
357     if (GR_IS_GR_GL(fStandard) ||
358        (GR_IS_GR_GL_ES(fStandard) && (
359           (glVer >= GR_GL_VER(3,1))))) {
360         if (!fFunctions.fGetTexLevelParameteriv) {
361             RETURN_FALSE_INTERFACE;
362         }
363     }
364 
365     if ((GR_IS_GR_GL(fStandard) && (
366           (glVer >= GR_GL_VER(4,3)) ||
367           fExtensions.has("GL_ARB_multi_draw_indirect"))) ||
368        (GR_IS_GR_GL_ES(fStandard) && (
369           fExtensions.has("GL_EXT_multi_draw_indirect")))) {
370         if (!fFunctions.fMultiDrawArraysIndirect ||
371             !fFunctions.fMultiDrawElementsIndirect) {
372             RETURN_FALSE_INTERFACE;
373         }
374     }
375 
376     if ((GR_IS_GR_GL(fStandard) && (
377           (glVer >= GR_GL_VER(3,1)))) ||
378        (GR_IS_GR_GL_ES(fStandard) && (
379           (glVer >= GR_GL_VER(3,2)) ||
380           fExtensions.has("GL_OES_texture_buffer") ||
381           fExtensions.has("GL_EXT_texture_buffer")))) {
382         if (!fFunctions.fTexBuffer) {
383             RETURN_FALSE_INTERFACE;
384         }
385     }
386 
387     if ((GR_IS_GR_GL(fStandard) && (
388           (glVer >= GR_GL_VER(4,3)))) ||
389        (GR_IS_GR_GL_ES(fStandard) && (
390           (glVer >= GR_GL_VER(3,2)) ||
391           fExtensions.has("GL_OES_texture_buffer") ||
392           fExtensions.has("GL_EXT_texture_buffer")))) {
393         if (!fFunctions.fTexBufferRange) {
394             RETURN_FALSE_INTERFACE;
395         }
396     }
397 
398     if ((GR_IS_GR_GL(fStandard) && (
399           (glVer >= GR_GL_VER(4,2)) ||
400           fExtensions.has("GL_ARB_texture_storage") ||
401           fExtensions.has("GL_EXT_texture_storage"))) ||
402        (GR_IS_GR_GL_ES(fStandard) && (
403           (glVer >= GR_GL_VER(3,0)) ||
404           fExtensions.has("GL_EXT_texture_storage"))) ||
405        (GR_IS_GR_WEBGL(fStandard) && (
406           (glVer >= GR_GL_VER(2,0))))) {
407         if (!fFunctions.fTexStorage2D) {
408             RETURN_FALSE_INTERFACE;
409         }
410     }
411 
412     if ((GR_IS_GR_GL(fStandard) && (
413           (glVer >= GR_GL_VER(4,5)) ||
414           fExtensions.has("GL_ARB_texture_barrier") ||
415           fExtensions.has("GL_NV_texture_barrier"))) ||
416        (GR_IS_GR_GL_ES(fStandard) && (
417           fExtensions.has("GL_NV_texture_barrier")))) {
418         if (!fFunctions.fTextureBarrier) {
419             RETURN_FALSE_INTERFACE;
420         }
421     }
422 
423     if ((GR_IS_GR_GL_ES(fStandard) && (
424           fExtensions.has("GL_EXT_discard_framebuffer")))) {
425         if (!fFunctions.fDiscardFramebuffer) {
426             RETURN_FALSE_INTERFACE;
427         }
428     }
429 
430     if ((GR_IS_GR_GL_ES(fStandard) && (
431           fExtensions.has("GL_QCOM_tiled_rendering")))) {
432         // all functions were marked optional or test_only
433     }
434 
435     if ((GR_IS_GR_GL(fStandard) && (
436           (glVer >= GR_GL_VER(3,2)) ||
437           fExtensions.has("GL_ARB_instanced_arrays"))) ||
438        (GR_IS_GR_GL_ES(fStandard) && (
439           (glVer >= GR_GL_VER(3,0)) ||
440           fExtensions.has("GL_EXT_instanced_arrays") ||
441           fExtensions.has("GL_ANGLE_instanced_arrays"))) ||
442        (GR_IS_GR_WEBGL(fStandard) && (
443           (glVer >= GR_GL_VER(2,0))))) {
444         if (!fFunctions.fVertexAttribDivisor) {
445             RETURN_FALSE_INTERFACE;
446         }
447     }
448 
449     if ((GR_IS_GR_GL(fStandard) && (
450           (glVer >= GR_GL_VER(3,0)))) ||
451        (GR_IS_GR_GL_ES(fStandard) && (
452           (glVer >= GR_GL_VER(3,0)))) ||
453        (GR_IS_GR_WEBGL(fStandard) && (
454           (glVer >= GR_GL_VER(2,0))))) {
455         if (!fFunctions.fVertexAttribIPointer) {
456             RETURN_FALSE_INTERFACE;
457         }
458     }
459 
460     if ((GR_IS_GR_GL(fStandard) && (
461           (glVer >= GR_GL_VER(3,0)) ||
462           fExtensions.has("GL_ARB_framebuffer_object") ||
463           fExtensions.has("GL_EXT_framebuffer_object"))) ||
464        GR_IS_GR_GL_ES(fStandard) ||
465        GR_IS_GR_WEBGL(fStandard)) {
466         if (!fFunctions.fBindFramebuffer ||
467             !fFunctions.fBindRenderbuffer ||
468             !fFunctions.fCheckFramebufferStatus ||
469             !fFunctions.fDeleteFramebuffers ||
470             !fFunctions.fDeleteRenderbuffers ||
471             !fFunctions.fFramebufferRenderbuffer ||
472             !fFunctions.fFramebufferTexture2D ||
473             !fFunctions.fGenFramebuffers ||
474             !fFunctions.fGenRenderbuffers ||
475             !fFunctions.fGenerateMipmap ||
476             !fFunctions.fGetFramebufferAttachmentParameteriv ||
477             !fFunctions.fGetRenderbufferParameteriv ||
478             !fFunctions.fRenderbufferStorage) {
479             RETURN_FALSE_INTERFACE;
480         }
481     }
482 
483     if ((GR_IS_GR_GL(fStandard) && (
484           (glVer >= GR_GL_VER(3,0)) ||
485           fExtensions.has("GL_ARB_framebuffer_object") ||
486           fExtensions.has("GL_EXT_framebuffer_blit"))) ||
487        (GR_IS_GR_GL_ES(fStandard) && (
488           (glVer >= GR_GL_VER(3,0)) ||
489           fExtensions.has("GL_NV_framebuffer_blit") ||
490           fExtensions.has("GL_CHROMIUM_framebuffer_multisample") ||
491           fExtensions.has("GL_ANGLE_framebuffer_blit"))) ||
492        (GR_IS_GR_WEBGL(fStandard) && (
493           (glVer >= GR_GL_VER(2,0))))) {
494         if (!fFunctions.fBlitFramebuffer) {
495             RETURN_FALSE_INTERFACE;
496         }
497     }
498 
499     if ((GR_IS_GR_GL(fStandard) && (
500           (glVer >= GR_GL_VER(3,0)) ||
501           fExtensions.has("GL_ARB_framebuffer_object") ||
502           fExtensions.has("GL_EXT_framebuffer_multisample"))) ||
503        (GR_IS_GR_GL_ES(fStandard) && (
504           (glVer >= GR_GL_VER(3,0)) ||
505           fExtensions.has("GL_CHROMIUM_framebuffer_multisample") ||
506           fExtensions.has("GL_ANGLE_framebuffer_multisample"))) ||
507        (GR_IS_GR_WEBGL(fStandard) && (
508           (glVer >= GR_GL_VER(2,0))))) {
509         if (!fFunctions.fRenderbufferStorageMultisample) {
510             RETURN_FALSE_INTERFACE;
511         }
512     }
513 
514     if ((GR_IS_GR_GL_ES(fStandard) && (
515           fExtensions.has("GL_CHROMIUM_map_sub")))) {
516         if (!fFunctions.fMapBufferSubData ||
517             !fFunctions.fMapTexSubImage2D ||
518             !fFunctions.fUnmapBufferSubData ||
519             !fFunctions.fUnmapTexSubImage2D) {
520             RETURN_FALSE_INTERFACE;
521         }
522     }
523 
524     if ((GR_IS_GR_GL_ES(fStandard) && (
525           fExtensions.has("GL_EXT_multisampled_render_to_texture") ||
526           fExtensions.has("GL_IMG_multisampled_render_to_texture")))) {
527         if (!fFunctions.fFramebufferTexture2DMultisample) {
528             RETURN_FALSE_INTERFACE;
529         }
530     }
531 
532     if ((GR_IS_GR_GL_ES(fStandard) && (
533           fExtensions.has("GL_EXT_multisampled_render_to_texture")))) {
534         if (!fFunctions.fRenderbufferStorageMultisampleES2EXT) {
535             RETURN_FALSE_INTERFACE;
536         }
537     }
538 
539     if ((GR_IS_GR_GL_ES(fStandard) && (
540           fExtensions.has("GL_IMG_multisampled_render_to_texture")))) {
541         if (!fFunctions.fRenderbufferStorageMultisampleES2EXT) {
542             RETURN_FALSE_INTERFACE;
543         }
544     }
545 
546     if ((GR_IS_GR_GL_ES(fStandard) && (
547           fExtensions.has("GL_APPLE_framebuffer_multisample")))) {
548         if (!fFunctions.fResolveMultisampleFramebuffer ||
549             !fFunctions.fRenderbufferStorageMultisampleES2APPLE) {
550             RETURN_FALSE_INTERFACE;
551         }
552     }
553 
554     if (GR_IS_GR_GL(fStandard) ||
555        (GR_IS_GR_GL_ES(fStandard) && (
556           fExtensions.has("GL_OES_mapbuffer")))) {
557         if (!fFunctions.fMapBuffer) {
558             RETURN_FALSE_INTERFACE;
559         }
560     }
561 
562     if (GR_IS_GR_GL(fStandard) ||
563        (GR_IS_GR_GL_ES(fStandard) && (
564           (glVer >= GR_GL_VER(3,0)) ||
565           fExtensions.has("GL_OES_mapbuffer")))) {
566         if (!fFunctions.fUnmapBuffer) {
567             RETURN_FALSE_INTERFACE;
568         }
569     }
570 
571     if ((GR_IS_GR_GL(fStandard) && (
572           (glVer >= GR_GL_VER(3,0)) ||
573           fExtensions.has("GL_ARB_map_buffer_range"))) ||
574        (GR_IS_GR_GL_ES(fStandard) && (
575           (glVer >= GR_GL_VER(3,0)) ||
576           fExtensions.has("GL_EXT_map_buffer_range")))) {
577         if (!fFunctions.fFlushMappedBufferRange ||
578             !fFunctions.fMapBufferRange) {
579             RETURN_FALSE_INTERFACE;
580         }
581     }
582 
583     if ((GR_IS_GR_GL(fStandard) && (
584           fExtensions.has("GL_EXT_debug_marker"))) ||
585        (GR_IS_GR_GL_ES(fStandard) && (
586           fExtensions.has("GL_EXT_debug_marker")))) {
587         if (!fFunctions.fInsertEventMarker ||
588             !fFunctions.fPopGroupMarker ||
589             !fFunctions.fPushGroupMarker) {
590             RETURN_FALSE_INTERFACE;
591         }
592     }
593 
594     if ((GR_IS_GR_GL(fStandard) && (
595           fExtensions.has("GL_NV_framebuffer_mixed_samples"))) ||
596        (GR_IS_GR_GL_ES(fStandard) && (
597           fExtensions.has("GL_CHROMIUM_framebuffer_mixed_samples") ||
598           fExtensions.has("GL_NV_framebuffer_mixed_samples")))) {
599         if (!fFunctions.fCoverageModulation) {
600             RETURN_FALSE_INTERFACE;
601         }
602     }
603 
604     if ((GR_IS_GR_GL(fStandard) && (
605           (glVer >= GR_GL_VER(4,3)) ||
606           fExtensions.has("GL_KHR_debug"))) ||
607        (GR_IS_GR_GL_ES(fStandard) && (
608           fExtensions.has("GL_KHR_debug")))) {
609         if (!fFunctions.fDebugMessageCallback ||
610             !fFunctions.fDebugMessageControl ||
611             !fFunctions.fDebugMessageInsert ||
612             !fFunctions.fGetDebugMessageLog ||
613             !fFunctions.fObjectLabel ||
614             !fFunctions.fPopDebugGroup ||
615             !fFunctions.fPushDebugGroup) {
616             RETURN_FALSE_INTERFACE;
617         }
618     }
619 
620     if ((GR_IS_GR_GL_ES(fStandard) && (
621           fExtensions.has("GL_CHROMIUM_bind_uniform_location")))) {
622         if (!fFunctions.fBindUniformLocation) {
623             RETURN_FALSE_INTERFACE;
624         }
625     }
626 
627     if ((GR_IS_GR_GL(fStandard) && (
628           fExtensions.has("GL_EXT_window_rectangles"))) ||
629        (GR_IS_GR_GL_ES(fStandard) && (
630           fExtensions.has("GL_EXT_window_rectangles")))) {
631         if (!fFunctions.fWindowRectangles) {
632             RETURN_FALSE_INTERFACE;
633         }
634     }
635 
636     if ((GR_IS_GR_GL(fStandard) && (
637           (glVer >= GR_GL_VER(3,2)) ||
638           fExtensions.has("GL_ARB_sync"))) ||
639        (GR_IS_GR_GL_ES(fStandard) && (
640           (glVer >= GR_GL_VER(3,0)) ||
641           fExtensions.has("GL_APPLE_sync"))) ||
642        (GR_IS_GR_WEBGL(fStandard) && (
643           (glVer >= GR_GL_VER(2,0))))) {
644         if (!fFunctions.fClientWaitSync ||
645             !fFunctions.fDeleteSync ||
646             !fFunctions.fFenceSync ||
647             !fFunctions.fIsSync ||
648             !fFunctions.fWaitSync) {
649             RETURN_FALSE_INTERFACE;
650         }
651     }
652 
653     if ((GR_IS_GR_GL(fStandard) && (
654           (glVer >= GR_GL_VER(4,2)) ||
655           fExtensions.has("GL_ARB_internalformat_query"))) ||
656        (GR_IS_GR_GL_ES(fStandard) && (
657           (glVer >= GR_GL_VER(3,0))))) {
658         if (!fFunctions.fGetInternalformativ) {
659             RETURN_FALSE_INTERFACE;
660         }
661     }
662 
663     if ((GR_IS_GR_GL(fStandard) && (
664           (glVer >= GR_GL_VER(4,1)))) ||
665        (GR_IS_GR_GL_ES(fStandard) && (
666           (glVer >= GR_GL_VER(3,0)) ||
667           fExtensions.has("GL_OES_get_program_binary")))) {
668         if (!fFunctions.fGetProgramBinary ||
669             !fFunctions.fProgramBinary) {
670             RETURN_FALSE_INTERFACE;
671         }
672     }
673 
674     if ((GR_IS_GR_GL(fStandard) && (
675           (glVer >= GR_GL_VER(4,1)))) ||
676        (GR_IS_GR_GL_ES(fStandard) && (
677           (glVer >= GR_GL_VER(3,0))))) {
678         if (!fFunctions.fProgramParameteri) {
679             RETURN_FALSE_INTERFACE;
680         }
681     }
682 
683     if ((GR_IS_GR_GL(fStandard) && (
684           (glVer >= GR_GL_VER(3,2)) ||
685           fExtensions.has("GL_ARB_sampler_objects"))) ||
686        (GR_IS_GR_GL_ES(fStandard) && (
687           (glVer >= GR_GL_VER(3,0)))) ||
688        (GR_IS_GR_WEBGL(fStandard) && (
689           (glVer >= GR_GL_VER(2,0))))) {
690         if (!fFunctions.fBindSampler ||
691             !fFunctions.fDeleteSamplers ||
692             !fFunctions.fGenSamplers ||
693             !fFunctions.fSamplerParameteri ||
694             !fFunctions.fSamplerParameteriv) {
695             RETURN_FALSE_INTERFACE;
696         }
697     }
698 
699     if (GR_IS_GR_GL(fStandard)) {
700         if (!fFunctions.fGetQueryObjectiv) {
701             RETURN_FALSE_INTERFACE;
702         }
703     }
704 
705     if (GR_IS_GR_GL(fStandard) ||
706        (GR_IS_GR_GL_ES(fStandard) && (
707           (glVer >= GR_GL_VER(3,0)) ||
708           fExtensions.has("GL_EXT_occlusion_query_boolean")))) {
709 #if GR_TEST_UTILS
710         if (!fFunctions.fBeginQuery ||
711             !fFunctions.fDeleteQueries ||
712             !fFunctions.fEndQuery ||
713             !fFunctions.fGenQueries ||
714             !fFunctions.fGetQueryObjectuiv ||
715             !fFunctions.fGetQueryiv) {
716             RETURN_FALSE_INTERFACE;
717         }
718 #endif
719         // all functions were marked optional or test_only
720     }
721 
722     if ((GR_IS_GR_GL(fStandard) && (
723           (glVer >= GR_GL_VER(3,3)) ||
724           fExtensions.has("GL_ARB_timer_query") ||
725           fExtensions.has("GL_EXT_timer_query")))) {
726         if (!fFunctions.fGetQueryObjecti64v ||
727             !fFunctions.fGetQueryObjectui64v) {
728             RETURN_FALSE_INTERFACE;
729         }
730     }
731 
732     if ((GR_IS_GR_GL(fStandard) && (
733           (glVer >= GR_GL_VER(3,3)) ||
734           fExtensions.has("GL_ARB_timer_query")))) {
735         if (!fFunctions.fQueryCounter) {
736             RETURN_FALSE_INTERFACE;
737         }
738     }
739 
740     if ((GR_IS_GR_GL(fStandard) && (
741           (glVer >= GR_GL_VER(4,3)) ||
742           fExtensions.has("GL_ARB_invalidate_subdata")))) {
743         if (!fFunctions.fInvalidateBufferData ||
744             !fFunctions.fInvalidateBufferSubData ||
745             !fFunctions.fInvalidateTexImage ||
746             !fFunctions.fInvalidateTexSubImage) {
747             RETURN_FALSE_INTERFACE;
748         }
749     }
750 
751     if ((GR_IS_GR_GL(fStandard) && (
752           (glVer >= GR_GL_VER(4,3)) ||
753           fExtensions.has("GL_ARB_invalidate_subdata"))) ||
754        (GR_IS_GR_GL_ES(fStandard) && (
755           (glVer >= GR_GL_VER(3,0)))) ||
756        (GR_IS_GR_WEBGL(fStandard) && (
757           (glVer >= GR_GL_VER(2,0))))) {
758         if (!fFunctions.fInvalidateFramebuffer ||
759             !fFunctions.fInvalidateSubFramebuffer) {
760             RETURN_FALSE_INTERFACE;
761         }
762     }
763 
764     if ((GR_IS_GR_GL(fStandard) && (
765           (glVer >= GR_GL_VER(4,3)) ||
766           fExtensions.has("GL_ARB_ES2_compatibility"))) ||
767        GR_IS_GR_GL_ES(fStandard) ||
768        GR_IS_GR_WEBGL(fStandard)) {
769         if (!fFunctions.fGetShaderPrecisionFormat) {
770             RETURN_FALSE_INTERFACE;
771         }
772     }
773 
774     if ((GR_IS_GR_GL(fStandard) && (
775           fExtensions.has("GL_NV_fence"))) ||
776        (GR_IS_GR_GL_ES(fStandard) && (
777           fExtensions.has("GL_NV_fence")))) {
778         if (!fFunctions.fDeleteFences ||
779             !fFunctions.fFinishFence ||
780             !fFunctions.fGenFences ||
781             !fFunctions.fSetFence ||
782             !fFunctions.fTestFence) {
783             RETURN_FALSE_INTERFACE;
784         }
785     }
786 
787 
788     // End autogenerated content
789     return true;
790 }
791 
792 #if GR_TEST_UTILS
793 
abandon() const794 void GrGLInterface::abandon() const {
795     const_cast<GrGLInterface*>(this)->fFunctions = GrGLInterface::Functions();
796 }
797 
798 #endif // GR_TEST_UTILS
799