aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-02-15 10:22:23 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-15 17:27:10 +0000
commitf3b995b628ef76bff28b9721dd1e182336156086 (patch)
treea0a0dcb7d12934495c445a73fe18bae9fda42bb7 /include/gpu
parent2b512d00ef8d6a8eb200396ab0a64294e84c4fa4 (diff)
Clarify when tweak alpha for coverage optimizaton can occur.
Also refer to it directly rather than using the term "modulate" Change-Id: Ifa44a4d46e1be11b567943f58ead24e38f10d03b Reviewed-on: https://skia-review.googlesource.com/8488 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include/gpu')
-rw-r--r--include/gpu/GrFragmentProcessor.h21
-rw-r--r--include/gpu/effects/GrConstColorProcessor.h2
2 files changed, 16 insertions, 7 deletions
diff --git a/include/gpu/GrFragmentProcessor.h b/include/gpu/GrFragmentProcessor.h
index 96ca1c830d..55dc08f7a0 100644
--- a/include/gpu/GrFragmentProcessor.h
+++ b/include/gpu/GrFragmentProcessor.h
@@ -99,11 +99,20 @@ public:
}
/**
- * True if the processor's output is a modulation of its input color or alpha with a computed
- * premultiplied color or alpha in the 0..1 range. If true and the blend mode allows it we may
- * fold coverage into the first color fragment processor's input.
+ * A GrDrawOp may premultiply its antialiasing coverage into its GrGeometryProcessor's color
+ * output under the following scenario:
+ * * all the color fragment processors report true to this query,
+ * * all the coverage fragment processors report true to this query,
+ * * the blend mode arithmetic allows for it it.
+ * To be compatible a fragment processor's output must be a modulation of its input color or
+ * alpha with a computed premultiplied color or alpha that is in 0..1 range. The computed color
+ * or alpha that is modulated against the input cannot depend on the input's alpha. The computed
+ * value cannot depend on the input's color channels unless it unpremultiplies the input color
+ * channels by the input alpha.
*/
- bool modulatesInput() const { return SkToBool(fFlags & kModulatesInput_OptimizationFlag); }
+ bool compatibleWithCoverageAsAlpha() const {
+ return SkToBool(fFlags & kCompatibleWithCoverageAsAlpha_OptimizationFlag);
+ }
/**
* If this is true then all opaque input colors to the processor produce opaque output colors.
@@ -207,10 +216,10 @@ public:
protected:
enum OptimizationFlags : uint32_t {
kNone_OptimizationFlags,
- kModulatesInput_OptimizationFlag = 0x1,
+ kCompatibleWithCoverageAsAlpha_OptimizationFlag = 0x1,
kPreservesOpaqueInput_OptimizationFlag = 0x2,
kConstantOutputForConstantInput_OptimizationFlag = 0x4,
- kAll_OptimizationFlags = kModulatesInput_OptimizationFlag |
+ kAll_OptimizationFlags = kCompatibleWithCoverageAsAlpha_OptimizationFlag |
kPreservesOpaqueInput_OptimizationFlag |
kConstantOutputForConstantInput_OptimizationFlag
};
diff --git a/include/gpu/effects/GrConstColorProcessor.h b/include/gpu/effects/GrConstColorProcessor.h
index 44e8cb17fc..b543aa5069 100644
--- a/include/gpu/effects/GrConstColorProcessor.h
+++ b/include/gpu/effects/GrConstColorProcessor.h
@@ -46,7 +46,7 @@ private:
static OptimizationFlags OptFlags(GrColor4f color, InputMode mode) {
OptimizationFlags flags = kConstantOutputForConstantInput_OptimizationFlag;
if (mode != kIgnore_InputMode) {
- flags |= kModulatesInput_OptimizationFlag;
+ flags |= kCompatibleWithCoverageAsAlpha_OptimizationFlag;
}
if (color.isOpaque()) {
flags |= kPreservesOpaqueInput_OptimizationFlag;