aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/GrColor.h
diff options
context:
space:
mode:
authorGravatar cdalton <cdalton@nvidia.com>2015-05-22 11:36:57 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-22 11:36:57 -0700
commit9a70920db22b6309c671f8e5d519bb95570e4414 (patch)
tree7c0d6884d581bd2860c2f4af5627de8dce3159d3 /include/gpu/GrColor.h
parent2a97c55ae3b2b62fef2045e839600dc13b481c4c (diff)
Implement Porter Duff XP with a blend table
Removes the runtime logic used by PorterDuffXferProcessor to decide blend coeffs and shader outputs, and instead uses a compile-time constant table of pre-selected blend formulas. Introduces a new blend strategy for srcCoeff=0 that can apply coverage with a reverse subtract blend equation instead of dual source blending. Adds new macros in GrBlend.h to analyze blend formulas both runtime. Removes kSetCoverageDrawing_OptFlag and GrSimplifyBlend as they are no longer used. Adds a GM that verifies all xfermodes, including arithmetic, with the color/coverage invariants used by Porter Duff. Adds a unit test that verifies each Porter Duff formula with every color/coverage invariant. Major changes: * Uses a reverse subtract blend equation for coverage when srcCoeff=0 (clear, dst-out [Sa=1], dst-in, modulate). Platforms that don't support dual source blending no longer require a dst copy for dst-in and modulate. * Sets BlendInfo::fWriteColor to false when the blend does not modify the dst. GrGLGpu will now use glColorMask instead of blending for these modes (dst, dst-in [Sa=1], modulate ignored for [Sc=1]). * Converts all SA blend coeffs to One for opaque inputs, and ISA to Zero if there is also no coverage. (We keep ISA around when there is coverage because we use it to tweak alpha for coverage.) * Abandons solid white optimizations for the sake of simplicity (screen was the only mode that previous had solid white opts). Minor differences: * Inconsequential differences in opt flags (e.g. we now return kCanTweakAlphaForCoverage_OptFlag even when there is no coverage). * Src coeffs when the shader outputs 0. * IS2C vs IS2A when the secondary output is scalar. BUG=skia: Review URL: https://codereview.chromium.org/1124373002
Diffstat (limited to 'include/gpu/GrColor.h')
-rw-r--r--include/gpu/GrColor.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/gpu/GrColor.h b/include/gpu/GrColor.h
index f5757b93f5..9ccc638fc9 100644
--- a/include/gpu/GrColor.h
+++ b/include/gpu/GrColor.h
@@ -142,6 +142,8 @@ enum GrColorComponentFlags {
kB_GrColorComponentFlag = 1 << (GrColor_SHIFT_B / 8),
kA_GrColorComponentFlag = 1 << (GrColor_SHIFT_A / 8),
+ kNone_GrColorComponentFlags = 0,
+
kRGB_GrColorComponentFlags = (kR_GrColorComponentFlag | kG_GrColorComponentFlag |
kB_GrColorComponentFlag),
@@ -149,6 +151,8 @@ enum GrColorComponentFlags {
kB_GrColorComponentFlag | kA_GrColorComponentFlag)
};
+GR_MAKE_BITFIELD_OPS(GrColorComponentFlags)
+
static inline char GrColorComponentFlagToChar(GrColorComponentFlags component) {
SkASSERT(SkIsPow2(component));
switch (component) {