OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrGLCaps.h" | 9 #include "GrGLCaps.h" |
10 #include "GrGLContext.h" | 10 #include "GrGLContext.h" |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 // configs that are color-renderable and can be passed to glRenderBuffer
StorageMultisample. | 437 // configs that are color-renderable and can be passed to glRenderBuffer
StorageMultisample. |
438 // Chromium may have an extension to allow BGRA renderbuffers to work on
desktop platforms. | 438 // Chromium may have an extension to allow BGRA renderbuffers to work on
desktop platforms. |
439 if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888")) { | 439 if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888")) { |
440 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = true; | 440 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = true; |
441 } else { | 441 } else { |
442 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = | 442 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = |
443 !fBGRAIsInternalFormat || !this->usesMSAARenderBuffers(); | 443 !fBGRAIsInternalFormat || !this->usesMSAARenderBuffers(); |
444 } | 444 } |
445 } | 445 } |
446 | 446 |
| 447 if (this->isConfigTexturable(kRGBA_float_GrPixelConfig)) { |
| 448 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = true; |
| 449 } |
| 450 |
447 // If we don't support MSAA then undo any places above where we set a config
as renderable with | 451 // If we don't support MSAA then undo any places above where we set a config
as renderable with |
448 // msaa. | 452 // msaa. |
449 if (kNone_MSFBOType == fMSFBOType) { | 453 if (kNone_MSFBOType == fMSFBOType) { |
450 for (int i = 0; i < kGrPixelConfigCnt; ++i) { | 454 for (int i = 0; i < kGrPixelConfigCnt; ++i) { |
451 fConfigRenderSupport[i][kYes_MSAA] = false; | 455 fConfigRenderSupport[i][kYes_MSAA] = false; |
452 } | 456 } |
453 } | 457 } |
454 } | 458 } |
455 | 459 |
456 void GrGLCaps::initConfigTexturableTable(const GrGLContextInfo& ctxInfo, const G
rGLInterface* gli) { | 460 void GrGLCaps::initConfigTexturableTable(const GrGLContextInfo& ctxInfo, const G
rGLInterface* gli) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 // glCompressedTexImage2D is available on all OpenGL ES devices... | 501 // glCompressedTexImage2D is available on all OpenGL ES devices... |
498 // however, it is only available on standard OpenGL after version 1.3 | 502 // however, it is only available on standard OpenGL after version 1.3 |
499 bool hasCompressTex2D = (kGL_GrGLStandard != standard || version >= GR_GL_VE
R(1, 3)); | 503 bool hasCompressTex2D = (kGL_GrGLStandard != standard || version >= GR_GL_VE
R(1, 3)); |
500 | 504 |
501 // Check for ETC1 | 505 // Check for ETC1 |
502 bool hasETC1 = false; | 506 bool hasETC1 = false; |
503 | 507 |
504 // First check version for support | 508 // First check version for support |
505 if (kGL_GrGLStandard == standard) { | 509 if (kGL_GrGLStandard == standard) { |
506 hasETC1 = hasCompressTex2D && | 510 hasETC1 = hasCompressTex2D && |
507 (version >= GR_GL_VER(4, 3) || | 511 (version >= GR_GL_VER(4, 3) || |
508 ctxInfo.hasExtension("GL_ARB_ES3_compatibility")); | 512 ctxInfo.hasExtension("GL_ARB_ES3_compatibility")); |
509 } else { | 513 } else { |
510 hasETC1 = hasCompressTex2D && | 514 hasETC1 = hasCompressTex2D && |
511 (version >= GR_GL_VER(3, 0) || | 515 (version >= GR_GL_VER(3, 0) || |
512 ctxInfo.hasExtension("GL_OES_compressed_ETC1_RGB8_texture") || | 516 ctxInfo.hasExtension("GL_OES_compressed_ETC1_RGB8_texture") || |
513 // ETC2 is a superset of ETC1, so we can just check for that, too. | 517 // ETC2 is a superset of ETC1, so we can just check for that, too. |
514 (ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGB8_texture") && | 518 (ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGB8_texture") && |
515 ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGBA8_texture"))); | 519 ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGBA8_texture"))); |
516 } | 520 } |
517 fConfigTextureSupport[kETC1_GrPixelConfig] = hasETC1; | 521 fConfigTextureSupport[kETC1_GrPixelConfig] = hasETC1; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 fConfigTextureSupport[kLATC_GrPixelConfig] = hasLATC; | 555 fConfigTextureSupport[kLATC_GrPixelConfig] = hasLATC; |
552 fLATCAlias = alias; | 556 fLATCAlias = alias; |
553 | 557 |
554 // Check for R11_EAC | 558 // Check for R11_EAC |
555 if (kGL_GrGLStandard == standard) { | 559 if (kGL_GrGLStandard == standard) { |
556 fConfigTextureSupport[kR11_EAC_GrPixelConfig] = | 560 fConfigTextureSupport[kR11_EAC_GrPixelConfig] = |
557 version >= GR_GL_VER(4, 3) || ctxInfo.hasExtension("GL_ARB_ES3_compa
tibility"); | 561 version >= GR_GL_VER(4, 3) || ctxInfo.hasExtension("GL_ARB_ES3_compa
tibility"); |
558 } else { | 562 } else { |
559 fConfigTextureSupport[kR11_EAC_GrPixelConfig] = version >= GR_GL_VER(3,
0); | 563 fConfigTextureSupport[kR11_EAC_GrPixelConfig] = version >= GR_GL_VER(3,
0); |
560 } | 564 } |
| 565 |
| 566 // Check for floating point texture support |
| 567 // NOTE: We disallow floating point textures on ES devices if linear |
| 568 // filtering modes are not supported. This is for simplicity, but a more |
| 569 // granular approach is possible. Coincidentally, floating point textures b
ecame part of |
| 570 // the standard in ES3.1 / OGL 3.1, hence the shorthand |
| 571 bool hasFPTextures = version >= GR_GL_VER(3, 1); |
| 572 if (!hasFPTextures) { |
| 573 hasFPTextures = ctxInfo.hasExtension("GL_ARB_texture_float") || |
| 574 (ctxInfo.hasExtension("OES_texture_float_linear") && |
| 575 ctxInfo.hasExtension("GL_OES_texture_float")); |
| 576 } |
| 577 fConfigTextureSupport[kRGBA_float_GrPixelConfig] = hasFPTextures; |
561 } | 578 } |
562 | 579 |
563 bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, | 580 bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, |
564 GrGLenum format, | 581 GrGLenum format, |
565 GrGLenum type) const { | 582 GrGLenum type) const { |
566 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { | 583 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { |
567 // ES 2 guarantees this format is supported | 584 // ES 2 guarantees this format is supported |
568 return true; | 585 return true; |
569 } | 586 } |
570 | 587 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); | 827 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); |
811 r.appendf("Fragment coord conventions support: %s\n", | 828 r.appendf("Fragment coord conventions support: %s\n", |
812 (fFragCoordsConventionSupport ? "YES": "NO")); | 829 (fFragCoordsConventionSupport ? "YES": "NO")); |
813 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ?
"YES": "NO")); | 830 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ?
"YES": "NO")); |
814 r.appendf("Use non-VBO for dynamic data: %s\n", | 831 r.appendf("Use non-VBO for dynamic data: %s\n", |
815 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); | 832 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); |
816 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO
")); | 833 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO
")); |
817 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES"
: "NO")); | 834 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES"
: "NO")); |
818 return r; | 835 return r; |
819 } | 836 } |
OLD | NEW |