Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Issue 1124373002: Implement Porter Duff XP with a blend table (Closed)

Created:
5 years, 7 months ago by Chris Dalton
Modified:
5 years, 7 months ago
Reviewers:
egdaniel, bsalomon
CC:
reviews_skia.org, Kimmo Kinnunen, vbuzinov, Mark Kilgard
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

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. Separates out the dst read fallback into its own XP. 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: Committed: https://skia.googlesource.com/skia/+/9a70920db22b6309c671f8e5d519bb95570e4414 Committed: https://skia.googlesource.com/skia/+/6fd158ea47472c4d038e48980a95e36623f840c9

Patch Set 1 #

Patch Set 2 : comment #

Total comments: 1

Patch Set 3 : rebase #

Total comments: 1

Patch Set 4 : redo #

Patch Set 5 : var name #

Total comments: 3

Patch Set 6 : GrBlend.h bugs #

Total comments: 25

Patch Set 7 : Add unit test, touchups #

Patch Set 8 : var names #

Total comments: 15

Patch Set 9 : add coverage at runtime #

Total comments: 6

Patch Set 10 : Back to table #

Patch Set 11 : Fix issues with clang and msvc #

Total comments: 2

Patch Set 12 : comment #

Patch Set 13 : bugs #

Patch Set 14 : separate XP for dst read fallback #

Total comments: 11

Patch Set 15 : rebase, feedback #

Patch Set 16 : Finish test for no dual source blending #

Total comments: 3

Patch Set 17 : Use resource provider instead of gpu for tests #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1929 lines, -694 lines) Patch
A gm/aaxfermodes.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +236 lines, -0 lines 0 comments Download
M gyp/gpu.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +0 lines, -1 line 0 comments Download
M include/gpu/GrColor.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +4 lines, -0 lines 0 comments Download
M include/gpu/GrContextOptions.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +4 lines, -2 lines 0 comments Download
M include/gpu/GrXferProcessor.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +0 lines, -8 lines 0 comments Download
M include/gpu/effects/GrPorterDuffXferProcessor.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +5 lines, -4 lines 0 comments Download
M src/gpu/GrBlend.h View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +117 lines, -8 lines 0 comments Download
D src/gpu/GrBlend.cpp View 1 2 3 1 chunk +0 lines, -154 lines 0 comments Download
M src/gpu/GrCaps.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +2 lines, -2 lines 0 comments Download
M src/gpu/effects/GrPorterDuffXferProcessor.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 8 chunks +550 lines, -515 lines 0 comments Download
A tests/GrPorterDuffTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1011 lines, -0 lines 0 comments Download

Messages

Total messages: 50 (7 generated)
Chris Dalton
This lets these modes work without a dst copy on unextended OpenGL, and also makes ...
5 years, 7 months ago (2015-05-07 01:44:02 UTC) #2
Chris Dalton
5 years, 7 months ago (2015-05-07 02:10:30 UTC) #3
bsalomon
Nice optimization! I leave the details to Greg.
5 years, 7 months ago (2015-05-07 14:43:27 UTC) #4
egdaniel
Definitely liking this change. Just the one comment about merging functions. https://codereview.chromium.org/1124373002/diff/40001/src/gpu/effects/GrPorterDuffXferProcessor.cpp File src/gpu/effects/GrPorterDuffXferProcessor.cpp (right): ...
5 years, 7 months ago (2015-05-15 14:58:03 UTC) #5
Chris Dalton
This one merges getInternalOptimizations and calcOutputTypes, and removes kSetCoverageDrawing_OptFlag. It also documents the different blend ...
5 years, 7 months ago (2015-05-18 11:58:09 UTC) #6
bsalomon
Haven't made it through the GrPorterDuffXferProcessor.cpp yet, but noticed one thing in GrBlend.h https://codereview.chromium.org/1124373002/diff/80001/src/gpu/GrBlend.h File ...
5 years, 7 months ago (2015-05-18 17:26:39 UTC) #7
Chris Dalton
https://codereview.chromium.org/1124373002/diff/80001/src/gpu/GrBlend.h File src/gpu/GrBlend.h (right): https://codereview.chromium.org/1124373002/diff/80001/src/gpu/GrBlend.h#newcode73 src/gpu/GrBlend.h:73: struct GrTBlendCoeffRefsBlendColor : SkTBool<kDC_GrBlendCoeff == Coeff || On 2015/05/18 ...
5 years, 7 months ago (2015-05-18 20:58:23 UTC) #8
Chris Dalton
Added a unit test that verifies every xfermode with every color/coverage POI. https://codereview.chromium.org/1124373002/diff/140001/include/gpu/effects/GrPorterDuffXferProcessor.h File include/gpu/effects/GrPorterDuffXferProcessor.h ...
5 years, 7 months ago (2015-05-19 21:47:13 UTC) #9
Chris Dalton
https://codereview.chromium.org/1124373002/diff/140001/tests/GrPorterDuffTest.cpp File tests/GrPorterDuffTest.cpp (right): https://codereview.chromium.org/1124373002/diff/140001/tests/GrPorterDuffTest.cpp#newcode126 tests/GrPorterDuffTest.cpp:126: TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst); This one is confusing. Does "will blend with ...
5 years, 7 months ago (2015-05-19 22:40:34 UTC) #10
Chris Dalton
I just noticed the COVERAGE_* formulas are all compatible with RGB coverage. This means that ...
5 years, 7 months ago (2015-05-20 04:29:55 UTC) #11
Chris Dalton
... And we can also support RGB coverage without dual source blend for dst-atop when ...
5 years, 7 months ago (2015-05-20 04:38:30 UTC) #12
egdaniel
I tried going over the table of blendFormula's and I think they are all correct ...
5 years, 7 months ago (2015-05-20 14:13:55 UTC) #13
egdaniel
Also my latest comments are from the first version of the blend table, haven't looked ...
5 years, 7 months ago (2015-05-20 14:15:11 UTC) #14
Chris Dalton
On 2015/05/20 14:15:11, egdaniel wrote: > what makes it different from all our other xfermode ...
5 years, 7 months ago (2015-05-20 15:07:09 UTC) #15
Chris Dalton
Thanks for the review! Your comments got me thinking and I realized we can exclude ...
5 years, 7 months ago (2015-05-20 16:11:22 UTC) #16
egdaniel
https://codereview.chromium.org/1124373002/diff/100001/src/gpu/effects/GrPorterDuffXferProcessor.cpp File src/gpu/effects/GrPorterDuffXferProcessor.cpp (right): https://codereview.chromium.org/1124373002/diff/100001/src/gpu/effects/GrPorterDuffXferProcessor.cpp#newcode86 src/gpu/effects/GrPorterDuffXferProcessor.cpp:86: OutputType fPrimaryOutputType : 3; On 2015/05/20 16:11:22, Chris Dalton ...
5 years, 7 months ago (2015-05-20 18:59:42 UTC) #17
Chris Dalton
https://codereview.chromium.org/1124373002/diff/140001/src/gpu/effects/GrPorterDuffXferProcessor.cpp File src/gpu/effects/GrPorterDuffXferProcessor.cpp (right): https://codereview.chromium.org/1124373002/diff/140001/src/gpu/effects/GrPorterDuffXferProcessor.cpp#newcode564 src/gpu/effects/GrPorterDuffXferProcessor.cpp:564: , fBlendFormula(get_unoptimized_blend_formula(xfermode)) { On 2015/05/20 18:59:42, egdaniel wrote: > ...
5 years, 7 months ago (2015-05-21 04:00:36 UTC) #18
Chris Dalton
This should address all the comments except the checkerboard in the new gm. I'll address ...
5 years, 7 months ago (2015-05-21 10:00:48 UTC) #19
egdaniel
So part of me kind of liked the version where coverage was in the table ...
5 years, 7 months ago (2015-05-21 18:36:45 UTC) #20
Chris Dalton
On 2015/05/21 18:36:45, egdaniel wrote: > So part of me kind of liked the version ...
5 years, 7 months ago (2015-05-21 19:03:12 UTC) #21
egdaniel
On 2015/05/21 19:03:12, Chris Dalton wrote: > > Yeah I agree with you. I liked ...
5 years, 7 months ago (2015-05-21 19:35:30 UTC) #22
egdaniel
https://codereview.chromium.org/1124373002/diff/160001/src/gpu/GrBlend.h File src/gpu/GrBlend.h (right): https://codereview.chromium.org/1124373002/diff/160001/src/gpu/GrBlend.h#newcode93 src/gpu/GrBlend.h:93: General cleanup thought...do we need both the inline functions ...
5 years, 7 months ago (2015-05-21 19:35:39 UTC) #23
Chris Dalton
https://codereview.chromium.org/1124373002/diff/140001/gm/aaxfermodes.cpp File gm/aaxfermodes.cpp (right): https://codereview.chromium.org/1124373002/diff/140001/gm/aaxfermodes.cpp#newcode122 gm/aaxfermodes.cpp:122: SkPackARGB32(0xff, 0xc0, 0xc0, 0xc0), On 2015/05/20 18:59:42, egdaniel wrote: ...
5 years, 7 months ago (2015-05-21 23:14:49 UTC) #24
egdaniel
LGTM. Just need Brian's as well.
5 years, 7 months ago (2015-05-22 13:37:13 UTC) #25
bsalomon
lgtm, really like this patch.
5 years, 7 months ago (2015-05-22 14:46:46 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1124373002/180001
5 years, 7 months ago (2015-05-22 15:10:04 UTC) #28
commit-bot: I haz the power
Try jobs failed on following builders: Build-Ubuntu-Clang-x86_64-Debug-Trybot on client.skia.compile (JOB_FAILED, http://build.chromium.org/p/client.skia.compile/builders/Build-Ubuntu-Clang-x86_64-Debug-Trybot/builds/1215)
5 years, 7 months ago (2015-05-22 15:12:40 UTC) #30
Chris Dalton
clang just had a trivial warning, but msvc had a pretty serious semantic issue... https://codereview.chromium.org/1124373002/diff/200001/src/gpu/effects/GrPorterDuffXferProcessor.cpp ...
5 years, 7 months ago (2015-05-22 17:35:02 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1124373002/220001
5 years, 7 months ago (2015-05-22 18:27:32 UTC) #34
commit-bot: I haz the power
Committed patchset #12 (id:220001) as https://skia.googlesource.com/skia/+/9a70920db22b6309c671f8e5d519bb95570e4414
5 years, 7 months ago (2015-05-22 18:37:01 UTC) #35
bungeman-skia
A revert of this CL (patchset #12 id:220001) has been created in https://codereview.chromium.org/1153993002/ by bungeman@google.com. ...
5 years, 7 months ago (2015-05-23 00:43:33 UTC) #36
Chris Dalton
Ugh, that last one had a couple simple bugs. Changes since last time: * Take ...
5 years, 7 months ago (2015-05-25 06:54:29 UTC) #37
Chris Dalton
The patch keeps getting bigger, but I feel like this is a better way of ...
5 years, 7 months ago (2015-05-26 10:10:55 UTC) #38
Chris Dalton
On 2015/05/26 10:10:55, Chris Dalton wrote: > The patch keeps getting bigger, but I feel ...
5 years, 7 months ago (2015-05-26 10:20:36 UTC) #39
bsalomon
https://codereview.chromium.org/1124373002/diff/260001/src/gpu/effects/GrPorterDuffXferProcessor.cpp File src/gpu/effects/GrPorterDuffXferProcessor.cpp (right): https://codereview.chromium.org/1124373002/diff/260001/src/gpu/effects/GrPorterDuffXferProcessor.cpp#newcode455 src/gpu/effects/GrPorterDuffXferProcessor.cpp:455: class PDFallbackXferProcessor : public GrXferProcessor { Can we use ...
5 years, 7 months ago (2015-05-26 13:19:51 UTC) #40
egdaniel
https://codereview.chromium.org/1124373002/diff/260001/gm/aaxfermodes.cpp File gm/aaxfermodes.cpp (right): https://codereview.chromium.org/1124373002/diff/260001/gm/aaxfermodes.cpp#newcode46 gm/aaxfermodes.cpp:46: class AAXfermodesGM : public GM { So for this ...
5 years, 7 months ago (2015-05-26 14:15:22 UTC) #41
Chris Dalton
https://codereview.chromium.org/1124373002/diff/260001/gm/aaxfermodes.cpp File gm/aaxfermodes.cpp (right): https://codereview.chromium.org/1124373002/diff/260001/gm/aaxfermodes.cpp#newcode46 gm/aaxfermodes.cpp:46: class AAXfermodesGM : public GM { On 2015/05/26 14:15:22, ...
5 years, 7 months ago (2015-05-26 22:10:28 UTC) #42
Chris Dalton
This is ready for final review https://codereview.chromium.org/1124373002/diff/260001/tests/GrPorterDuffTest.cpp File tests/GrPorterDuffTest.cpp (right): https://codereview.chromium.org/1124373002/diff/260001/tests/GrPorterDuffTest.cpp#newcode1294 tests/GrPorterDuffTest.cpp:1294: const GrCaps& nilCaps ...
5 years, 7 months ago (2015-05-27 20:42:05 UTC) #43
bsalomon
lgtm https://codereview.chromium.org/1124373002/diff/300001/tests/GrPorterDuffTest.cpp File tests/GrPorterDuffTest.cpp (right): https://codereview.chromium.org/1124373002/diff/300001/tests/GrPorterDuffTest.cpp#newcode951 tests/GrPorterDuffTest.cpp:951: GrGpu* gpu = ctx->getGpu(); I'm trying to remove ...
5 years, 7 months ago (2015-05-27 20:46:21 UTC) #44
Chris Dalton
https://codereview.chromium.org/1124373002/diff/300001/tests/GrPorterDuffTest.cpp File tests/GrPorterDuffTest.cpp (right): https://codereview.chromium.org/1124373002/diff/300001/tests/GrPorterDuffTest.cpp#newcode951 tests/GrPorterDuffTest.cpp:951: GrGpu* gpu = ctx->getGpu(); On 2015/05/27 20:46:20, bsalomon wrote: ...
5 years, 7 months ago (2015-05-27 21:09:41 UTC) #45
bsalomon
https://codereview.chromium.org/1124373002/diff/300001/tests/GrPorterDuffTest.cpp File tests/GrPorterDuffTest.cpp (right): https://codereview.chromium.org/1124373002/diff/300001/tests/GrPorterDuffTest.cpp#newcode951 tests/GrPorterDuffTest.cpp:951: GrGpu* gpu = ctx->getGpu(); On 2015/05/27 21:09:41, Chris Dalton ...
5 years, 7 months ago (2015-05-27 21:16:01 UTC) #46
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1124373002/320001
5 years, 7 months ago (2015-05-27 22:03:01 UTC) #49
commit-bot: I haz the power
5 years, 7 months ago (2015-05-27 22:08:39 UTC) #50
Message was sent while issue was closed.
Committed patchset #17 (id:320001) as
https://skia.googlesource.com/skia/+/6fd158ea47472c4d038e48980a95e36623f840c9

Powered by Google App Engine
This is Rietveld 408576698