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

Unified Diff: src/gpu/gl/GrGLCaps.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLCaps.cpp
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index ec0f6288b4b550899650208d1a64a806bacfb5b8..168acdec735db31e89c8389f1fd12073642f31b9 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -51,6 +51,7 @@ GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions,
fMipMapLevelAndLodControlSupport = false;
fRGBAToBGRAReadbackConversionsAreSlow = false;
fDoManualMipmapping = false;
+ fSRGBDecodeDisableSupport = false;
fBlitFramebufferFlags = kNoSupport_BlitFramebufferFlag;
@@ -607,9 +608,11 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
fDoManualMipmapping = true;
}
+ fSRGBDecodeDisableSupport = ctxInfo.hasExtension("GL_EXT_texture_sRGB_decode");
+
// Requires fTextureRedSupport, fTextureSwizzleSupport, msaa support, ES compatibility have
// already been detected.
- this->initConfigTable(ctxInfo, gli, shaderCaps);
+ this->initConfigTable(contextOptions, ctxInfo, gli, shaderCaps);
this->applyOptionsOverrides(contextOptions);
shaderCaps->applyOptionsOverrides(contextOptions);
@@ -1389,7 +1392,8 @@ bool GrGLCaps::getExternalFormat(GrPixelConfig surfaceConfig, GrPixelConfig memo
return true;
}
-void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli,
+void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
+ const GrGLContextInfo& ctxInfo, const GrGLInterface* gli,
GrShaderCaps* shaderCaps) {
/*
Comments on renderability of configs on various GL versions.
@@ -1575,19 +1579,37 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
fSRGBWriteControl = true;
}
} else {
- // See https://bug.skia.org/4148 for PowerVR issue.
- fSRGBSupport = kPowerVRRogue_GrGLRenderer != ctxInfo.renderer() &&
- (ctxInfo.version() >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_EXT_sRGB"));
+ fSRGBSupport = ctxInfo.version() >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_EXT_sRGB");
+#if defined(SK_CPU_X86)
+ if (kPowerVRRogue_GrGLRenderer == ctxInfo.renderer()) {
+ // NexusPlayer has strange bugs with sRGB (skbug.com/4148). This is a targeted fix to
+ // blacklist that device (and any others that might be sharing the same driver).
+ fSRGBSupport = false;
+ }
+#endif
// ES through 3.1 requires EXT_srgb_write_control to support toggling
// sRGB writing for destinations.
// See https://bug.skia.org/5329 for Adreno4xx issue.
fSRGBWriteControl = kAdreno4xx_GrGLRenderer != ctxInfo.renderer() &&
ctxInfo.hasExtension("GL_EXT_sRGB_write_control");
}
- if (!ctxInfo.hasExtension("GL_EXT_texture_sRGB_decode")) {
- // To support "legacy" L32 mode, we require the ability to turn off sRGB decode:
+ if (contextOptions.fRequireDecodeDisableForSRGB && !fSRGBDecodeDisableSupport) {
+ // To support "legacy" L32 mode, we require the ability to turn off sRGB decode. Clients
+ // can opt-out of that requirement, if they intend to always do linear blending.
fSRGBSupport = false;
}
+
+ // This is very conservative, if we're on a platform where N32 is BGRA, and using ES, disable
+ // all sRGB support. Too much code relies on creating surfaces with N32 + sRGB colorspace,
+ // and sBGRA is basically impossible to support on any version of ES (with our current code).
+ // In particular, ES2 doesn't support sBGRA at all, and even in ES3, there is no valid pair
+ // of formats that can be used for TexImage calls to upload BGRA data to sRGBA (which is what
+ // we *have* to use as the internal format, because sBGRA doesn't exist). This primarily
+ // affects Windows.
+ if (kSkia8888_GrPixelConfig == kBGRA_8888_GrPixelConfig && kGLES_GrGLStandard == standard) {
+ fSRGBSupport = false;
+ }
+
fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_SRGB_ALPHA;
fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_SRGB8_ALPHA8;
// GL does not do srgb<->rgb conversions when transferring between cpu and gpu. Thus, the
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698