Chromium Code Reviews| 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 362 } | 362 } |
| 363 | 363 |
| 364 if (GrGLCaps::kES_IMG_MsToTexture_MSFBOType == fMSFBOType) { | 364 if (GrGLCaps::kES_IMG_MsToTexture_MSFBOType == fMSFBOType) { |
| 365 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxSampleCount); | 365 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxSampleCount); |
| 366 } else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) { | 366 } else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) { |
| 367 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxSampleCount); | 367 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxSampleCount); |
| 368 } | 368 } |
| 369 | 369 |
| 370 this->initConfigRenderableTable(ctxInfo); | 370 this->initConfigRenderableTable(ctxInfo); |
| 371 | 371 |
| 372 this->initCompressedTextureSupport(ctxInfo); | |
| 373 | |
| 372 return true; | 374 return true; |
| 373 } | 375 } |
| 374 | 376 |
| 375 void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) { | 377 void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) { |
| 376 | 378 |
| 377 // OpenGL < 3.0 | 379 // OpenGL < 3.0 |
| 378 // no support for render targets unless the GL_ARB_framebuffer_object | 380 // no support for render targets unless the GL_ARB_framebuffer_object |
| 379 // extension is supported (in which case we get ALPHA, RED, RG, RGB, | 381 // extension is supported (in which case we get ALPHA, RED, RG, RGB, |
| 380 // RGBA (ALPHA8, RGBA4, RGBA8) for OpenGL > 1.1). Note that we | 382 // RGBA (ALPHA8, RGBA4, RGBA8) for OpenGL > 1.1). Note that we |
| 381 // probably don't get R8 in this case. | 383 // probably don't get R8 in this case. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 451 | 453 |
| 452 // If we don't support MSAA then undo any places above where we set a config as renderable with | 454 // If we don't support MSAA then undo any places above where we set a config as renderable with |
| 453 // msaa. | 455 // msaa. |
| 454 if (kNone_MSFBOType == fMSFBOType) { | 456 if (kNone_MSFBOType == fMSFBOType) { |
| 455 for (int i = 0; i < kGrPixelConfigCnt; ++i) { | 457 for (int i = 0; i < kGrPixelConfigCnt; ++i) { |
| 456 fConfigRenderSupport[i][kYes_MSAA] = false; | 458 fConfigRenderSupport[i][kYes_MSAA] = false; |
| 457 } | 459 } |
| 458 } | 460 } |
| 459 } | 461 } |
| 460 | 462 |
| 463 void GrGLCaps::initCompressedTextureSupport(const GrGLContextInfo &ctxInfo) { | |
| 464 GrGLStandard standard = ctxInfo.standard(); | |
| 465 GrGLVersion version = ctxInfo.version(); | |
| 466 | |
| 467 // glCompressedTexImage2D is available on all OpenGL ES devices... | |
| 468 // however, it is only available on the core profile after version 1.3 | |
|
bsalomon
2014/05/23 13:40:04
I think "core profile" is slightly confusing since
krajcevski
2014/05/23 15:11:46
Done.
| |
| 469 if (kGL_GrGLStandard == standard && version < GR_GL_VER(1, 3)) { | |
| 470 return; | |
| 471 } | |
| 472 | |
| 473 // Check for ETC1 | |
| 474 bool hasETC1 = false; | |
| 475 | |
| 476 // First check version for support | |
| 477 if (kGL_GrGLStandard == standard) { | |
| 478 hasETC1 = | |
| 479 version >= GR_GL_VER(4, 3) || | |
| 480 ctxInfo.hasExtension("GL_ARB_ES3_compatibility"); | |
| 481 } else { | |
| 482 hasETC1 = | |
| 483 version >= GR_GL_VER(3, 0) || | |
| 484 ctxInfo.hasExtension("GL_OES_compressed_ETC1_RGB8_texture") || | |
| 485 // ETC2 is a superset of ETC1, so we can just check for that, too. | |
| 486 (ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGB8_texture") && | |
| 487 ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGBA8_texture")); | |
| 488 } | |
| 489 fCompressedFormatSupport[kETC1_GrCompressedFormat] = hasETC1; | |
| 490 } | |
| 491 | |
| 461 bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, | 492 bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, |
| 462 GrGLenum format, | 493 GrGLenum format, |
| 463 GrGLenum type) const { | 494 GrGLenum type) const { |
| 464 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { | 495 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { |
| 465 // ES 2 guarantees this format is supported | 496 // ES 2 guarantees this format is supported |
| 466 return true; | 497 return true; |
| 467 } | 498 } |
| 468 | 499 |
| 469 if (!fTwoFormatLimit) { | 500 if (!fTwoFormatLimit) { |
| 470 // not limited by ES 2's constraints | 501 // not limited by ES 2's constraints |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 709 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); | 740 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); |
| 710 r.appendf("Fragment coord conventions support: %s\n", | 741 r.appendf("Fragment coord conventions support: %s\n", |
| 711 (fFragCoordsConventionSupport ? "YES": "NO")); | 742 (fFragCoordsConventionSupport ? "YES": "NO")); |
| 712 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); | 743 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); |
| 713 r.appendf("Use non-VBO for dynamic data: %s\n", | 744 r.appendf("Use non-VBO for dynamic data: %s\n", |
| 714 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); | 745 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); |
| 715 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO ")); | 746 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO ")); |
| 716 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO")); | 747 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO")); |
| 717 return r; | 748 return r; |
| 718 } | 749 } |
| OLD | NEW |