aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu
diff options
context:
space:
mode:
authorGravatar brianosman <brianosman@google.com>2016-03-25 06:01:59 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-25 06:01:59 -0700
commit64d094d7756534a9b9b0997aab225d9ceba098b6 (patch)
treeb1297062c16726548ee940466da4e2fee17887e6 /include/gpu
parent73233a75752733db16870259cc06b2a5230c8ff8 (diff)
Require sRGB write control for sRGB support. Add flag to GrPaint to suppress linear -> sRGB conversion on write. Use that to fix YUV conversion, which directly produces sRGB data. (Technically, it produces data in whatever the color space of the JPEG might be).
Diffstat (limited to 'include/gpu')
-rw-r--r--include/gpu/GrCaps.h7
-rw-r--r--include/gpu/GrPaint.h9
2 files changed, 16 insertions, 0 deletions
diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h
index 1f5b11955b..398517cb68 100644
--- a/include/gpu/GrCaps.h
+++ b/include/gpu/GrCaps.h
@@ -137,6 +137,13 @@ public:
/** To avoid as-yet-unnecessary complexity we don't allow any partial support of MIP Maps (e.g.
only for POT textures) */
bool mipMapSupport() const { return fMipMapSupport; }
+
+ /**
+ * 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; }
bool twoSidedStencilSupport() const { return fTwoSidedStencilSupport; }
bool stencilWrapOpsSupport() const { return fStencilWrapOpsSupport; }
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index 152cb51d7e..3f06f092ab 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -56,6 +56,13 @@ public:
void setAntiAlias(bool aa) { fAntiAlias = aa; }
bool isAntiAlias() const { return fAntiAlias; }
+ /**
+ * Should shader output conversion from linear to sRGB be disabled.
+ * Only relevant if the destination is sRGB. Defaults to false.
+ */
+ void setDisableOutputConversionToSRGB(bool srgb) { fDisableOutputConversionToSRGB = srgb; }
+ bool getDisableOutputConversionToSRGB() const { return fDisableOutputConversionToSRGB; }
+
const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) {
fXPFactory.reset(SkSafeRef(xpFactory));
return xpFactory;
@@ -112,6 +119,7 @@ public:
GrPaint& operator=(const GrPaint& paint) {
fAntiAlias = paint.fAntiAlias;
+ fDisableOutputConversionToSRGB = paint.fDisableOutputConversionToSRGB;
fColor = paint.fColor;
this->resetFragmentProcessors();
@@ -154,6 +162,7 @@ private:
SkSTArray<2, const GrFragmentProcessor*, true> fCoverageFragmentProcessors;
bool fAntiAlias;
+ bool fDisableOutputConversionToSRGB;
GrColor fColor;
};