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

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

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

Powered by Google App Engine
This is Rietveld 408576698