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
18GrGLInterface::GrGLInterface() {
19 fStandard = kNone_GrGLStandard;
20}
21
22#if GR_GL_CHECK_ERROR
23static 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
41GrGLenum 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
59bool GrGLInterface::checkAndResetOOMed() const {
60 if (fOOMed) {
61 fOOMed = false;
62 return true;
63 }
64 return false;
65}
66
67void 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
74bool 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 (GR_IS_GR_GL_ES(fStandard) && (
210 (glVer >= GR_GL_VER(3,0)) ||
211 fExtensions.has("GL_OES_vertex_array_object"))) ||
212 (GR_IS_GR_WEBGL(fStandard) && (
213 (glVer >= GR_GL_VER(2,0)) ||
214 fExtensions.has("GL_OES_vertex_array_object") ||
215 fExtensions.has("OES_vertex_array_object")))) {
216 if (!fFunctions.fBindVertexArray ||
217 !fFunctions.fDeleteVertexArrays ||
218 !fFunctions.fGenVertexArrays) {
219 RETURN_FALSE_INTERFACE;
220 }
221 }
222
223 if ((GR_IS_GR_GL(fStandard) && (
224 (glVer >= GR_GL_VER(4,0)) ||
225 fExtensions.has("GL_ARB_tessellation_shader"))) ||
226 (GR_IS_GR_GL_ES(fStandard) && (
227 (glVer >= GR_GL_VER(3,2)) ||
228 fExtensions.has("GL_OES_tessellation_shader")))) {
229 if (!fFunctions.fPatchParameteri) {
230 RETURN_FALSE_INTERFACE;
231 }
232 }
233
234 if ((GR_IS_GR_GL(fStandard) && (
235 (glVer >= GR_GL_VER(3,0)))) ||
236 (GR_IS_GR_GL_ES(fStandard) && (
237 (glVer >= GR_GL_VER(3,0) && fExtensions.has("GL_EXT_blend_func_extended"))))) {
238 if (!fFunctions.fBindFragDataLocation) {
239 RETURN_FALSE_INTERFACE;
240 }
241 }
242
243 if ((GR_IS_GR_GL(fStandard) && (
244 (glVer >= GR_GL_VER(3,3)) ||
245 fExtensions.has("GL_ARB_blend_func_extended"))) ||
246 (GR_IS_GR_GL_ES(fStandard) && (
247 (glVer >= GR_GL_VER(3,0) && fExtensions.has("GL_EXT_blend_func_extended"))))) {
248 if (!fFunctions.fBindFragDataLocationIndexed) {
249 RETURN_FALSE_INTERFACE;
250 }
251 }
252
253 if ((GR_IS_GR_GL(fStandard) && (
254 fExtensions.has("GL_KHR_blend_equation_advanced") ||
255 fExtensions.has("GL_NV_blend_equation_advanced"))) ||
256 (GR_IS_GR_GL_ES(fStandard) && (
257 fExtensions.has("GL_KHR_blend_equation_advanced") ||
258 fExtensions.has("GL_NV_blend_equation_advanced")))) {
259 if (!fFunctions.fBlendBarrier) {
260 RETURN_FALSE_INTERFACE;
261 }
262 }
263
264 if ((GR_IS_GR_GL(fStandard) && (
265 (glVer >= GR_GL_VER(4,4)) ||
266 fExtensions.has("GL_ARB_clear_texture"))) ||
267 (GR_IS_GR_GL_ES(fStandard) && (
268 fExtensions.has("GL_EXT_clear_texture")))) {
269 // all functions were marked optional or test_only
270 }
271
272 if ((GR_IS_GR_GL(fStandard) && (
273 (glVer >= GR_GL_VER(3,1)) ||
274 fExtensions.has("GL_ARB_draw_instanced") ||
275 fExtensions.has("GL_EXT_draw_instanced"))) ||
276 (GR_IS_GR_GL_ES(fStandard) && (
277 (glVer >= GR_GL_VER(3,0)) ||
278 fExtensions.has("GL_EXT_draw_instanced"))) ||
279 (GR_IS_GR_WEBGL(fStandard) && (
280 (glVer >= GR_GL_VER(2,0))))) {
281 if (!fFunctions.fDrawArraysInstanced ||
282 !fFunctions.fDrawElementsInstanced) {
283 RETURN_FALSE_INTERFACE;
284 }
285 }
286
287 if ((GR_IS_GR_GL(fStandard) && (
288 (glVer >= GR_GL_VER(4,2)) ||
289 fExtensions.has("GL_ARB_base_instance"))) ||
290 (GR_IS_GR_GL_ES(fStandard) && (
291 fExtensions.has("GL_EXT_base_instance") ||
292 fExtensions.has("GL_ANGLE_base_vertex_base_instance")))) {
293 if (!fFunctions.fDrawArraysInstancedBaseInstance ||
294 !fFunctions.fDrawElementsInstancedBaseVertexBaseInstance) {
295 RETURN_FALSE_INTERFACE;
296 }
297 }
298
299 if (GR_IS_GR_GL(fStandard) ||
300 (GR_IS_GR_GL_ES(fStandard) && (
301 (glVer >= GR_GL_VER(3,0)))) ||
302 (GR_IS_GR_WEBGL(fStandard) && (
303 (glVer >= GR_GL_VER(2,0))))) {
304 if (!fFunctions.fDrawBuffers ||
305 !fFunctions.fReadBuffer) {
306 RETURN_FALSE_INTERFACE;
307 }
308 }
309
310 if ((GR_IS_GR_GL(fStandard) && (
311 (glVer >= GR_GL_VER(4,0)) ||
312 fExtensions.has("GL_ARB_draw_indirect"))) ||
313 (GR_IS_GR_GL_ES(fStandard) && (
314 (glVer >= GR_GL_VER(3,1))))) {
315 if (!fFunctions.fDrawArraysIndirect ||
316 !fFunctions.fDrawElementsIndirect) {
317 RETURN_FALSE_INTERFACE;
318 }
319 }
320
321 if ((GR_IS_GR_GL_ES(fStandard) && (
322 fExtensions.has("GL_ANGLE_base_vertex_base_instance")))) {
323 if (!fFunctions.fMultiDrawArraysInstancedBaseInstance ||
324 !fFunctions.fMultiDrawElementsInstancedBaseVertexBaseInstance) {
325 RETURN_FALSE_INTERFACE;
326 }
327 }
328
329 if (GR_IS_GR_GL(fStandard) ||
330 (GR_IS_GR_GL_ES(fStandard) && (
331 (glVer >= GR_GL_VER(3,0)))) ||
332 (GR_IS_GR_WEBGL(fStandard) && (
333 (glVer >= GR_GL_VER(2,0))))) {
334 if (!fFunctions.fDrawRangeElements) {
335 RETURN_FALSE_INTERFACE;
336 }
337 }
338
339 if ((GR_IS_GR_GL(fStandard) && (
340 (glVer >= GR_GL_VER(3,2)) ||
341 fExtensions.has("GL_ARB_texture_multisample"))) ||
342 (GR_IS_GR_GL_ES(fStandard) && (
343 (glVer >= GR_GL_VER(3,1))))) {
344 if (!fFunctions.fGetMultisamplefv) {
345 RETURN_FALSE_INTERFACE;
346 }
347 }
348
349 if (GR_IS_GR_GL(fStandard) ||
350 (GR_IS_GR_GL_ES(fStandard) && (
351 (glVer >= GR_GL_VER(3,1))))) {
352 if (!fFunctions.fGetTexLevelParameteriv) {
353 RETURN_FALSE_INTERFACE;
354 }
355 }
356
357 if ((GR_IS_GR_GL(fStandard) && (
358 (glVer >= GR_GL_VER(4,3)) ||
359 fExtensions.has("GL_ARB_multi_draw_indirect"))) ||
360 (GR_IS_GR_GL_ES(fStandard) && (
361 fExtensions.has("GL_EXT_multi_draw_indirect")))) {
362 if (!fFunctions.fMultiDrawArraysIndirect ||
363 !fFunctions.fMultiDrawElementsIndirect) {
364 RETURN_FALSE_INTERFACE;
365 }
366 }
367
368 if ((GR_IS_GR_GL(fStandard) && (
369 (glVer >= GR_GL_VER(3,1)))) ||
370 (GR_IS_GR_GL_ES(fStandard) && (
371 (glVer >= GR_GL_VER(3,2)) ||
372 fExtensions.has("GL_OES_texture_buffer") ||
373 fExtensions.has("GL_EXT_texture_buffer")))) {
374 if (!fFunctions.fTexBuffer) {
375 RETURN_FALSE_INTERFACE;
376 }
377 }
378
379 if ((GR_IS_GR_GL(fStandard) && (
380 (glVer >= GR_GL_VER(4,3)))) ||
381 (GR_IS_GR_GL_ES(fStandard) && (
382 (glVer >= GR_GL_VER(3,2)) ||
383 fExtensions.has("GL_OES_texture_buffer") ||
384 fExtensions.has("GL_EXT_texture_buffer")))) {
385 if (!fFunctions.fTexBufferRange) {
386 RETURN_FALSE_INTERFACE;
387 }
388 }
389
390 if ((GR_IS_GR_GL(fStandard) && (
391 (glVer >= GR_GL_VER(4,2)) ||
392 fExtensions.has("GL_ARB_texture_storage") ||
393 fExtensions.has("GL_EXT_texture_storage"))) ||
394 (GR_IS_GR_GL_ES(fStandard) && (
395 (glVer >= GR_GL_VER(3,0)) ||
396 fExtensions.has("GL_EXT_texture_storage"))) ||
397 (GR_IS_GR_WEBGL(fStandard) && (
398 (glVer >= GR_GL_VER(2,0))))) {
399 if (!fFunctions.fTexStorage2D) {
400 RETURN_FALSE_INTERFACE;
401 }
402 }
403
404 if ((GR_IS_GR_GL(fStandard) && (
405 (glVer >= GR_GL_VER(4,5)) ||
406 fExtensions.has("GL_ARB_texture_barrier") ||
407 fExtensions.has("GL_NV_texture_barrier"))) ||
408 (GR_IS_GR_GL_ES(fStandard) && (
409 fExtensions.has("GL_NV_texture_barrier")))) {
410 if (!fFunctions.fTextureBarrier) {
411 RETURN_FALSE_INTERFACE;
412 }
413 }
414
415 if ((GR_IS_GR_GL_ES(fStandard) && (
416 fExtensions.has("GL_EXT_discard_framebuffer")))) {
417 if (!fFunctions.fDiscardFramebuffer) {
418 RETURN_FALSE_INTERFACE;
419 }
420 }
421
422 if ((GR_IS_GR_GL_ES(fStandard) && (
423 fExtensions.has("GL_QCOM_tiled_rendering")))) {
424 // all functions were marked optional or test_only
425 }
426
427 if ((GR_IS_GR_GL(fStandard) && (
428 (glVer >= GR_GL_VER(3,2)) ||
429 fExtensions.has("GL_ARB_instanced_arrays"))) ||
430 (GR_IS_GR_GL_ES(fStandard) && (
431 (glVer >= GR_GL_VER(3,0)) ||
432 fExtensions.has("GL_EXT_instanced_arrays"))) ||
433 (GR_IS_GR_WEBGL(fStandard) && (
434 (glVer >= GR_GL_VER(2,0))))) {
435 if (!fFunctions.fVertexAttribDivisor) {
436 RETURN_FALSE_INTERFACE;
437 }
438 }
439
440 if ((GR_IS_GR_GL(fStandard) && (
441 (glVer >= GR_GL_VER(3,0)))) ||
442 (GR_IS_GR_GL_ES(fStandard) && (
443 (glVer >= GR_GL_VER(3,0)))) ||
444 (GR_IS_GR_WEBGL(fStandard) && (
445 (glVer >= GR_GL_VER(2,0))))) {
446 if (!fFunctions.fVertexAttribIPointer) {
447 RETURN_FALSE_INTERFACE;
448 }
449 }
450
451 if ((GR_IS_GR_GL(fStandard) && (
452 (glVer >= GR_GL_VER(3,0)) ||
453 fExtensions.has("GL_ARB_framebuffer_object") ||
454 fExtensions.has("GL_EXT_framebuffer_object"))) ||
455 GR_IS_GR_GL_ES(fStandard) ||
456 GR_IS_GR_WEBGL(fStandard)) {
457 if (!fFunctions.fBindFramebuffer ||
458 !fFunctions.fBindRenderbuffer ||
459 !fFunctions.fCheckFramebufferStatus ||
460 !fFunctions.fDeleteFramebuffers ||
461 !fFunctions.fDeleteRenderbuffers ||
462 !fFunctions.fFramebufferRenderbuffer ||
463 !fFunctions.fFramebufferTexture2D ||
464 !fFunctions.fGenFramebuffers ||
465 !fFunctions.fGenRenderbuffers ||
466 !fFunctions.fGenerateMipmap ||
467 !fFunctions.fGetFramebufferAttachmentParameteriv ||
468 !fFunctions.fGetRenderbufferParameteriv ||
469 !fFunctions.fRenderbufferStorage) {
470 RETURN_FALSE_INTERFACE;
471 }
472 }
473
474 if ((GR_IS_GR_GL(fStandard) && (
475 (glVer >= GR_GL_VER(3,0)) ||
476 fExtensions.has("GL_ARB_framebuffer_object") ||
477 fExtensions.has("GL_EXT_framebuffer_blit"))) ||
478 (GR_IS_GR_GL_ES(fStandard) && (
479 (glVer >= GR_GL_VER(3,0)) ||
480 fExtensions.has("GL_CHROMIUM_framebuffer_multisample") ||
481 fExtensions.has("GL_ANGLE_framebuffer_blit"))) ||
482 (GR_IS_GR_WEBGL(fStandard) && (
483 (glVer >= GR_GL_VER(2,0))))) {
484 if (!fFunctions.fBlitFramebuffer) {
485 RETURN_FALSE_INTERFACE;
486 }
487 }
488
489 if ((GR_IS_GR_GL(fStandard) && (
490 (glVer >= GR_GL_VER(3,0)) ||
491 fExtensions.has("GL_ARB_framebuffer_object") ||
492 fExtensions.has("GL_EXT_framebuffer_multisample"))) ||
493 (GR_IS_GR_GL_ES(fStandard) && (
494 (glVer >= GR_GL_VER(3,0)) ||
495 fExtensions.has("GL_CHROMIUM_framebuffer_multisample") ||
496 fExtensions.has("GL_ANGLE_framebuffer_multisample"))) ||
497 (GR_IS_GR_WEBGL(fStandard) && (
498 (glVer >= GR_GL_VER(2,0))))) {
499 if (!fFunctions.fRenderbufferStorageMultisample) {
500 RETURN_FALSE_INTERFACE;
501 }
502 }
503
504 if ((GR_IS_GR_GL_ES(fStandard) && (
505 fExtensions.has("GL_CHROMIUM_map_sub")))) {
506 if (!fFunctions.fMapBufferSubData ||
507 !fFunctions.fMapTexSubImage2D ||
508 !fFunctions.fUnmapBufferSubData ||
509 !fFunctions.fUnmapTexSubImage2D) {
510 RETURN_FALSE_INTERFACE;
511 }
512 }
513
514 if ((GR_IS_GR_GL_ES(fStandard) && (
515 fExtensions.has("GL_EXT_multisampled_render_to_texture") ||
516 fExtensions.has("GL_IMG_multisampled_render_to_texture")))) {
517 if (!fFunctions.fFramebufferTexture2DMultisample) {
518 RETURN_FALSE_INTERFACE;
519 }
520 }
521
522 if ((GR_IS_GR_GL_ES(fStandard) && (
523 fExtensions.has("GL_EXT_multisampled_render_to_texture")))) {
524 if (!fFunctions.fRenderbufferStorageMultisampleES2EXT) {
525 RETURN_FALSE_INTERFACE;
526 }
527 }
528
529 if ((GR_IS_GR_GL_ES(fStandard) && (
530 fExtensions.has("GL_IMG_multisampled_render_to_texture")))) {
531 if (!fFunctions.fRenderbufferStorageMultisampleES2EXT) {
532 RETURN_FALSE_INTERFACE;
533 }
534 }
535
536 if ((GR_IS_GR_GL_ES(fStandard) && (
537 fExtensions.has("GL_APPLE_framebuffer_multisample")))) {
538 if (!fFunctions.fResolveMultisampleFramebuffer ||
539 !fFunctions.fRenderbufferStorageMultisampleES2APPLE) {
540 RETURN_FALSE_INTERFACE;
541 }
542 }
543
544 if (GR_IS_GR_GL(fStandard) ||
545 (GR_IS_GR_GL_ES(fStandard) && (
546 fExtensions.has("GL_OES_mapbuffer")))) {
547 if (!fFunctions.fMapBuffer) {
548 RETURN_FALSE_INTERFACE;
549 }
550 }
551
552 if (GR_IS_GR_GL(fStandard) ||
553 (GR_IS_GR_GL_ES(fStandard) && (
554 (glVer >= GR_GL_VER(3,0)) ||
555 fExtensions.has("GL_OES_mapbuffer")))) {
556 if (!fFunctions.fUnmapBuffer) {
557 RETURN_FALSE_INTERFACE;
558 }
559 }
560
561 if ((GR_IS_GR_GL(fStandard) && (
562 (glVer >= GR_GL_VER(3,0)) ||
563 fExtensions.has("GL_ARB_map_buffer_range"))) ||
564 (GR_IS_GR_GL_ES(fStandard) && (
565 (glVer >= GR_GL_VER(3,0)) ||
566 fExtensions.has("GL_EXT_map_buffer_range")))) {
567 if (!fFunctions.fFlushMappedBufferRange ||
568 !fFunctions.fMapBufferRange) {
569 RETURN_FALSE_INTERFACE;
570 }
571 }
572
573 if ((GR_IS_GR_GL(fStandard) && (
574 fExtensions.has("GL_EXT_debug_marker"))) ||
575 (GR_IS_GR_GL_ES(fStandard) && (
576 fExtensions.has("GL_EXT_debug_marker")))) {
577 if (!fFunctions.fInsertEventMarker ||
578 !fFunctions.fPopGroupMarker ||
579 !fFunctions.fPushGroupMarker) {
580 RETURN_FALSE_INTERFACE;
581 }
582 }
583
584 if ((GR_IS_GR_GL(fStandard) && (
585 (glVer >= GR_GL_VER(4,3)) ||
586 fExtensions.has("GL_ARB_program_interface_query"))) ||
587 (GR_IS_GR_GL_ES(fStandard) && (
588 (glVer >= GR_GL_VER(3,1))))) {
589 if (!fFunctions.fGetProgramResourceLocation) {
590 RETURN_FALSE_INTERFACE;
591 }
592 }
593
594 if ((GR_IS_GR_GL(fStandard) && (
595 fExtensions.has("GL_NV_path_rendering"))) ||
596 (GR_IS_GR_GL_ES(fStandard) && (
597 fExtensions.has("GL_CHROMIUM_path_rendering") ||
598 fExtensions.has("GL_NV_path_rendering")))) {
599 if (!fFunctions.fMatrixLoadIdentity ||
600 !fFunctions.fMatrixLoadf) {
601 RETURN_FALSE_INTERFACE;
602 }
603 }
604
605 if ((GR_IS_GR_GL(fStandard) && (
606 fExtensions.has("GL_NV_path_rendering"))) ||
607 (GR_IS_GR_GL_ES(fStandard) && (
608 fExtensions.has("GL_CHROMIUM_path_rendering") ||
609 fExtensions.has("GL_NV_path_rendering")))) {
610 if (!fFunctions.fCoverFillPath ||
611 !fFunctions.fCoverFillPathInstanced ||
612 !fFunctions.fCoverStrokePath ||
613 !fFunctions.fCoverStrokePathInstanced ||
614 !fFunctions.fDeletePaths ||
615 !fFunctions.fGenPaths ||
616 !fFunctions.fIsPath ||
617 !fFunctions.fPathCommands ||
618 !fFunctions.fPathParameterf ||
619 !fFunctions.fPathParameteri ||
620 !fFunctions.fPathStencilFunc ||
621 !fFunctions.fStencilFillPath ||
622 !fFunctions.fStencilFillPathInstanced ||
623 !fFunctions.fStencilStrokePath ||
624 !fFunctions.fStencilStrokePathInstanced) {
625 RETURN_FALSE_INTERFACE;
626 }
627 }
628
629 if ((GR_IS_GR_GL_ES(fStandard) && (
630 fExtensions.has("GL_CHROMIUM_path_rendering")))) {
631 if (!fFunctions.fBindFragmentInputLocation) {
632 RETURN_FALSE_INTERFACE;
633 }
634 }
635
636 if ((GR_IS_GR_GL(fStandard) && (
637 fExtensions.has("GL_NV_framebuffer_mixed_samples"))) ||
638 (GR_IS_GR_GL_ES(fStandard) && (
639 fExtensions.has("GL_CHROMIUM_framebuffer_mixed_samples") ||
640 fExtensions.has("GL_NV_framebuffer_mixed_samples")))) {
641 if (!fFunctions.fCoverageModulation) {
642 RETURN_FALSE_INTERFACE;
643 }
644 }
645
646 if ((GR_IS_GR_GL(fStandard) && (
647 (glVer >= GR_GL_VER(4,3)) ||
648 fExtensions.has("GL_KHR_debug"))) ||
649 (GR_IS_GR_GL_ES(fStandard) && (
650 fExtensions.has("GL_KHR_debug")))) {
651 if (!fFunctions.fDebugMessageCallback ||
652 !fFunctions.fDebugMessageControl ||
653 !fFunctions.fDebugMessageInsert ||
654 !fFunctions.fGetDebugMessageLog ||
655 !fFunctions.fObjectLabel ||
656 !fFunctions.fPopDebugGroup ||
657 !fFunctions.fPushDebugGroup) {
658 RETURN_FALSE_INTERFACE;
659 }
660 }
661
662 if ((GR_IS_GR_GL_ES(fStandard) && (
663 fExtensions.has("GL_CHROMIUM_bind_uniform_location")))) {
664 if (!fFunctions.fBindUniformLocation) {
665 RETURN_FALSE_INTERFACE;
666 }
667 }
668
669 if ((GR_IS_GR_GL(fStandard) && (
670 fExtensions.has("GL_EXT_window_rectangles"))) ||
671 (GR_IS_GR_GL_ES(fStandard) && (
672 fExtensions.has("GL_EXT_window_rectangles")))) {
673 if (!fFunctions.fWindowRectangles) {
674 RETURN_FALSE_INTERFACE;
675 }
676 }
677
678 if ((GR_IS_GR_GL(fStandard) && (
679 (glVer >= GR_GL_VER(3,2)) ||
680 fExtensions.has("GL_ARB_sync"))) ||
681 (GR_IS_GR_GL_ES(fStandard) && (
682 (glVer >= GR_GL_VER(3,0)) ||
683 fExtensions.has("GL_APPLE_sync"))) ||
684 (GR_IS_GR_WEBGL(fStandard) && (
685 (glVer >= GR_GL_VER(2,0))))) {
686 if (!fFunctions.fClientWaitSync ||
687 !fFunctions.fDeleteSync ||
688 !fFunctions.fFenceSync ||
689 !fFunctions.fIsSync ||
690 !fFunctions.fWaitSync) {
691 RETURN_FALSE_INTERFACE;
692 }
693 }
694
695 if ((GR_IS_GR_GL(fStandard) && (
696 (glVer >= GR_GL_VER(4,2)) ||
697 fExtensions.has("GL_ARB_internalformat_query"))) ||
698 (GR_IS_GR_GL_ES(fStandard) && (
699 (glVer >= GR_GL_VER(3,0))))) {
700 if (!fFunctions.fGetInternalformativ) {
701 RETURN_FALSE_INTERFACE;
702 }
703 }
704
705 if ((GR_IS_GR_GL(fStandard) && (
706 (glVer >= GR_GL_VER(4,1)))) ||
707 (GR_IS_GR_GL_ES(fStandard) && (
708 (glVer >= GR_GL_VER(3,0)) ||
709 fExtensions.has("GL_OES_get_program_binary")))) {
710 if (!fFunctions.fGetProgramBinary ||
711 !fFunctions.fProgramBinary) {
712 RETURN_FALSE_INTERFACE;
713 }
714 }
715
716 if ((GR_IS_GR_GL(fStandard) && (
717 (glVer >= GR_GL_VER(4,1)))) ||
718 (GR_IS_GR_GL_ES(fStandard) && (
719 (glVer >= GR_GL_VER(3,0))))) {
720 if (!fFunctions.fProgramParameteri) {
721 RETURN_FALSE_INTERFACE;
722 }
723 }
724
725 if ((GR_IS_GR_GL(fStandard) && (
726 (glVer >= GR_GL_VER(3,2)) ||
727 fExtensions.has("GL_ARB_sampler_objects"))) ||
728 (GR_IS_GR_GL_ES(fStandard) && (
729 (glVer >= GR_GL_VER(3,0)))) ||
730 (GR_IS_GR_WEBGL(fStandard) && (
731 (glVer >= GR_GL_VER(2,0))))) {
732 if (!fFunctions.fBindSampler ||
733 !fFunctions.fDeleteSamplers ||
734 !fFunctions.fGenSamplers ||
735 !fFunctions.fSamplerParameteri ||
736 !fFunctions.fSamplerParameteriv) {
737 RETURN_FALSE_INTERFACE;
738 }
739 }
740
741 if (GR_IS_GR_GL(fStandard)) {
742 if (!fFunctions.fGetQueryObjectiv) {
743 RETURN_FALSE_INTERFACE;
744 }
745 }
746
747 if (GR_IS_GR_GL(fStandard) ||
748 (GR_IS_GR_GL_ES(fStandard) && (
749 (glVer >= GR_GL_VER(3,0)) ||
750 fExtensions.has("GL_EXT_occlusion_query_boolean")))) {
751#if GR_TEST_UTILS
752 if (!fFunctions.fBeginQuery ||
753 !fFunctions.fDeleteQueries ||
754 !fFunctions.fEndQuery ||
755 !fFunctions.fGenQueries ||
756 !fFunctions.fGetQueryObjectuiv ||
757 !fFunctions.fGetQueryiv) {
758 RETURN_FALSE_INTERFACE;
759 }
760#endif
761 // all functions were marked optional or test_only
762 }
763
764 if ((GR_IS_GR_GL(fStandard) && (
765 (glVer >= GR_GL_VER(3,3)) ||
766 fExtensions.has("GL_ARB_timer_query") ||
767 fExtensions.has("GL_EXT_timer_query")))) {
768 if (!fFunctions.fGetQueryObjecti64v ||
769 !fFunctions.fGetQueryObjectui64v) {
770 RETURN_FALSE_INTERFACE;
771 }
772 }
773
774 if ((GR_IS_GR_GL(fStandard) && (
775 (glVer >= GR_GL_VER(3,3)) ||
776 fExtensions.has("GL_ARB_timer_query")))) {
777 if (!fFunctions.fQueryCounter) {
778 RETURN_FALSE_INTERFACE;
779 }
780 }
781
782 if ((GR_IS_GR_GL(fStandard) && (
783 (glVer >= GR_GL_VER(4,3)) ||
784 fExtensions.has("GL_ARB_invalidate_subdata")))) {
785 if (!fFunctions.fInvalidateBufferData ||
786 !fFunctions.fInvalidateBufferSubData ||
787 !fFunctions.fInvalidateTexImage ||
788 !fFunctions.fInvalidateTexSubImage) {
789 RETURN_FALSE_INTERFACE;
790 }
791 }
792
793 if ((GR_IS_GR_GL(fStandard) && (
794 (glVer >= GR_GL_VER(4,3)) ||
795 fExtensions.has("GL_ARB_invalidate_subdata"))) ||
796 (GR_IS_GR_GL_ES(fStandard) && (
797 (glVer >= GR_GL_VER(3,0)))) ||
798 (GR_IS_GR_WEBGL(fStandard) && (
799 (glVer >= GR_GL_VER(2,0))))) {
800 if (!fFunctions.fInvalidateFramebuffer ||
801 !fFunctions.fInvalidateSubFramebuffer) {
802 RETURN_FALSE_INTERFACE;
803 }
804 }
805
806 if ((GR_IS_GR_GL(fStandard) && (
807 (glVer >= GR_GL_VER(4,3)) ||
808 fExtensions.has("GL_ARB_ES2_compatibility"))) ||
809 GR_IS_GR_GL_ES(fStandard) ||
810 GR_IS_GR_WEBGL(fStandard)) {
811 if (!fFunctions.fGetShaderPrecisionFormat) {
812 RETURN_FALSE_INTERFACE;
813 }
814 }
815
816 if ((GR_IS_GR_GL(fStandard) && (
817 fExtensions.has("GL_NV_fence"))) ||
818 (GR_IS_GR_GL_ES(fStandard) && (
819 fExtensions.has("GL_NV_fence")))) {
820 if (!fFunctions.fDeleteFences ||
821 !fFunctions.fFinishFence ||
822 !fFunctions.fGenFences ||
823 !fFunctions.fSetFence ||
824 !fFunctions.fTestFence) {
825 RETURN_FALSE_INTERFACE;
826 }
827 }
828
829
830 // End autogenerated content
831 return true;
832}
833
834#if GR_TEST_UTILS
835
836void GrGLInterface::abandon() const {
837 const_cast<GrGLInterface*>(this)->fFunctions = GrGLInterface::Functions();
838}
839
840#endif // GR_TEST_UTILS
841