aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2018-07-11 10:02:07 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-11 14:30:58 +0000
commit532b3f944a4991064963aee8f535c695f4068368 (patch)
tree671769fb6808a70240c1f857594e7f36b4ae8074 /src/gpu/effects
parentc87cfb674bcaf27062dd11f88f1337af70173a11 (diff)
Remove clamping of kPlus with F16 configs
The most common use-case for F16 is to draw things that are explicitly outside of [0,1]. We can't prevent out-of-range values in general, users could just draw out-of-range content in src mode. We've decided that it's best to avoid surprising behavior, and trust the user in these situations. This effectively reverts https://skia-review.googlesource.com/c/skia/+/48183 Bug: skia: Change-Id: I71c2dd925c567e2862d96ab70c752f19245a69c4 Reviewed-on: https://skia-review.googlesource.com/140500 Reviewed-by: Mike Klein <mtklein@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/effects')
-rw-r--r--src/gpu/effects/GrCoverageSetOpXP.cpp3
-rw-r--r--src/gpu/effects/GrCoverageSetOpXP.h6
-rw-r--r--src/gpu/effects/GrCustomXfermode.cpp11
-rw-r--r--src/gpu/effects/GrDisableColorXP.cpp3
-rw-r--r--src/gpu/effects/GrDisableColorXP.h6
-rw-r--r--src/gpu/effects/GrPorterDuffXferProcessor.cpp23
-rw-r--r--src/gpu/effects/GrPorterDuffXferProcessor.h9
7 files changed, 20 insertions, 41 deletions
diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp
index 2524c9c298..e7ac874c2b 100644
--- a/src/gpu/effects/GrCoverageSetOpXP.cpp
+++ b/src/gpu/effects/GrCoverageSetOpXP.cpp
@@ -211,8 +211,7 @@ sk_sp<const GrXferProcessor> GrCoverageSetOpXPFactory::makeXferProcessor(
const GrProcessorAnalysisColor&,
GrProcessorAnalysisCoverage,
bool hasMixedSamples,
- const GrCaps& caps,
- GrPixelConfigIsClamped dstIsClamped) const {
+ const GrCaps& caps) const {
// We don't support inverting coverage with mixed samples. We don't expect to ever want this in
// the future, however we could at some point make this work using an inverted coverage
// modulation table. Note that an inverted table still won't work if there are coverage procs.
diff --git a/src/gpu/effects/GrCoverageSetOpXP.h b/src/gpu/effects/GrCoverageSetOpXP.h
index cf91848944..e8bc5a223f 100644
--- a/src/gpu/effects/GrCoverageSetOpXP.h
+++ b/src/gpu/effects/GrCoverageSetOpXP.h
@@ -37,13 +37,11 @@ private:
sk_sp<const GrXferProcessor> makeXferProcessor(const GrProcessorAnalysisColor&,
GrProcessorAnalysisCoverage,
bool hasMixedSamples,
- const GrCaps&,
- GrPixelConfigIsClamped) const override;
+ const GrCaps&) const override;
AnalysisProperties analysisProperties(const GrProcessorAnalysisColor&,
const GrProcessorAnalysisCoverage&,
- const GrCaps&,
- GrPixelConfigIsClamped) const override {
+ const GrCaps&) const override {
return AnalysisProperties::kIgnoresInputColor;
}
diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp
index bdeda9467c..5c352604c6 100644
--- a/src/gpu/effects/GrCustomXfermode.cpp
+++ b/src/gpu/effects/GrCustomXfermode.cpp
@@ -217,13 +217,11 @@ private:
sk_sp<const GrXferProcessor> makeXferProcessor(const GrProcessorAnalysisColor&,
GrProcessorAnalysisCoverage,
bool hasMixedSamples,
- const GrCaps&,
- GrPixelConfigIsClamped) const override;
+ const GrCaps&) const override;
AnalysisProperties analysisProperties(const GrProcessorAnalysisColor&,
const GrProcessorAnalysisCoverage&,
- const GrCaps&,
- GrPixelConfigIsClamped) const override;
+ const GrCaps&) const override;
GR_DECLARE_XP_FACTORY_TEST
@@ -243,8 +241,7 @@ sk_sp<const GrXferProcessor> CustomXPFactory::makeXferProcessor(
const GrProcessorAnalysisColor&,
GrProcessorAnalysisCoverage coverage,
bool hasMixedSamples,
- const GrCaps& caps,
- GrPixelConfigIsClamped dstIsClamped) const {
+ const GrCaps& caps) const {
SkASSERT(GrCustomXfermode::IsSupportedMode(fMode));
if (can_use_hw_blend_equation(fHWBlendEquation, coverage, caps)) {
return sk_sp<GrXferProcessor>(new CustomXP(fMode, fHWBlendEquation));
@@ -254,7 +251,7 @@ sk_sp<const GrXferProcessor> CustomXPFactory::makeXferProcessor(
GrXPFactory::AnalysisProperties CustomXPFactory::analysisProperties(
const GrProcessorAnalysisColor&, const GrProcessorAnalysisCoverage& coverage,
- const GrCaps& caps, GrPixelConfigIsClamped dstIsClamped) const {
+ const GrCaps& caps) const {
/*
The general SVG blend equation is defined in the spec as follows:
diff --git a/src/gpu/effects/GrDisableColorXP.cpp b/src/gpu/effects/GrDisableColorXP.cpp
index 314be6ee13..3f9f71e314 100644
--- a/src/gpu/effects/GrDisableColorXP.cpp
+++ b/src/gpu/effects/GrDisableColorXP.cpp
@@ -79,8 +79,7 @@ sk_sp<const GrXferProcessor> GrDisableColorXPFactory::makeXferProcessor(
const GrProcessorAnalysisColor&,
GrProcessorAnalysisCoverage,
bool hasMixedSamples,
- const GrCaps& caps,
- GrPixelConfigIsClamped dstIsClamped) const {
+ const GrCaps& caps) const {
return sk_sp<const GrXferProcessor>(new DisableColorXP);
}
diff --git a/src/gpu/effects/GrDisableColorXP.h b/src/gpu/effects/GrDisableColorXP.h
index 0c4f5cf2bb..d15f9525c8 100644
--- a/src/gpu/effects/GrDisableColorXP.h
+++ b/src/gpu/effects/GrDisableColorXP.h
@@ -30,8 +30,7 @@ private:
AnalysisProperties analysisProperties(const GrProcessorAnalysisColor&,
const GrProcessorAnalysisCoverage&,
- const GrCaps&,
- GrPixelConfigIsClamped) const override {
+ const GrCaps&) const override {
return AnalysisProperties::kCompatibleWithAlphaAsCoverage |
AnalysisProperties::kIgnoresInputColor;
}
@@ -39,8 +38,7 @@ private:
sk_sp<const GrXferProcessor> makeXferProcessor(const GrProcessorAnalysisColor&,
GrProcessorAnalysisCoverage,
bool hasMixedSamples,
- const GrCaps&,
- GrPixelConfigIsClamped) const override;
+ const GrCaps&) const override;
GR_DECLARE_XP_FACTORY_TEST
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
index ca082603de..89f61ecd1f 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
@@ -759,7 +759,7 @@ const GrXPFactory* GrPorterDuffXPFactory::Get(SkBlendMode blendMode) {
sk_sp<const GrXferProcessor> GrPorterDuffXPFactory::makeXferProcessor(
const GrProcessorAnalysisColor& color, GrProcessorAnalysisCoverage coverage,
- bool hasMixedSamples, const GrCaps& caps, GrPixelConfigIsClamped dstIsClamped) const {
+ bool hasMixedSamples, const GrCaps& caps) const {
BlendFormula blendFormula;
bool isLCD = coverage == GrProcessorAnalysisCoverage::kLCD;
if (isLCD) {
@@ -778,10 +778,8 @@ sk_sp<const GrXferProcessor> GrPorterDuffXPFactory::makeXferProcessor(
hasMixedSamples, fBlendMode);
}
- bool needsClamp = SkBlendMode::kPlus == fBlendMode;
if ((blendFormula.hasSecondaryOutput() && !caps.shaderCaps()->dualSourceBlendingSupport()) ||
- (isLCD && (SkBlendMode::kSrcOver != fBlendMode /*|| !color.isOpaque()*/)) ||
- (needsClamp && (GrPixelConfigIsClamped::kNo == dstIsClamped))) {
+ (isLCD && (SkBlendMode::kSrcOver != fBlendMode /*|| !color.isOpaque()*/))) {
return sk_sp<const GrXferProcessor>(new ShaderPDXferProcessor(hasMixedSamples, fBlendMode,
coverage));
}
@@ -790,7 +788,7 @@ sk_sp<const GrXferProcessor> GrPorterDuffXPFactory::makeXferProcessor(
static inline GrXPFactory::AnalysisProperties analysis_properties(
const GrProcessorAnalysisColor& color, const GrProcessorAnalysisCoverage& coverage,
- const GrCaps& caps, GrPixelConfigIsClamped dstIsClamped, SkBlendMode mode) {
+ const GrCaps& caps, SkBlendMode mode) {
using AnalysisProperties = GrXPFactory::AnalysisProperties;
AnalysisProperties props = AnalysisProperties::kNone;
bool hasCoverage = GrProcessorAnalysisCoverage::kNone != coverage;
@@ -837,11 +835,6 @@ static inline GrXPFactory::AnalysisProperties analysis_properties(
}
}
- bool needsClamp = SkBlendMode::kPlus == mode;
- if (needsClamp && (GrPixelConfigIsClamped::kNo == dstIsClamped)) {
- props |= AnalysisProperties::kReadsDstInShader;
- }
-
if (!formula.modifiesDst() || !formula.usesInputColor()) {
props |= AnalysisProperties::kIgnoresInputColor;
}
@@ -857,9 +850,8 @@ static inline GrXPFactory::AnalysisProperties analysis_properties(
GrXPFactory::AnalysisProperties GrPorterDuffXPFactory::analysisProperties(
const GrProcessorAnalysisColor& color,
const GrProcessorAnalysisCoverage& coverage,
- const GrCaps& caps,
- GrPixelConfigIsClamped dstIsClamped) const {
- return analysis_properties(color, coverage, caps, dstIsClamped, fBlendMode);
+ const GrCaps& caps) const {
+ return analysis_properties(color, coverage, caps, fBlendMode);
}
GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory);
@@ -946,7 +938,6 @@ sk_sp<const GrXferProcessor> GrPorterDuffXPFactory::MakeNoCoverageXP(SkBlendMode
GrXPFactory::AnalysisProperties GrPorterDuffXPFactory::SrcOverAnalysisProperties(
const GrProcessorAnalysisColor& color,
const GrProcessorAnalysisCoverage& coverage,
- const GrCaps& caps,
- GrPixelConfigIsClamped dstIsClamped) {
- return analysis_properties(color, coverage, caps, dstIsClamped, SkBlendMode::kSrcOver);
+ const GrCaps& caps) {
+ return analysis_properties(color, coverage, caps, SkBlendMode::kSrcOver);
}
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.h b/src/gpu/effects/GrPorterDuffXferProcessor.h
index 74ae1533bf..ebe02126d2 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.h
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.h
@@ -41,8 +41,7 @@ public:
static AnalysisProperties SrcOverAnalysisProperties(const GrProcessorAnalysisColor&,
const GrProcessorAnalysisCoverage&,
- const GrCaps&,
- GrPixelConfigIsClamped);
+ const GrCaps&);
private:
constexpr GrPorterDuffXPFactory(SkBlendMode);
@@ -50,13 +49,11 @@ private:
sk_sp<const GrXferProcessor> makeXferProcessor(const GrProcessorAnalysisColor&,
GrProcessorAnalysisCoverage,
bool hasMixedSamples,
- const GrCaps&,
- GrPixelConfigIsClamped) const override;
+ const GrCaps&) const override;
AnalysisProperties analysisProperties(const GrProcessorAnalysisColor&,
const GrProcessorAnalysisCoverage&,
- const GrCaps&,
- GrPixelConfigIsClamped) const override;
+ const GrCaps&) const override;
GR_DECLARE_XP_FACTORY_TEST
static void TestGetXPOutputTypes(const GrXferProcessor*, int* outPrimary, int* outSecondary);