Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: src/gpu/gl/GrGLCaps.cpp

Issue 302553008: Revert of Revert of Add compressed texture capabilities for GPU devices (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 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 fCompressedFormatSupport[kETC2_GrCompressedFormat] = false;
492 fCompressedFormatSupport[kDXT1_GrCompressedFormat] = false;
493 }
494
461 bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, 495 bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf,
462 GrGLenum format, 496 GrGLenum format,
463 GrGLenum type) const { 497 GrGLenum type) const {
464 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { 498 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) {
465 // ES 2 guarantees this format is supported 499 // ES 2 guarantees this format is supported
466 return true; 500 return true;
467 } 501 }
468 502
469 if (!fTwoFormatLimit) { 503 if (!fTwoFormatLimit) {
470 // not limited by ES 2's constraints 504 // not limited by ES 2's constraints
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); 743 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO"));
710 r.appendf("Fragment coord conventions support: %s\n", 744 r.appendf("Fragment coord conventions support: %s\n",
711 (fFragCoordsConventionSupport ? "YES": "NO")); 745 (fFragCoordsConventionSupport ? "YES": "NO"));
712 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); 746 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
713 r.appendf("Use non-VBO for dynamic data: %s\n", 747 r.appendf("Use non-VBO for dynamic data: %s\n",
714 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); 748 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
715 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO ")); 749 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")); 750 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO"));
717 return r; 751 return r;
718 } 752 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698