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

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

Issue 2539993002: Enable sRGB on iOS, make sRGB decode support optional (Closed)
Patch Set: Don't allow sRGBA on ES BGRA devices Created 4 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
« no previous file with comments | « src/gpu/gl/GrGLCaps.cpp ('k') | tests/SRGBMipMapTest.cpp » ('j') | 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 "GrGLGpuCommandBuffer.h" 10 #include "GrGLGpuCommandBuffer.h"
(...skipping 3225 matching lines...) Expand 10 before | Expand all | Expand 10 after
3236 3236
3237 if (GrSamplerParams::kMipMap_FilterMode == filterMode) { 3237 if (GrSamplerParams::kMipMap_FilterMode == filterMode) {
3238 if (!this->caps()->mipMapSupport() || GrPixelConfigIsCompressed(texture- >config())) { 3238 if (!this->caps()->mipMapSupport() || GrPixelConfigIsCompressed(texture- >config())) {
3239 filterMode = GrSamplerParams::kBilerp_FilterMode; 3239 filterMode = GrSamplerParams::kBilerp_FilterMode;
3240 } 3240 }
3241 } 3241 }
3242 3242
3243 newTexParams.fMinFilter = glMinFilterModes[filterMode]; 3243 newTexParams.fMinFilter = glMinFilterModes[filterMode];
3244 newTexParams.fMagFilter = glMagFilterModes[filterMode]; 3244 newTexParams.fMagFilter = glMagFilterModes[filterMode];
3245 3245
3246 if (GrPixelConfigIsSRGB(texture->config())) { 3246 if (this->glCaps().srgbDecodeDisableSupport() && GrPixelConfigIsSRGB(texture ->config())) {
3247 newTexParams.fSRGBDecode = allowSRGBInputs ? GR_GL_DECODE_EXT : GR_GL_SK IP_DECODE_EXT; 3247 newTexParams.fSRGBDecode = allowSRGBInputs ? GR_GL_DECODE_EXT : GR_GL_SK IP_DECODE_EXT;
3248 if (setAll || newTexParams.fSRGBDecode != oldTexParams.fSRGBDecode) { 3248 if (setAll || newTexParams.fSRGBDecode != oldTexParams.fSRGBDecode) {
3249 this->setTextureUnit(unitIdx); 3249 this->setTextureUnit(unitIdx);
3250 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_SRGB_DECODE_EXT, newTexP arams.fSRGBDecode)); 3250 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_SRGB_DECODE_EXT, newTexP arams.fSRGBDecode));
3251 } 3251 }
3252 } 3252 }
3253 3253
3254 #ifdef SK_DEBUG 3254 #ifdef SK_DEBUG
3255 // We were supposed to ensure MipMaps were up-to-date and built correctly be fore getting here. 3255 // We were supposed to ensure MipMaps were up-to-date and built correctly be fore getting here.
3256 if (GrSamplerParams::kMipMap_FilterMode == filterMode) { 3256 if (GrSamplerParams::kMipMap_FilterMode == filterMode) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
3412 if (texRT) { 3412 if (texRT) {
3413 this->onResolveRenderTarget(texRT); 3413 this->onResolveRenderTarget(texRT);
3414 } 3414 }
3415 3415
3416 GrGLenum target = texture->target(); 3416 GrGLenum target = texture->target();
3417 this->setScratchTextureUnit(); 3417 this->setScratchTextureUnit();
3418 GL_CALL(BindTexture(target, texture->textureID())); 3418 GL_CALL(BindTexture(target, texture->textureID()));
3419 3419
3420 // Configure sRGB decode, if necessary. This state is the only thing needed for the driver 3420 // Configure sRGB decode, if necessary. This state is the only thing needed for the driver
3421 // call (glGenerateMipmap) to work correctly. Our manual method dirties othe r state, too. 3421 // call (glGenerateMipmap) to work correctly. Our manual method dirties othe r state, too.
3422 if (GrPixelConfigIsSRGB(texture->config())) { 3422 if (this->glCaps().srgbDecodeDisableSupport() && GrPixelConfigIsSRGB(texture ->config())) {
3423 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_SRGB_DECODE_EXT, 3423 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_SRGB_DECODE_EXT,
3424 allowSRGBInputs ? GR_GL_DECODE_EXT : GR_GL_SKIP_DE CODE_EXT)); 3424 allowSRGBInputs ? GR_GL_DECODE_EXT : GR_GL_SKIP_DE CODE_EXT));
3425 } 3425 }
3426 3426
3427 // Either do manual mipmap generation or (if that fails), just rely on the d river: 3427 // Either do manual mipmap generation or (if that fails), just rely on the d river:
3428 if (!this->generateMipmap(texture, allowSRGBInputs)) { 3428 if (!this->generateMipmap(texture, allowSRGBInputs)) {
3429 GL_CALL(GenerateMipmap(target)); 3429 GL_CALL(GenerateMipmap(target));
3430 } 3430 }
3431 3431
3432 texture->texturePriv().dirtyMipMaps(false); 3432 texture->texturePriv().dirtyMipMaps(false);
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after
4689 4689
4690 bool GrGLGpu::waitFence(GrFence fence, uint64_t timeout) const { 4690 bool GrGLGpu::waitFence(GrFence fence, uint64_t timeout) const {
4691 GrGLenum result; 4691 GrGLenum result;
4692 GL_CALL_RET(result, ClientWaitSync((GrGLsync)fence, GR_GL_SYNC_FLUSH_COMMAND S_BIT, timeout)); 4692 GL_CALL_RET(result, ClientWaitSync((GrGLsync)fence, GR_GL_SYNC_FLUSH_COMMAND S_BIT, timeout));
4693 return (GR_GL_CONDITION_SATISFIED == result); 4693 return (GR_GL_CONDITION_SATISFIED == result);
4694 } 4694 }
4695 4695
4696 void GrGLGpu::deleteFence(GrFence fence) const { 4696 void GrGLGpu::deleteFence(GrFence fence) const {
4697 GL_CALL(DeleteSync((GrGLsync)fence)); 4697 GL_CALL(DeleteSync((GrGLsync)fence));
4698 } 4698 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLCaps.cpp ('k') | tests/SRGBMipMapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698