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

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

Issue 791823003: Add sRGB texture support. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add in changes for copy_to_new_texture_pixelref Created 6 years 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
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 10
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 // configs that are color-renderable and can be passed to glRenderBuffer StorageMultisample. 471 // configs that are color-renderable and can be passed to glRenderBuffer StorageMultisample.
472 // Chromium may have an extension to allow BGRA renderbuffers to work on desktop platforms. 472 // Chromium may have an extension to allow BGRA renderbuffers to work on desktop platforms.
473 if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888")) { 473 if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888")) {
474 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = true; 474 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = true;
475 } else { 475 } else {
476 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = 476 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] =
477 !fBGRAIsInternalFormat || !this->usesMSAARenderBuffers(); 477 !fBGRAIsInternalFormat || !this->usesMSAARenderBuffers();
478 } 478 }
479 } 479 }
480 480
481 if (this->fRGBA8RenderbufferSupport && this->isConfigTexturable(kSRGBA_8888_ GrPixelConfig)) {
482 if (kGL_GrGLStandard == standard) {
483 if (ctxInfo.version() >= GR_GL_VER(3,0) ||
484 ctxInfo.hasExtension("GL_ARB_framebuffer_sRGB") ||
485 ctxInfo.hasExtension("GL_EXT_framebuffer_sRGB")) {
486 fConfigRenderSupport[kSRGBA_8888_GrPixelConfig][kNo_MSAA] = true ;
487 fConfigRenderSupport[kSRGBA_8888_GrPixelConfig][kYes_MSAA] = tru e;
488 }
489 } else {
490 if (ctxInfo.version() >= GR_GL_VER(3,0) ||
491 ctxInfo.hasExtension("GL_EXT_sRGB")) {
492 fConfigRenderSupport[kSRGBA_8888_GrPixelConfig][kNo_MSAA] = true ;
493 fConfigRenderSupport[kSRGBA_8888_GrPixelConfig][kYes_MSAA] = tru e;
494 }
495 }
496 }
497
481 if (this->isConfigTexturable(kRGBA_float_GrPixelConfig)) { 498 if (this->isConfigTexturable(kRGBA_float_GrPixelConfig)) {
482 if (kGL_GrGLStandard == standard) { 499 if (kGL_GrGLStandard == standard) {
483 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = true; 500 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = true;
484 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kYes_MSAA] = true; 501 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kYes_MSAA] = true;
485 } else { 502 } else {
486 if (ctxInfo.hasExtension("GL_EXT_color_buffer_float")) { 503 if (ctxInfo.hasExtension("GL_EXT_color_buffer_float")) {
487 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = true ; 504 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = true ;
488 } else { 505 } else {
489 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = fals e; 506 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = fals e;
490 } 507 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 if (ctxInfo.hasExtension("GL_APPLE_texture_format_BGRA8888")) { 570 if (ctxInfo.hasExtension("GL_APPLE_texture_format_BGRA8888")) {
554 fConfigTextureSupport[kBGRA_8888_GrPixelConfig] = true; 571 fConfigTextureSupport[kBGRA_8888_GrPixelConfig] = true;
555 } else if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) { 572 } else if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) {
556 fConfigTextureSupport[kBGRA_8888_GrPixelConfig] = true; 573 fConfigTextureSupport[kBGRA_8888_GrPixelConfig] = true;
557 fBGRAIsInternalFormat = true; 574 fBGRAIsInternalFormat = true;
558 } 575 }
559 SkASSERT(fConfigTextureSupport[kBGRA_8888_GrPixelConfig] || 576 SkASSERT(fConfigTextureSupport[kBGRA_8888_GrPixelConfig] ||
560 kSkia8888_GrPixelConfig != kBGRA_8888_GrPixelConfig); 577 kSkia8888_GrPixelConfig != kBGRA_8888_GrPixelConfig);
561 } 578 }
562 579
580 // Check for sRGBA
581 if (kGL_GrGLStandard == standard) {
582 fConfigTextureSupport[kSRGBA_8888_GrPixelConfig] =
583 (version >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_EXT_texture_s RGB"));
584 } else {
585 fConfigTextureSupport[kSRGBA_8888_GrPixelConfig] =
586 (version >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_EXT_sRGB"));
587 }
588
563 // Compressed texture support 589 // Compressed texture support
564 590
565 // glCompressedTexImage2D is available on all OpenGL ES devices... 591 // glCompressedTexImage2D is available on all OpenGL ES devices...
566 // however, it is only available on standard OpenGL after version 1.3 592 // however, it is only available on standard OpenGL after version 1.3
567 bool hasCompressTex2D = (kGL_GrGLStandard != standard || version >= GR_GL_VE R(1, 3)); 593 bool hasCompressTex2D = (kGL_GrGLStandard != standard || version >= GR_GL_VE R(1, 3));
568 594
569 fCompressedTexSubImageSupport = 595 fCompressedTexSubImageSupport =
570 hasCompressTex2D && (gli->fFunctions.fCompressedTexSubImage2D); 596 hasCompressTex2D && (gli->fFunctions.fCompressedTexSubImage2D);
571 597
572 // Check for ETC1 598 // Check for ETC1
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); 1027 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO"));
1002 r.appendf("Fragment coord conventions support: %s\n", 1028 r.appendf("Fragment coord conventions support: %s\n",
1003 (fFragCoordsConventionSupport ? "YES": "NO")); 1029 (fFragCoordsConventionSupport ? "YES": "NO"));
1004 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); 1030 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
1005 r.appendf("Use non-VBO for dynamic data: %s\n", 1031 r.appendf("Use non-VBO for dynamic data: %s\n",
1006 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); 1032 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
1007 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO ")); 1033 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO "));
1008 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO")); 1034 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO"));
1009 return r; 1035 return r;
1010 } 1036 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698