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 | |
374 return true; | 372 return true; |
375 } | 373 } |
376 | 374 |
377 void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) { | 375 void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) { |
378 | 376 |
379 // OpenGL < 3.0 | 377 // OpenGL < 3.0 |
380 // no support for render targets unless the GL_ARB_framebuffer_object | 378 // no support for render targets unless the GL_ARB_framebuffer_object |
381 // extension is supported (in which case we get ALPHA, RED, RG, RGB, | 379 // extension is supported (in which case we get ALPHA, RED, RG, RGB, |
382 // RGBA (ALPHA8, RGBA4, RGBA8) for OpenGL > 1.1). Note that we | 380 // RGBA (ALPHA8, RGBA4, RGBA8) for OpenGL > 1.1). Note that we |
383 // probably don't get R8 in this case. | 381 // probably don't get R8 in this case. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 | 451 |
454 // If we don't support MSAA then undo any places above where we set a config
as renderable with | 452 // If we don't support MSAA then undo any places above where we set a config
as renderable with |
455 // msaa. | 453 // msaa. |
456 if (kNone_MSFBOType == fMSFBOType) { | 454 if (kNone_MSFBOType == fMSFBOType) { |
457 for (int i = 0; i < kGrPixelConfigCnt; ++i) { | 455 for (int i = 0; i < kGrPixelConfigCnt; ++i) { |
458 fConfigRenderSupport[i][kYes_MSAA] = false; | 456 fConfigRenderSupport[i][kYes_MSAA] = false; |
459 } | 457 } |
460 } | 458 } |
461 } | 459 } |
462 | 460 |
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 standard OpenGL after version 1.3 | |
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 | |
492 bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, | 461 bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, |
493 GrGLenum format, | 462 GrGLenum format, |
494 GrGLenum type) const { | 463 GrGLenum type) const { |
495 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { | 464 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { |
496 // ES 2 guarantees this format is supported | 465 // ES 2 guarantees this format is supported |
497 return true; | 466 return true; |
498 } | 467 } |
499 | 468 |
500 if (!fTwoFormatLimit) { | 469 if (!fTwoFormatLimit) { |
501 // not limited by ES 2's constraints | 470 // not limited by ES 2's constraints |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); | 709 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); |
741 r.appendf("Fragment coord conventions support: %s\n", | 710 r.appendf("Fragment coord conventions support: %s\n", |
742 (fFragCoordsConventionSupport ? "YES": "NO")); | 711 (fFragCoordsConventionSupport ? "YES": "NO")); |
743 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ?
"YES": "NO")); | 712 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ?
"YES": "NO")); |
744 r.appendf("Use non-VBO for dynamic data: %s\n", | 713 r.appendf("Use non-VBO for dynamic data: %s\n", |
745 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); | 714 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); |
746 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO
")); | 715 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO
")); |
747 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES"
: "NO")); | 716 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES"
: "NO")); |
748 return r; | 717 return r; |
749 } | 718 } |
OLD | NEW |