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