| 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 } |
| 219 | 228 |
| 220 // Now check that baseline ES/Desktop fns not covered above are present | 229 // Now check that baseline ES/Desktop fns not covered above are present |
| 221 // and that we have fn pointers for any advertised fExtensions that we will | 230 // and that we have fn pointers for any advertised fExtensions that we will |
| 222 // try to use. | 231 // try to use. |
| 223 | 232 |
| 224 // these functions are part of ES2, we assume they are available | 233 // these functions are part of ES2, we assume they are available |
| 225 // On the desktop we assume they are available if the extension | 234 // On the desktop we assume they are available if the extension |
| 226 // is present or GL version is high enough. | 235 // is present or GL version is high enough. |
| 227 if (kGLES_GrGLStandard == fStandard) { | 236 if (kGLES_GrGLStandard == fStandard) { |
| 228 if (nullptr == fFunctions.fStencilFuncSeparate || | 237 if (nullptr == fFunctions.fStencilFuncSeparate || |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 // There is a desktop ARB extension and an ES+desktop EXT extension | 308 // There is a desktop ARB extension and an ES+desktop EXT extension |
| 300 if (kGL_GrGLStandard == fStandard) { | 309 if (kGL_GrGLStandard == fStandard) { |
| 301 if (glVer >= GR_GL_VER(4,2) || | 310 if (glVer >= GR_GL_VER(4,2) || |
| 302 fExtensions.has("GL_ARB_texture_storage") || | 311 fExtensions.has("GL_ARB_texture_storage") || |
| 303 fExtensions.has("GL_EXT_texture_storage")) { | 312 fExtensions.has("GL_EXT_texture_storage")) { |
| 304 if (nullptr == fFunctions.fTexStorage2D) { | 313 if (nullptr == fFunctions.fTexStorage2D) { |
| 305 RETURN_FALSE_INTERFACE | 314 RETURN_FALSE_INTERFACE |
| 306 } | 315 } |
| 307 } | 316 } |
| 308 } else if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_texture_storag
e")) { | 317 } else if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_texture_storag
e")) { |
| 309 if (nullptr == fFunctions.fTexStorage2D) { | 318 if (!ALLOW_MISSING_FUNCTIONS_FOR_INCOMPLETE_COMMAND_BUFFER_ES3) { |
| 310 RETURN_FALSE_INTERFACE | 319 if (nullptr == fFunctions.fTexStorage2D) { |
| 320 RETURN_FALSE_INTERFACE |
| 321 } |
| 311 } | 322 } |
| 312 } | 323 } |
| 313 | 324 |
| 314 // glTextureBarrier is part of desktop 4.5. There are also ARB and NV extens
ions. | 325 // glTextureBarrier is part of desktop 4.5. There are also ARB and NV extens
ions. |
| 315 if (kGL_GrGLStandard == fStandard) { | 326 if (kGL_GrGLStandard == fStandard) { |
| 316 if (glVer >= GR_GL_VER(4,5) || | 327 if (glVer >= GR_GL_VER(4,5) || |
| 317 fExtensions.has("GL_ARB_texture_barrier") || | 328 fExtensions.has("GL_ARB_texture_barrier") || |
| 318 fExtensions.has("GL_NV_texture_barrier")) { | 329 fExtensions.has("GL_NV_texture_barrier")) { |
| 319 if (nullptr == fFunctions.fTextureBarrier) { | 330 if (nullptr == fFunctions.fTextureBarrier) { |
| 320 RETURN_FALSE_INTERFACE | 331 RETURN_FALSE_INTERFACE |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 nullptr == fFunctions.fUnmapBufferSubData || | 484 nullptr == fFunctions.fUnmapBufferSubData || |
| 474 nullptr == fFunctions.fUnmapTexSubImage2D) { | 485 nullptr == fFunctions.fUnmapTexSubImage2D) { |
| 475 RETURN_FALSE_INTERFACE; | 486 RETURN_FALSE_INTERFACE; |
| 476 } | 487 } |
| 477 } | 488 } |
| 478 | 489 |
| 479 // These functions are added to the 3.0 version of both GLES and GL. | 490 // These functions are added to the 3.0 version of both GLES and GL. |
| 480 if (glVer >= GR_GL_VER(3,0) || | 491 if (glVer >= GR_GL_VER(3,0) || |
| 481 (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_EXT_map_buffer_r
ange")) || | 492 (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_EXT_map_buffer_r
ange")) || |
| 482 (kGL_GrGLStandard == fStandard && fExtensions.has("GL_ARB_map_buffer_ran
ge"))) { | 493 (kGL_GrGLStandard == fStandard && fExtensions.has("GL_ARB_map_buffer_ran
ge"))) { |
| 483 if (nullptr == fFunctions.fMapBufferRange || | 494 if (!ALLOW_MISSING_FUNCTIONS_FOR_INCOMPLETE_COMMAND_BUFFER_ES3) { |
| 484 nullptr == fFunctions.fFlushMappedBufferRange) { | 495 if (nullptr == fFunctions.fMapBufferRange || |
| 485 RETURN_FALSE_INTERFACE; | 496 nullptr == fFunctions.fFlushMappedBufferRange) { |
| 497 RETURN_FALSE_INTERFACE; |
| 498 } |
| 486 } | 499 } |
| 487 } | 500 } |
| 488 | 501 |
| 489 if ((kGL_GrGLStandard == fStandard && | 502 if ((kGL_GrGLStandard == fStandard && |
| 490 (glVer >= GR_GL_VER(4,3) || fExtensions.has("GL_ARB_program_interface_q
uery"))) || | 503 (glVer >= GR_GL_VER(4,3) || fExtensions.has("GL_ARB_program_interface_q
uery"))) || |
| 491 (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) { | 504 (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) { |
| 492 if (nullptr == fFunctions.fGetProgramResourceLocation) { | 505 if (nullptr == fFunctions.fGetProgramResourceLocation) { |
| 493 RETURN_FALSE_INTERFACE | 506 RETURN_FALSE_INTERFACE |
| 494 } | 507 } |
| 495 } | 508 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 } | 568 } |
| 556 } | 569 } |
| 557 | 570 |
| 558 if (kGL_GrGLStandard == fStandard) { | 571 if (kGL_GrGLStandard == fStandard) { |
| 559 if (glVer >= GR_GL_VER(3,1) || | 572 if (glVer >= GR_GL_VER(3,1) || |
| 560 fExtensions.has("GL_EXT_draw_instanced") || fExtensions.has("GL_ARB_
draw_instanced")) { | 573 fExtensions.has("GL_EXT_draw_instanced") || fExtensions.has("GL_ARB_
draw_instanced")) { |
| 561 if (nullptr == fFunctions.fDrawArraysInstanced || | 574 if (nullptr == fFunctions.fDrawArraysInstanced || |
| 562 nullptr == fFunctions.fDrawElementsInstanced) { | 575 nullptr == fFunctions.fDrawElementsInstanced) { |
| 563 RETURN_FALSE_INTERFACE | 576 RETURN_FALSE_INTERFACE |
| 564 } | 577 } |
| 565 } | 578 } |
| 566 } else if (kGLES_GrGLStandard == fStandard) { | 579 } else if (kGLES_GrGLStandard == fStandard) { |
| 567 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_draw_instanced"))
{ | 580 if (!ALLOW_MISSING_FUNCTIONS_FOR_INCOMPLETE_COMMAND_BUFFER_ES3) { |
| 568 if (nullptr == fFunctions.fDrawArraysInstanced || | 581 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_draw_instance
d")) { |
| 569 nullptr == fFunctions.fDrawElementsInstanced) { | 582 if (nullptr == fFunctions.fDrawArraysInstanced || |
| 570 RETURN_FALSE_INTERFACE | 583 nullptr == fFunctions.fDrawElementsInstanced) { |
| 584 RETURN_FALSE_INTERFACE |
| 585 } |
| 571 } | 586 } |
| 572 } | 587 } |
| 573 } | 588 } |
| 574 | 589 |
| 575 if (kGL_GrGLStandard == fStandard) { | 590 if (kGL_GrGLStandard == fStandard) { |
| 576 if (glVer >= GR_GL_VER(3,2) || fExtensions.has("GL_ARB_instanced_arrays"
)) { | 591 if (glVer >= GR_GL_VER(3,2) || fExtensions.has("GL_ARB_instanced_arrays"
)) { |
| 577 if (nullptr == fFunctions.fVertexAttribDivisor) { | 592 if (nullptr == fFunctions.fVertexAttribDivisor) { |
| 578 RETURN_FALSE_INTERFACE | 593 RETURN_FALSE_INTERFACE |
| 579 } | 594 } |
| 580 } | 595 } |
| 581 } else if (kGLES_GrGLStandard == fStandard) { | 596 } else if (kGLES_GrGLStandard == fStandard) { |
| 582 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_instanced_arrays"
)) { | 597 if (!ALLOW_MISSING_FUNCTIONS_FOR_INCOMPLETE_COMMAND_BUFFER_ES3) { |
| 583 if (nullptr == fFunctions.fVertexAttribDivisor) { | 598 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_instanced_arr
ays")) { |
| 584 RETURN_FALSE_INTERFACE | 599 if (nullptr == fFunctions.fVertexAttribDivisor) { |
| 600 RETURN_FALSE_INTERFACE |
| 601 } |
| 585 } | 602 } |
| 586 } | 603 } |
| 587 } | 604 } |
| 588 | 605 |
| 589 if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,3)) || | 606 if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,3)) || |
| 590 (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) { | 607 (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) { |
| 591 if (NULL == fFunctions.fDrawArraysIndirect || | 608 if (NULL == fFunctions.fDrawArraysIndirect || |
| 592 NULL == fFunctions.fDrawElementsIndirect) { | 609 NULL == fFunctions.fDrawElementsIndirect) { |
| 593 RETURN_FALSE_INTERFACE | 610 RETURN_FALSE_INTERFACE |
| 594 } | 611 } |
| 595 } | 612 } |
| 596 | 613 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 | 772 |
| 756 if (fExtensions.has("EGL_KHR_image") || fExtensions.has("EGL_KHR_image_base"
)) { | 773 if (fExtensions.has("EGL_KHR_image") || fExtensions.has("EGL_KHR_image_base"
)) { |
| 757 if (nullptr == fFunctions.fEGLCreateImage || | 774 if (nullptr == fFunctions.fEGLCreateImage || |
| 758 nullptr == fFunctions.fEGLDestroyImage) { | 775 nullptr == fFunctions.fEGLDestroyImage) { |
| 759 RETURN_FALSE_INTERFACE | 776 RETURN_FALSE_INTERFACE |
| 760 } | 777 } |
| 761 } | 778 } |
| 762 | 779 |
| 763 return true; | 780 return true; |
| 764 } | 781 } |
| OLD | NEW |