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

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

Issue 2002253002: Remove sRGB overrides on GrTextureParams. Use GrPaint flags instead. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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
« src/gpu/gl/GrGLGpu.h ('K') | « src/gpu/gl/GrGLGpu.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 2011 Google Inc. 2 * Copyright 2011 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 #include "GrGLGpu.h" 8 #include "GrGLGpu.h"
9 #include "GrGLBuffer.h" 9 #include "GrGLBuffer.h"
10 #include "GrGLGLSL.h" 10 #include "GrGLGLSL.h"
(...skipping 3083 matching lines...) Expand 10 before | Expand all | Expand 10 after
3094 the generated shader code. This potentially allows greater reuse of cached sha ders. */ 3094 the generated shader code. This potentially allows greater reuse of cached sha ders. */
3095 static void get_tex_param_swizzle(GrPixelConfig config, 3095 static void get_tex_param_swizzle(GrPixelConfig config,
3096 const GrGLCaps& caps, 3096 const GrGLCaps& caps,
3097 GrGLenum* glSwizzle) { 3097 GrGLenum* glSwizzle) {
3098 const GrSwizzle& swizzle = caps.configSwizzle(config); 3098 const GrSwizzle& swizzle = caps.configSwizzle(config);
3099 for (int i = 0; i < 4; ++i) { 3099 for (int i = 0; i < 4; ++i) {
3100 glSwizzle[i] = get_component_enum_from_char(swizzle.c_str()[i]); 3100 glSwizzle[i] = get_component_enum_from_char(swizzle.c_str()[i]);
3101 } 3101 }
3102 } 3102 }
3103 3103
3104 void GrGLGpu::bindTexture(int unitIdx, const GrTextureParams& params, bool dstCo nfigAllowsSRGB, 3104 void GrGLGpu::bindTexture(int unitIdx, const GrTextureParams& params, bool allow SRGBInputs,
3105 GrGLTexture* texture) { 3105 GrGLTexture* texture) {
3106 SkASSERT(texture); 3106 SkASSERT(texture);
3107 3107
3108 #ifdef SK_DEBUG 3108 #ifdef SK_DEBUG
3109 if (!this->caps()->npotTextureTileSupport()) { 3109 if (!this->caps()->npotTextureTileSupport()) {
3110 const bool tileX = SkShader::kClamp_TileMode != params.getTileModeX(); 3110 const bool tileX = SkShader::kClamp_TileMode != params.getTileModeX();
3111 const bool tileY = SkShader::kClamp_TileMode != params.getTileModeY(); 3111 const bool tileY = SkShader::kClamp_TileMode != params.getTileModeY();
3112 if (tileX || tileY) { 3112 if (tileX || tileY) {
3113 const int w = texture->width(); 3113 const int w = texture->width();
3114 const int h = texture->height(); 3114 const int h = texture->height();
(...skipping 19 matching lines...) Expand all
3134 } 3134 }
3135 3135
3136 ResetTimestamp timestamp; 3136 ResetTimestamp timestamp;
3137 const GrGLTexture::TexParams& oldTexParams = texture->getCachedTexParams(&ti mestamp); 3137 const GrGLTexture::TexParams& oldTexParams = texture->getCachedTexParams(&ti mestamp);
3138 bool setAll = timestamp < this->getResetTimestamp(); 3138 bool setAll = timestamp < this->getResetTimestamp();
3139 GrGLTexture::TexParams newTexParams; 3139 GrGLTexture::TexParams newTexParams;
3140 3140
3141 if (this->caps()->srgbSupport()) { 3141 if (this->caps()->srgbSupport()) {
3142 // By default, the decision to allow SRGB decode is based on the destina tion config. 3142 // By default, the decision to allow SRGB decode is based on the destina tion config.
3143 // A texture can override that by specifying a value in GrTextureParams. 3143 // A texture can override that by specifying a value in GrTextureParams.
3144 newTexParams.fSRGBDecode = 3144 newTexParams.fSRGBDecode = allowSRGBInputs ? GR_GL_DECODE_EXT : GR_GL_SK IP_DECODE_EXT;
3145 (dstConfigAllowsSRGB || GrTextureParams::kForceAllowSRGB_SRGBMode == params.srgbMode())
3146 ? GR_GL_DECODE_EXT : GR_GL_SKIP_DECODE_EXT;
3147 3145
3148 if (setAll || newTexParams.fSRGBDecode != oldTexParams.fSRGBDecode) { 3146 if (setAll || newTexParams.fSRGBDecode != oldTexParams.fSRGBDecode) {
3149 this->setTextureUnit(unitIdx); 3147 this->setTextureUnit(unitIdx);
3150 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_SRGB_DECODE_EXT, newTexP arams.fSRGBDecode)); 3148 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_SRGB_DECODE_EXT, newTexP arams.fSRGBDecode));
3151 } 3149 }
3152 } 3150 }
3153 3151
3154 static GrGLenum glMinFilterModes[] = { 3152 static GrGLenum glMinFilterModes[] = {
3155 GR_GL_NEAREST, 3153 GR_GL_NEAREST,
3156 GR_GL_LINEAR, 3154 GR_GL_LINEAR,
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
4247 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || 4245 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() ||
4248 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { 4246 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) {
4249 copyParams->fFilter = GrTextureParams::kNone_FilterMode; 4247 copyParams->fFilter = GrTextureParams::kNone_FilterMode;
4250 copyParams->fWidth = texture->width(); 4248 copyParams->fWidth = texture->width();
4251 copyParams->fHeight = texture->height(); 4249 copyParams->fHeight = texture->height();
4252 return true; 4250 return true;
4253 } 4251 }
4254 } 4252 }
4255 return false; 4253 return false;
4256 } 4254 }
OLDNEW
« src/gpu/gl/GrGLGpu.h ('K') | « src/gpu/gl/GrGLGpu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698