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