aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/gpu/GrCaps.h6
-rw-r--r--src/gpu/GrCaps.cpp2
-rw-r--r--src/gpu/gl/GrGLCaps.cpp6
-rw-r--r--src/gpu/gl/GrGLGpu.cpp2
4 files changed, 11 insertions, 5 deletions
diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h
index 6d11b137e4..e28b49488a 100644
--- a/include/gpu/GrCaps.h
+++ b/include/gpu/GrCaps.h
@@ -144,9 +144,12 @@ public:
* Skia convention is that a device only has sRGB support if it supports sRGB formats for both
* textures and framebuffers. In addition:
* Decoding to linear of an sRGB texture can be disabled.
- * Encoding and gamma-correct blending to an sRGB framebuffer can be disabled.
*/
bool srgbSupport() const { return fSRGBSupport; }
+ /**
+ * Is there support for enabling/disabling sRGB writes for sRGB-capable color buffers?
+ */
+ bool srgbWriteControl() const { return fSRGBWriteControl; }
bool twoSidedStencilSupport() const { return fTwoSidedStencilSupport; }
bool stencilWrapOpsSupport() const { return fStencilWrapOpsSupport; }
bool discardRenderTargetSupport() const { return fDiscardRenderTargetSupport; }
@@ -284,6 +287,7 @@ protected:
bool fNPOTTextureTileSupport : 1;
bool fMipMapSupport : 1;
bool fSRGBSupport : 1;
+ bool fSRGBWriteControl : 1;
bool fTwoSidedStencilSupport : 1;
bool fStencilWrapOpsSupport : 1;
bool fDiscardRenderTargetSupport : 1;
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index 1056c426aa..cdc9ba7057 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -85,6 +85,7 @@ GrCaps::GrCaps(const GrContextOptions& options) {
fMipMapSupport = false;
fNPOTTextureTileSupport = false;
fSRGBSupport = false;
+ fSRGBWriteControl = false;
fTwoSidedStencilSupport = false;
fStencilWrapOpsSupport = false;
fDiscardRenderTargetSupport = false;
@@ -162,6 +163,7 @@ SkString GrCaps::dump() const {
r.appendf("MIP Map Support : %s\n", gNY[fMipMapSupport]);
r.appendf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileSupport]);
r.appendf("sRGB Support : %s\n", gNY[fSRGBSupport]);
+ r.appendf("sRGB Write Control : %s\n", gNY[fSRGBWriteControl]);
r.appendf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilSupport]);
r.appendf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSupport]);
r.appendf("Discard Render Target Support : %s\n", gNY[fDiscardRenderTargetSupport]);
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 9b12ce69c5..ebfbf6a065 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -1457,8 +1457,7 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
fConfigTable[kBGRA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
// We only enable srgb support if both textures and FBOs support srgb,
- // *and* we can disable sRGB decode-on-read, to support "legacy" mode,
- // *and* we can disable sRGB encode-on-write.
+ // *and* we can disable sRGB decode-on-read, to support "legacy" mode.
if (kGL_GrGLStandard == standard) {
if (ctxInfo.version() >= GR_GL_VER(3,0)) {
fSRGBSupport = true;
@@ -1469,13 +1468,14 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
}
}
// All the above srgb extensions support toggling srgb writes
+ 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"));
// ES through 3.1 requires EXT_srgb_write_control to support toggling
// sRGB writing for destinations.
- fSRGBSupport = fSRGBSupport && ctxInfo.hasExtension("GL_EXT_sRGB_write_control");
+ fSRGBWriteControl = 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:
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 027d9527c0..40d0e488d5 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -2639,7 +2639,7 @@ void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bounds,
this->flushViewport(target->getViewport());
}
- if (this->glCaps().srgbSupport()) {
+ if (this->glCaps().srgbWriteControl()) {
bool enableSRGBWrite = GrPixelConfigIsSRGB(target->config()) && !disableSRGB;
if (enableSRGBWrite && kYes_TriState != fHWSRGBFramebuffer) {
GL_CALL(Enable(GR_GL_FRAMEBUFFER_SRGB));