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/ganesh/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.fGetFloatv ||
129 !fFunctions.fGetIntegerv ||
130 !fFunctions.fGetProgramInfoLog ||
131 !fFunctions.fGetProgramiv ||
132 !fFunctions.fGetShaderInfoLog ||
133 !fFunctions.fGetShaderiv ||
134 !fFunctions.fGetString ||
135 !fFunctions.fGetUniformLocation ||
136 !fFunctions.fIsTexture ||
137 !fFunctions.fLineWidth ||
138 !fFunctions.fLinkProgram ||
139 !fFunctions.fPixelStorei ||
140 !fFunctions.fReadPixels ||
141 !fFunctions.fScissor ||
142 !fFunctions.fShaderSource ||
143 !fFunctions.fStencilFunc ||
144 !fFunctions.fStencilFuncSeparate ||
145 !fFunctions.fStencilMask ||
146 !fFunctions.fStencilMaskSeparate ||
147 !fFunctions.fStencilOp ||
148 !fFunctions.fStencilOpSeparate ||
149 !fFunctions.fTexImage2D ||
150 !fFunctions.fTexParameterf ||
151 !fFunctions.fTexParameterfv ||
152 !fFunctions.fTexParameteri ||
153 !fFunctions.fTexParameteriv ||
154 !fFunctions.fTexSubImage2D ||
155 !fFunctions.fUniform1f ||
156 !fFunctions.fUniform1fv ||
157 !fFunctions.fUniform1i ||
158 !fFunctions.fUniform1iv ||
159 !fFunctions.fUniform2f ||
160 !fFunctions.fUniform2fv ||
161 !fFunctions.fUniform2i ||
162 !fFunctions.fUniform2iv ||
163 !fFunctions.fUniform3f ||
164 !fFunctions.fUniform3fv ||
165 !fFunctions.fUniform3i ||
166 !fFunctions.fUniform3iv ||
167 !fFunctions.fUniform4f ||
168 !fFunctions.fUniform4fv ||
169 !fFunctions.fUniform4i ||
170 !fFunctions.fUniform4iv ||
171 !fFunctions.fUniformMatrix2fv ||
172 !fFunctions.fUniformMatrix3fv ||
173 !fFunctions.fUniformMatrix4fv ||
174 !fFunctions.fUseProgram ||
175 !fFunctions.fVertexAttrib1f ||
176 !fFunctions.fVertexAttrib2fv ||
177 !fFunctions.fVertexAttrib3fv ||
178 !fFunctions.fVertexAttrib4fv ||
179 !fFunctions.fVertexAttribPointer ||
180 !fFunctions.fViewport) {
181 RETURN_FALSE_INTERFACE;
182 }
183
184 if (GR_IS_GR_GL(fStandard)) {
185 if (!fFunctions.fDrawBuffer ||
186 !fFunctions.fPolygonMode) {
187 RETURN_FALSE_INTERFACE;
188 }
189 }
190
191 if ((GR_IS_GR_GL(fStandard) && (
192 (glVer >= GR_GL_VER(3,0)))) ||
193 (GR_IS_GR_GL_ES(fStandard) && (
194 (glVer >= GR_GL_VER(3,0)))) ||
195 (GR_IS_GR_WEBGL(fStandard) && (
196 (glVer >= GR_GL_VER(2,0))))) {
197 if (!fFunctions.fGetStringi) {
198 RETURN_FALSE_INTERFACE;
199 }
200 }
201
202 if ((GR_IS_GR_GL(fStandard) && (
203 (glVer >= GR_GL_VER(4,2)))) ||
204 (GR_IS_GR_GL_ES(fStandard) && (
205 (glVer >= GR_GL_VER(3,1))))) {
206 // all functions were marked optional or test_only
207 }
208
209 if ((GR_IS_GR_GL(fStandard) && (
210 (glVer >= GR_GL_VER(3,0)) ||
211 fExtensions.has("GL_ARB_vertex_array_object") ||
212 fExtensions.has("GL_APPLE_vertex_array_object"))) ||
213 (GR_IS_GR_GL_ES(fStandard) && (
214 (glVer >= GR_GL_VER(3,0)) ||
215 fExtensions.has("GL_OES_vertex_array_object"))) ||
216 (GR_IS_GR_WEBGL(fStandard) && (
217 (glVer >= GR_GL_VER(2,0)) ||
218 fExtensions.has("GL_OES_vertex_array_object") ||
219 fExtensions.has("OES_vertex_array_object")))) {
220 if (!fFunctions.fBindVertexArray ||
221 !fFunctions.fDeleteVertexArrays ||
222 !fFunctions.fGenVertexArrays) {
223 RETURN_FALSE_INTERFACE;
224 }
225 }
226
227 if ((GR_IS_GR_GL(fStandard) && (
228 (glVer >= GR_GL_VER(4,0)) ||
229 fExtensions.has("GL_ARB_tessellation_shader"))) ||
230 (GR_IS_GR_GL_ES(fStandard) && (
231 (glVer >= GR_GL_VER(3,2)) ||
232 fExtensions.has("GL_OES_tessellation_shader")))) {
233 if (!fFunctions.fPatchParameteri) {
234 RETURN_FALSE_INTERFACE;
235 }
236 }
237
238 if ((GR_IS_GR_GL(fStandard) && (
239 (glVer >= GR_GL_VER(3,0)))) ||
240 (GR_IS_GR_GL_ES(fStandard) && (
241 (glVer >= GR_GL_VER(3,0) && fExtensions.has("GL_EXT_blend_func_extended"))))) {
242 if (!fFunctions.fBindFragDataLocation) {
243 RETURN_FALSE_INTERFACE;
244 }
245 }
246
247 if ((GR_IS_GR_GL(fStandard) && (
248 (glVer >= GR_GL_VER(3,3)) ||
249 fExtensions.has("GL_ARB_blend_func_extended"))) ||
250 (GR_IS_GR_GL_ES(fStandard) && (
251 (glVer >= GR_GL_VER(3,0) && fExtensions.has("GL_EXT_blend_func_extended"))))) {
252 if (!fFunctions.fBindFragDataLocationIndexed) {
253 RETURN_FALSE_INTERFACE;
254 }
255 }
256
257 if ((GR_IS_GR_GL(fStandard) && (
258 fExtensions.has("GL_KHR_blend_equation_advanced") ||
259 fExtensions.has("GL_NV_blend_equation_advanced"))) ||
260 (GR_IS_GR_GL_ES(fStandard) && (
261 fExtensions.has("GL_KHR_blend_equation_advanced") ||
262 fExtensions.has("GL_NV_blend_equation_advanced")))) {
263 if (!fFunctions.fBlendBarrier) {
264 RETURN_FALSE_INTERFACE;
265 }
266 }
267
268 if ((GR_IS_GR_GL(fStandard) && (
269 (glVer >= GR_GL_VER(4,4)) ||
270 fExtensions.has("GL_ARB_clear_texture"))) ||
271 (GR_IS_GR_GL_ES(fStandard) && (
272 fExtensions.has("GL_EXT_clear_texture")))) {
273 // all functions were marked optional or test_only
274 }
275
276 if ((GR_IS_GR_GL(fStandard) && (
277 (glVer >= GR_GL_VER(3,1)) ||
278 fExtensions.has("GL_ARB_draw_instanced") ||
279 fExtensions.has("GL_EXT_draw_instanced"))) ||
280 (GR_IS_GR_GL_ES(fStandard) && (
281 (glVer >= GR_GL_VER(3,0)) ||
282 fExtensions.has("GL_EXT_draw_instanced") ||
283 fExtensions.has("GL_ANGLE_instanced_arrays"))) ||
284 (GR_IS_GR_WEBGL(fStandard) && (
285 (glVer >= GR_GL_VER(2,0))))) {
286 if (!fFunctions.fDrawArraysInstanced ||
287 !fFunctions.fDrawElementsInstanced) {
288 RETURN_FALSE_INTERFACE;
289 }
290 }
291
292 if ((GR_IS_GR_GL(fStandard) && (
293 (glVer >= GR_GL_VER(4,2)) ||
294 fExtensions.has("GL_ARB_base_instance"))) ||
295 (GR_IS_GR_GL_ES(fStandard) && (
296 fExtensions.has("GL_EXT_base_instance") ||
297 fExtensions.has("GL_ANGLE_base_vertex_base_instance"))) ||
298 (GR_IS_GR_WEBGL(fStandard) && (
299 fExtensions.has("GL_WEBGL_draw_instanced_base_vertex_base_instance")))) {
300 if (!fFunctions.fDrawArraysInstancedBaseInstance ||
301 !fFunctions.fDrawElementsInstancedBaseVertexBaseInstance) {
302 RETURN_FALSE_INTERFACE;
303 }
304 }
305
306 if (GR_IS_GR_GL(fStandard) ||
307 (GR_IS_GR_GL_ES(fStandard) && (
308 (glVer >= GR_GL_VER(3,0)))) ||
309 (GR_IS_GR_WEBGL(fStandard) && (
310 (glVer >= GR_GL_VER(2,0))))) {
311 if (!fFunctions.fDrawBuffers ||
312 !fFunctions.fReadBuffer) {
313 RETURN_FALSE_INTERFACE;
314 }
315 }
316
317 if ((GR_IS_GR_GL(fStandard) && (
318 (glVer >= GR_GL_VER(4,0)) ||
319 fExtensions.has("GL_ARB_draw_indirect"))) ||
320 (GR_IS_GR_GL_ES(fStandard) && (
321 (glVer >= GR_GL_VER(3,1))))) {
322 if (!fFunctions.fDrawArraysIndirect ||
323 !fFunctions.fDrawElementsIndirect) {
324 RETURN_FALSE_INTERFACE;
325 }
326 }
327
328 if ((GR_IS_GR_GL_ES(fStandard) && (
329 fExtensions.has("GL_ANGLE_base_vertex_base_instance"))) ||
330 (GR_IS_GR_WEBGL(fStandard) && (
331 fExtensions.has("GL_WEBGL_multi_draw_instanced_base_vertex_base_instance")))) {
332 if (!fFunctions.fMultiDrawArraysInstancedBaseInstance ||
333 !fFunctions.fMultiDrawElementsInstancedBaseVertexBaseInstance) {
334 RETURN_FALSE_INTERFACE;
335 }
336 }
337
338 if (GR_IS_GR_GL(fStandard) ||
339 (GR_IS_GR_GL_ES(fStandard) && (
340 (glVer >= GR_GL_VER(3,0)))) ||
341 (GR_IS_GR_WEBGL(fStandard) && (
342 (glVer >= GR_GL_VER(2,0))))) {
343 if (!fFunctions.fDrawRangeElements) {
344 RETURN_FALSE_INTERFACE;
345 }
346 }
347
348 if ((GR_IS_GR_GL(fStandard) && (
349 (glVer >= GR_GL_VER(3,2)) ||
350 fExtensions.has("GL_ARB_texture_multisample"))) ||
351 (GR_IS_GR_GL_ES(fStandard) && (
352 (glVer >= GR_GL_VER(3,1))))) {
353 if (!fFunctions.fGetMultisamplefv) {
354 RETURN_FALSE_INTERFACE;
355 }
356 }
357
358 if (GR_IS_GR_GL(fStandard) ||
359 (GR_IS_GR_GL_ES(fStandard) && (
360 (glVer >= GR_GL_VER(3,1))))) {
361 if (!fFunctions.fGetTexLevelParameteriv) {
362 RETURN_FALSE_INTERFACE;
363 }
364 }
365
366 if ((GR_IS_GR_GL(fStandard) && (
367 (glVer >= GR_GL_VER(4,3)) ||
368 fExtensions.has("GL_ARB_multi_draw_indirect"))) ||
369 (GR_IS_GR_GL_ES(fStandard) && (
370 fExtensions.has("GL_EXT_multi_draw_indirect")))) {
371 if (!fFunctions.fMultiDrawArraysIndirect ||
372 !fFunctions.fMultiDrawElementsIndirect) {
373 RETURN_FALSE_INTERFACE;
374 }
375 }
376
377 if ((GR_IS_GR_GL(fStandard) && (
378 (glVer >= GR_GL_VER(3,1)))) ||
379 (GR_IS_GR_GL_ES(fStandard) && (
380 (glVer >= GR_GL_VER(3,2)) ||
381 fExtensions.has("GL_OES_texture_buffer") ||
382 fExtensions.has("GL_EXT_texture_buffer")))) {
383 if (!fFunctions.fTexBuffer) {
384 RETURN_FALSE_INTERFACE;
385 }
386 }
387
388 if ((GR_IS_GR_GL(fStandard) && (
389 (glVer >= GR_GL_VER(4,3)))) ||
390 (GR_IS_GR_GL_ES(fStandard) && (
391 (glVer >= GR_GL_VER(3,2)) ||
392 fExtensions.has("GL_OES_texture_buffer") ||
393 fExtensions.has("GL_EXT_texture_buffer")))) {
394 if (!fFunctions.fTexBufferRange) {
395 RETURN_FALSE_INTERFACE;
396 }
397 }
398
399 if ((GR_IS_GR_GL(fStandard) && (
400 (glVer >= GR_GL_VER(4,2)) ||
401 fExtensions.has("GL_ARB_texture_storage") ||
402 fExtensions.has("GL_EXT_texture_storage"))) ||
403 (GR_IS_GR_GL_ES(fStandard) && (
404 (glVer >= GR_GL_VER(3,0)) ||
405 fExtensions.has("GL_EXT_texture_storage"))) ||
406 (GR_IS_GR_WEBGL(fStandard) && (
407 (glVer >= GR_GL_VER(2,0))))) {
408 if (!fFunctions.fTexStorage2D) {
409 RETURN_FALSE_INTERFACE;
410 }
411 }
412
413 if ((GR_IS_GR_GL(fStandard) && (
414 (glVer >= GR_GL_VER(4,5)) ||
415 fExtensions.has("GL_ARB_texture_barrier") ||
416 fExtensions.has("GL_NV_texture_barrier"))) ||
417 (GR_IS_GR_GL_ES(fStandard) && (
418 fExtensions.has("GL_NV_texture_barrier")))) {
419 if (!fFunctions.fTextureBarrier) {
420 RETURN_FALSE_INTERFACE;
421 }
422 }
423
424 if ((GR_IS_GR_GL_ES(fStandard) && (
425 fExtensions.has("GL_EXT_discard_framebuffer")))) {
426 if (!fFunctions.fDiscardFramebuffer) {
427 RETURN_FALSE_INTERFACE;
428 }
429 }
430
431 if ((GR_IS_GR_GL_ES(fStandard) && (
432 fExtensions.has("GL_QCOM_tiled_rendering")))) {
433 // all functions were marked optional or test_only
434 }
435
436 if ((GR_IS_GR_GL(fStandard) && (
437 (glVer >= GR_GL_VER(3,2)) ||
438 fExtensions.has("GL_ARB_instanced_arrays"))) ||
439 (GR_IS_GR_GL_ES(fStandard) && (
440 (glVer >= GR_GL_VER(3,0)) ||
441 fExtensions.has("GL_EXT_instanced_arrays") ||
442 fExtensions.has("GL_ANGLE_instanced_arrays"))) ||
443 (GR_IS_GR_WEBGL(fStandard) && (
444 (glVer >= GR_GL_VER(2,0))))) {
445 if (!fFunctions.fVertexAttribDivisor) {
446 RETURN_FALSE_INTERFACE;
447 }
448 }
449
450 if ((GR_IS_GR_GL(fStandard) && (
451 (glVer >= GR_GL_VER(3,0)))) ||
452 (GR_IS_GR_GL_ES(fStandard) && (
453 (glVer >= GR_GL_VER(3,0)))) ||
454 (GR_IS_GR_WEBGL(fStandard) && (
455 (glVer >= GR_GL_VER(2,0))))) {
456 if (!fFunctions.fVertexAttribIPointer) {
457 RETURN_FALSE_INTERFACE;
458 }
459 }
460
461 if ((GR_IS_GR_GL(fStandard) && (
462 (glVer >= GR_GL_VER(3,0)) ||
463 fExtensions.has("GL_ARB_framebuffer_object") ||
464 fExtensions.has("GL_EXT_framebuffer_object"))) ||
465 GR_IS_GR_GL_ES(fStandard) ||
466 GR_IS_GR_WEBGL(fStandard)) {
467 if (!fFunctions.fBindFramebuffer ||
468 !fFunctions.fBindRenderbuffer ||
469 !fFunctions.fCheckFramebufferStatus ||
470 !fFunctions.fDeleteFramebuffers ||
471 !fFunctions.fDeleteRenderbuffers ||
472 !fFunctions.fFramebufferRenderbuffer ||
473 !fFunctions.fFramebufferTexture2D ||
474 !fFunctions.fGenFramebuffers ||
475 !fFunctions.fGenRenderbuffers ||
476 !fFunctions.fGenerateMipmap ||
477 !fFunctions.fGetFramebufferAttachmentParameteriv ||
478 !fFunctions.fGetRenderbufferParameteriv ||
479 !fFunctions.fRenderbufferStorage) {
480 RETURN_FALSE_INTERFACE;
481 }
482 }
483
484 if ((GR_IS_GR_GL(fStandard) && (
485 (glVer >= GR_GL_VER(3,0)) ||
486 fExtensions.has("GL_ARB_framebuffer_object") ||
487 fExtensions.has("GL_EXT_framebuffer_blit"))) ||
488 (GR_IS_GR_GL_ES(fStandard) && (
489 (glVer >= GR_GL_VER(3,0)) ||
490 fExtensions.has("GL_NV_framebuffer_blit") ||
491 fExtensions.has("GL_CHROMIUM_framebuffer_multisample") ||
492 fExtensions.has("GL_ANGLE_framebuffer_blit"))) ||
493 (GR_IS_GR_WEBGL(fStandard) && (
494 (glVer >= GR_GL_VER(2,0))))) {
495 if (!fFunctions.fBlitFramebuffer) {
496 RETURN_FALSE_INTERFACE;
497 }
498 }
499
500 if ((GR_IS_GR_GL(fStandard) && (
501 (glVer >= GR_GL_VER(3,0)) ||
502 fExtensions.has("GL_ARB_framebuffer_object") ||
503 fExtensions.has("GL_EXT_framebuffer_multisample"))) ||
504 (GR_IS_GR_GL_ES(fStandard) && (
505 (glVer >= GR_GL_VER(3,0)) ||
506 fExtensions.has("GL_CHROMIUM_framebuffer_multisample") ||
507 fExtensions.has("GL_ANGLE_framebuffer_multisample"))) ||
508 (GR_IS_GR_WEBGL(fStandard) && (
509 (glVer >= GR_GL_VER(2,0))))) {
510 if (!fFunctions.fRenderbufferStorageMultisample) {
511 RETURN_FALSE_INTERFACE;
512 }
513 }
514
515 if ((GR_IS_GR_GL_ES(fStandard) && (
516 fExtensions.has("GL_CHROMIUM_map_sub")))) {
517 if (!fFunctions.fMapBufferSubData ||
518 !fFunctions.fMapTexSubImage2D ||
519 !fFunctions.fUnmapBufferSubData ||
520 !fFunctions.fUnmapTexSubImage2D) {
521 RETURN_FALSE_INTERFACE;
522 }
523 }
524
525 if ((GR_IS_GR_GL_ES(fStandard) && (
526 fExtensions.has("GL_EXT_multisampled_render_to_texture") ||
527 fExtensions.has("GL_IMG_multisampled_render_to_texture")))) {
528 if (!fFunctions.fFramebufferTexture2DMultisample) {
529 RETURN_FALSE_INTERFACE;
530 }
531 }
532
533 if ((GR_IS_GR_GL_ES(fStandard) && (
534 fExtensions.has("GL_EXT_multisampled_render_to_texture")))) {
535 if (!fFunctions.fRenderbufferStorageMultisampleES2EXT) {
536 RETURN_FALSE_INTERFACE;
537 }
538 }
539
540 if ((GR_IS_GR_GL_ES(fStandard) && (
541 fExtensions.has("GL_IMG_multisampled_render_to_texture")))) {
542 if (!fFunctions.fRenderbufferStorageMultisampleES2EXT) {
543 RETURN_FALSE_INTERFACE;
544 }
545 }
546
547 if ((GR_IS_GR_GL_ES(fStandard) && (
548 fExtensions.has("GL_APPLE_framebuffer_multisample")))) {
549 if (!fFunctions.fResolveMultisampleFramebuffer ||
550 !fFunctions.fRenderbufferStorageMultisampleES2APPLE) {
551 RETURN_FALSE_INTERFACE;
552 }
553 }
554
555 if (GR_IS_GR_GL(fStandard) ||
556 (GR_IS_GR_GL_ES(fStandard) && (
557 fExtensions.has("GL_OES_mapbuffer")))) {
558 if (!fFunctions.fMapBuffer) {
559 RETURN_FALSE_INTERFACE;
560 }
561 }
562
563 if (GR_IS_GR_GL(fStandard) ||
564 (GR_IS_GR_GL_ES(fStandard) && (
565 (glVer >= GR_GL_VER(3,0)) ||
566 fExtensions.has("GL_OES_mapbuffer")))) {
567 if (!fFunctions.fUnmapBuffer) {
568 RETURN_FALSE_INTERFACE;
569 }
570 }
571
572 if ((GR_IS_GR_GL(fStandard) && (
573 (glVer >= GR_GL_VER(3,0)) ||
574 fExtensions.has("GL_ARB_map_buffer_range"))) ||
575 (GR_IS_GR_GL_ES(fStandard) && (
576 (glVer >= GR_GL_VER(3,0)) ||
577 fExtensions.has("GL_EXT_map_buffer_range")))) {
578 if (!fFunctions.fFlushMappedBufferRange ||
579 !fFunctions.fMapBufferRange) {
580 RETURN_FALSE_INTERFACE;
581 }
582 }
583
584 if ((GR_IS_GR_GL(fStandard) && (
585 fExtensions.has("GL_EXT_debug_marker"))) ||
586 (GR_IS_GR_GL_ES(fStandard) && (
587 fExtensions.has("GL_EXT_debug_marker")))) {
588 if (!fFunctions.fInsertEventMarker ||
589 !fFunctions.fPopGroupMarker ||
590 !fFunctions.fPushGroupMarker) {
591 RETURN_FALSE_INTERFACE;
592 }
593 }
594
595 if ((GR_IS_GR_GL(fStandard) && (
596 (glVer >= GR_GL_VER(3,1)) ||
597 fExtensions.has("GL_ARB_copy_buffer"))) ||
598 (GR_IS_GR_GL_ES(fStandard) && (
599 (glVer >= GR_GL_VER(3,0)) ||
600 fExtensions.has("GL_NV_copy_buffer"))) ||
601 (GR_IS_GR_WEBGL(fStandard) && (
602 (glVer >= GR_GL_VER(2,0))))) {
603 if (!fFunctions.fCopyBufferSubData) {
604 RETURN_FALSE_INTERFACE;
605 }
606 }
607
608 if ((GR_IS_GR_GL(fStandard) && (
609 (glVer >= GR_GL_VER(4,3)) ||
610 fExtensions.has("GL_KHR_debug"))) ||
611 (GR_IS_GR_GL_ES(fStandard) && (
612 fExtensions.has("GL_KHR_debug")))) {
613 if (!fFunctions.fDebugMessageCallback ||
614 !fFunctions.fDebugMessageControl ||
615 !fFunctions.fDebugMessageInsert ||
616 !fFunctions.fGetDebugMessageLog ||
617 !fFunctions.fObjectLabel ||
618 !fFunctions.fPopDebugGroup ||
619 !fFunctions.fPushDebugGroup) {
620 RETURN_FALSE_INTERFACE;
621 }
622 }
623
624 if ((GR_IS_GR_GL_ES(fStandard) && (
625 fExtensions.has("GL_CHROMIUM_bind_uniform_location")))) {
626 if (!fFunctions.fBindUniformLocation) {
627 RETURN_FALSE_INTERFACE;
628 }
629 }
630
631 if ((GR_IS_GR_GL(fStandard) && (
632 fExtensions.has("GL_EXT_window_rectangles"))) ||
633 (GR_IS_GR_GL_ES(fStandard) && (
634 fExtensions.has("GL_EXT_window_rectangles")))) {
635 if (!fFunctions.fWindowRectangles) {
636 RETURN_FALSE_INTERFACE;
637 }
638 }
639
640 if ((GR_IS_GR_GL(fStandard) && (
641 (glVer >= GR_GL_VER(3,2)) ||
642 fExtensions.has("GL_ARB_sync"))) ||
643 (GR_IS_GR_GL_ES(fStandard) && (
644 (glVer >= GR_GL_VER(3,0)) ||
645 fExtensions.has("GL_APPLE_sync"))) ||
646 (GR_IS_GR_WEBGL(fStandard) && (
647 (glVer >= GR_GL_VER(2,0))))) {
648 if (!fFunctions.fClientWaitSync ||
649 !fFunctions.fDeleteSync ||
650 !fFunctions.fFenceSync ||
651 !fFunctions.fIsSync ||
652 !fFunctions.fWaitSync) {
653 RETURN_FALSE_INTERFACE;
654 }
655 }
656
657 if ((GR_IS_GR_GL(fStandard) && (
658 (glVer >= GR_GL_VER(4,2)) ||
659 fExtensions.has("GL_ARB_internalformat_query"))) ||
660 (GR_IS_GR_GL_ES(fStandard) && (
661 (glVer >= GR_GL_VER(3,0))))) {
662 if (!fFunctions.fGetInternalformativ) {
663 RETURN_FALSE_INTERFACE;
664 }
665 }
666
667 if ((GR_IS_GR_GL(fStandard) && (
668 (glVer >= GR_GL_VER(4,1)))) ||
669 (GR_IS_GR_GL_ES(fStandard) && (
670 (glVer >= GR_GL_VER(3,0)) ||
671 fExtensions.has("GL_OES_get_program_binary")))) {
672 if (!fFunctions.fGetProgramBinary ||
673 !fFunctions.fProgramBinary) {
674 RETURN_FALSE_INTERFACE;
675 }
676 }
677
678 if ((GR_IS_GR_GL(fStandard) && (
679 (glVer >= GR_GL_VER(4,1)))) ||
680 (GR_IS_GR_GL_ES(fStandard) && (
681 (glVer >= GR_GL_VER(3,0))))) {
682 if (!fFunctions.fProgramParameteri) {
683 RETURN_FALSE_INTERFACE;
684 }
685 }
686
687 if ((GR_IS_GR_GL(fStandard) && (
688 (glVer >= GR_GL_VER(3,2)) ||
689 fExtensions.has("GL_ARB_sampler_objects"))) ||
690 (GR_IS_GR_GL_ES(fStandard) && (
691 (glVer >= GR_GL_VER(3,0)))) ||
692 (GR_IS_GR_WEBGL(fStandard) && (
693 (glVer >= GR_GL_VER(2,0))))) {
694 if (!fFunctions.fBindSampler ||
695 !fFunctions.fDeleteSamplers ||
696 !fFunctions.fGenSamplers ||
697 !fFunctions.fSamplerParameterf ||
698 !fFunctions.fSamplerParameteri ||
699 !fFunctions.fSamplerParameteriv) {
700 RETURN_FALSE_INTERFACE;
701 }
702 }
703
704 if (GR_IS_GR_GL(fStandard)) {
705 if (!fFunctions.fGetQueryObjectiv) {
706 RETURN_FALSE_INTERFACE;
707 }
708 }
709
710 if (GR_IS_GR_GL(fStandard) ||
711 (GR_IS_GR_GL_ES(fStandard) && (
712 (glVer >= GR_GL_VER(3,0)) ||
713 fExtensions.has("GL_EXT_occlusion_query_boolean")))) {
714 #if GR_TEST_UTILS
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 #endif
724 // all functions were marked optional or test_only
725 }
726
727 if ((GR_IS_GR_GL(fStandard) && (
728 (glVer >= GR_GL_VER(3,3)) ||
729 fExtensions.has("GL_ARB_timer_query") ||
730 fExtensions.has("GL_EXT_timer_query")))) {
731 if (!fFunctions.fGetQueryObjecti64v ||
732 !fFunctions.fGetQueryObjectui64v) {
733 RETURN_FALSE_INTERFACE;
734 }
735 }
736
737 if ((GR_IS_GR_GL(fStandard) && (
738 (glVer >= GR_GL_VER(3,3)) ||
739 fExtensions.has("GL_ARB_timer_query")))) {
740 if (!fFunctions.fQueryCounter) {
741 RETURN_FALSE_INTERFACE;
742 }
743 }
744
745 if ((GR_IS_GR_GL(fStandard) && (
746 (glVer >= GR_GL_VER(4,3)) ||
747 fExtensions.has("GL_ARB_invalidate_subdata")))) {
748 if (!fFunctions.fInvalidateBufferData ||
749 !fFunctions.fInvalidateBufferSubData ||
750 !fFunctions.fInvalidateTexImage ||
751 !fFunctions.fInvalidateTexSubImage) {
752 RETURN_FALSE_INTERFACE;
753 }
754 }
755
756 if ((GR_IS_GR_GL(fStandard) && (
757 (glVer >= GR_GL_VER(4,3)) ||
758 fExtensions.has("GL_ARB_invalidate_subdata"))) ||
759 (GR_IS_GR_GL_ES(fStandard) && (
760 (glVer >= GR_GL_VER(3,0)))) ||
761 (GR_IS_GR_WEBGL(fStandard) && (
762 (glVer >= GR_GL_VER(2,0))))) {
763 if (!fFunctions.fInvalidateFramebuffer ||
764 !fFunctions.fInvalidateSubFramebuffer) {
765 RETURN_FALSE_INTERFACE;
766 }
767 }
768
769 if ((GR_IS_GR_GL(fStandard) && (
770 (glVer >= GR_GL_VER(4,3)) ||
771 fExtensions.has("GL_ARB_ES2_compatibility"))) ||
772 GR_IS_GR_GL_ES(fStandard) ||
773 GR_IS_GR_WEBGL(fStandard)) {
774 if (!fFunctions.fGetShaderPrecisionFormat) {
775 RETURN_FALSE_INTERFACE;
776 }
777 }
778
779 if ((GR_IS_GR_GL(fStandard) && (
780 fExtensions.has("GL_NV_fence"))) ||
781 (GR_IS_GR_GL_ES(fStandard) && (
782 fExtensions.has("GL_NV_fence")))) {
783 if (!fFunctions.fDeleteFences ||
784 !fFunctions.fFinishFence ||
785 !fFunctions.fGenFences ||
786 !fFunctions.fSetFence ||
787 !fFunctions.fTestFence) {
788 RETURN_FALSE_INTERFACE;
789 }
790 }
791
792
793 // End autogenerated content
794 return true;
795 }
796
797 #if GR_TEST_UTILS
798
abandon() const799 void GrGLInterface::abandon() const {
800 const_cast<GrGLInterface*>(this)->fFunctions = GrGLInterface::Functions();
801 }
802
803 #endif // GR_TEST_UTILS
804