OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #include "gl/GrGLInterface.h" | 9 #include "gl/GrGLInterface.h" |
10 #include "gl/GrGLExtensions.h" | 10 #include "gl/GrGLExtensions.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 nullptr == fFunctions.fGenFramebuffers || | 209 nullptr == fFunctions.fGenFramebuffers || |
210 nullptr == fFunctions.fGenRenderbuffers || | 210 nullptr == fFunctions.fGenRenderbuffers || |
211 nullptr == fFunctions.fRenderbufferStorage) { | 211 nullptr == fFunctions.fRenderbufferStorage) { |
212 RETURN_FALSE_INTERFACE | 212 RETURN_FALSE_INTERFACE |
213 } | 213 } |
214 | 214 |
215 GrGLVersion glVer = GrGLGetVersion(this); | 215 GrGLVersion glVer = GrGLGetVersion(this); |
216 if (GR_GL_INVALID_VER == glVer) { | 216 if (GR_GL_INVALID_VER == glVer) { |
217 RETURN_FALSE_INTERFACE | 217 RETURN_FALSE_INTERFACE |
218 } | 218 } |
219 // TODO: Remove this once command buffer implements full ES3. | |
220 bool ALLOW_MISSING_FUNCTIONS_FOR_INCOMPLETE_COMMAND_BUFFER_ES3 = false; | |
221 if (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,0)) { | |
222 const GrGLubyte* rendererUByte; | |
223 GR_GL_CALL_RET(this, rendererUByte, GetString(GR_GL_RENDERER)); | |
224 const char* renderer = reinterpret_cast<const char*>(rendererUByte); | |
225 ALLOW_MISSING_FUNCTIONS_FOR_INCOMPLETE_COMMAND_BUFFER_ES3 = | |
226 0 == strcmp(renderer, "Chromium"); | |
227 } | |
228 | 219 |
229 // Now check that baseline ES/Desktop fns not covered above are present | 220 // Now check that baseline ES/Desktop fns not covered above are present |
230 // and that we have fn pointers for any advertised fExtensions that we will | 221 // and that we have fn pointers for any advertised fExtensions that we will |
231 // try to use. | 222 // try to use. |
232 | 223 |
233 // these functions are part of ES2, we assume they are available | 224 // these functions are part of ES2, we assume they are available |
234 // On the desktop we assume they are available if the extension | 225 // On the desktop we assume they are available if the extension |
235 // is present or GL version is high enough. | 226 // is present or GL version is high enough. |
236 if (kGLES_GrGLStandard == fStandard) { | 227 if (kGLES_GrGLStandard == fStandard) { |
237 if (nullptr == fFunctions.fStencilFuncSeparate || | 228 if (nullptr == fFunctions.fStencilFuncSeparate || |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 // There is a desktop ARB extension and an ES+desktop EXT extension | 299 // There is a desktop ARB extension and an ES+desktop EXT extension |
309 if (kGL_GrGLStandard == fStandard) { | 300 if (kGL_GrGLStandard == fStandard) { |
310 if (glVer >= GR_GL_VER(4,2) || | 301 if (glVer >= GR_GL_VER(4,2) || |
311 fExtensions.has("GL_ARB_texture_storage") || | 302 fExtensions.has("GL_ARB_texture_storage") || |
312 fExtensions.has("GL_EXT_texture_storage")) { | 303 fExtensions.has("GL_EXT_texture_storage")) { |
313 if (nullptr == fFunctions.fTexStorage2D) { | 304 if (nullptr == fFunctions.fTexStorage2D) { |
314 RETURN_FALSE_INTERFACE | 305 RETURN_FALSE_INTERFACE |
315 } | 306 } |
316 } | 307 } |
317 } else if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_texture_storag
e")) { | 308 } else if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_texture_storag
e")) { |
318 if (!ALLOW_MISSING_FUNCTIONS_FOR_INCOMPLETE_COMMAND_BUFFER_ES3) { | 309 if (nullptr == fFunctions.fTexStorage2D) { |
319 if (nullptr == fFunctions.fTexStorage2D) { | 310 RETURN_FALSE_INTERFACE |
320 RETURN_FALSE_INTERFACE | |
321 } | |
322 } | 311 } |
323 } | 312 } |
324 | 313 |
325 // glTextureBarrier is part of desktop 4.5. There are also ARB and NV extens
ions. | 314 // glTextureBarrier is part of desktop 4.5. There are also ARB and NV extens
ions. |
326 if (kGL_GrGLStandard == fStandard) { | 315 if (kGL_GrGLStandard == fStandard) { |
327 if (glVer >= GR_GL_VER(4,5) || | 316 if (glVer >= GR_GL_VER(4,5) || |
328 fExtensions.has("GL_ARB_texture_barrier") || | 317 fExtensions.has("GL_ARB_texture_barrier") || |
329 fExtensions.has("GL_NV_texture_barrier")) { | 318 fExtensions.has("GL_NV_texture_barrier")) { |
330 if (nullptr == fFunctions.fTextureBarrier) { | 319 if (nullptr == fFunctions.fTextureBarrier) { |
331 RETURN_FALSE_INTERFACE | 320 RETURN_FALSE_INTERFACE |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 nullptr == fFunctions.fUnmapBufferSubData || | 473 nullptr == fFunctions.fUnmapBufferSubData || |
485 nullptr == fFunctions.fUnmapTexSubImage2D) { | 474 nullptr == fFunctions.fUnmapTexSubImage2D) { |
486 RETURN_FALSE_INTERFACE; | 475 RETURN_FALSE_INTERFACE; |
487 } | 476 } |
488 } | 477 } |
489 | 478 |
490 // These functions are added to the 3.0 version of both GLES and GL. | 479 // These functions are added to the 3.0 version of both GLES and GL. |
491 if (glVer >= GR_GL_VER(3,0) || | 480 if (glVer >= GR_GL_VER(3,0) || |
492 (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_EXT_map_buffer_r
ange")) || | 481 (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_EXT_map_buffer_r
ange")) || |
493 (kGL_GrGLStandard == fStandard && fExtensions.has("GL_ARB_map_buffer_ran
ge"))) { | 482 (kGL_GrGLStandard == fStandard && fExtensions.has("GL_ARB_map_buffer_ran
ge"))) { |
494 if (!ALLOW_MISSING_FUNCTIONS_FOR_INCOMPLETE_COMMAND_BUFFER_ES3) { | 483 if (nullptr == fFunctions.fMapBufferRange || |
495 if (nullptr == fFunctions.fMapBufferRange || | 484 nullptr == fFunctions.fFlushMappedBufferRange) { |
496 nullptr == fFunctions.fFlushMappedBufferRange) { | 485 RETURN_FALSE_INTERFACE; |
497 RETURN_FALSE_INTERFACE; | |
498 } | |
499 } | 486 } |
500 } | 487 } |
501 | 488 |
502 if ((kGL_GrGLStandard == fStandard && | 489 if ((kGL_GrGLStandard == fStandard && |
503 (glVer >= GR_GL_VER(3,2) || fExtensions.has("GL_ARB_texture_multisample
"))) || | 490 (glVer >= GR_GL_VER(3,2) || fExtensions.has("GL_ARB_texture_multisample
"))) || |
504 (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) { | 491 (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) { |
505 if (NULL == fFunctions.fGetMultisamplefv) { | 492 if (NULL == fFunctions.fGetMultisamplefv) { |
506 RETURN_FALSE_INTERFACE | 493 RETURN_FALSE_INTERFACE |
507 } | 494 } |
508 } | 495 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 } | 563 } |
577 } | 564 } |
578 | 565 |
579 if (kGL_GrGLStandard == fStandard) { | 566 if (kGL_GrGLStandard == fStandard) { |
580 if (glVer >= GR_GL_VER(3,1) || | 567 if (glVer >= GR_GL_VER(3,1) || |
581 fExtensions.has("GL_EXT_draw_instanced") || fExtensions.has("GL_ARB_
draw_instanced")) { | 568 fExtensions.has("GL_EXT_draw_instanced") || fExtensions.has("GL_ARB_
draw_instanced")) { |
582 if (nullptr == fFunctions.fDrawArraysInstanced || | 569 if (nullptr == fFunctions.fDrawArraysInstanced || |
583 nullptr == fFunctions.fDrawElementsInstanced) { | 570 nullptr == fFunctions.fDrawElementsInstanced) { |
584 RETURN_FALSE_INTERFACE | 571 RETURN_FALSE_INTERFACE |
585 } | 572 } |
586 } | 573 } |
587 } else if (kGLES_GrGLStandard == fStandard) { | 574 } else if (kGLES_GrGLStandard == fStandard) { |
588 if (!ALLOW_MISSING_FUNCTIONS_FOR_INCOMPLETE_COMMAND_BUFFER_ES3) { | 575 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_draw_instanced"))
{ |
589 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_draw_instance
d")) { | 576 if (nullptr == fFunctions.fDrawArraysInstanced || |
590 if (nullptr == fFunctions.fDrawArraysInstanced || | 577 nullptr == fFunctions.fDrawElementsInstanced) { |
591 nullptr == fFunctions.fDrawElementsInstanced) { | 578 RETURN_FALSE_INTERFACE |
592 RETURN_FALSE_INTERFACE | |
593 } | |
594 } | 579 } |
595 } | 580 } |
596 } | 581 } |
597 | 582 |
598 if (kGL_GrGLStandard == fStandard) { | 583 if (kGL_GrGLStandard == fStandard) { |
599 if (glVer >= GR_GL_VER(3,2) || fExtensions.has("GL_ARB_instanced_arrays"
)) { | 584 if (glVer >= GR_GL_VER(3,2) || fExtensions.has("GL_ARB_instanced_arrays"
)) { |
600 if (nullptr == fFunctions.fVertexAttribDivisor) { | 585 if (nullptr == fFunctions.fVertexAttribDivisor) { |
601 RETURN_FALSE_INTERFACE | 586 RETURN_FALSE_INTERFACE |
602 } | 587 } |
603 } | 588 } |
604 } else if (kGLES_GrGLStandard == fStandard) { | 589 } else if (kGLES_GrGLStandard == fStandard) { |
605 if (!ALLOW_MISSING_FUNCTIONS_FOR_INCOMPLETE_COMMAND_BUFFER_ES3) { | 590 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_instanced_arrays"
)) { |
606 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_instanced_arr
ays")) { | 591 if (nullptr == fFunctions.fVertexAttribDivisor) { |
607 if (nullptr == fFunctions.fVertexAttribDivisor) { | 592 RETURN_FALSE_INTERFACE |
608 RETURN_FALSE_INTERFACE | |
609 } | |
610 } | 593 } |
611 } | 594 } |
612 } | 595 } |
613 | 596 |
614 if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,3)) || | 597 if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,3)) || |
615 (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) { | 598 (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) { |
616 if (NULL == fFunctions.fDrawArraysIndirect || | 599 if (NULL == fFunctions.fDrawArraysIndirect || |
617 NULL == fFunctions.fDrawElementsIndirect) { | 600 NULL == fFunctions.fDrawElementsIndirect) { |
618 RETURN_FALSE_INTERFACE | 601 RETURN_FALSE_INTERFACE |
619 } | 602 } |
620 } | 603 } |
621 | 604 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 | 763 |
781 if (fExtensions.has("EGL_KHR_image") || fExtensions.has("EGL_KHR_image_base"
)) { | 764 if (fExtensions.has("EGL_KHR_image") || fExtensions.has("EGL_KHR_image_base"
)) { |
782 if (nullptr == fFunctions.fEGLCreateImage || | 765 if (nullptr == fFunctions.fEGLCreateImage || |
783 nullptr == fFunctions.fEGLDestroyImage) { | 766 nullptr == fFunctions.fEGLDestroyImage) { |
784 RETURN_FALSE_INTERFACE | 767 RETURN_FALSE_INTERFACE |
785 } | 768 } |
786 } | 769 } |
787 | 770 |
788 return true; | 771 return true; |
789 } | 772 } |
OLD | NEW |