cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 8 | #include "Test.h" |
| 9 | |
| 10 | #if SK_SUPPORT_GPU |
| 11 | |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 12 | #include "GrAppliedClip.h" |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 13 | #include "GrContextFactory.h" |
| 14 | #include "GrContextOptions.h" |
| 15 | #include "GrGpu.h" |
| 16 | #include "GrResourceProvider.h" |
| 17 | #include "GrXferProcessor.h" |
| 18 | #include "effects/GrPorterDuffXferProcessor.h" |
| 19 | #include "gl/GrGLCaps.h" |
Brian Salomon | 8952743 | 2016-12-16 09:52:16 -0500 | [diff] [blame] | 20 | #include "ops/GrMeshDrawOp.h" |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 21 | |
| 22 | //////////////////////////////////////////////////////////////////////////////// |
| 23 | |
| 24 | static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps); |
| 25 | static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps); |
| 26 | static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps); |
| 27 | static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps); |
| 28 | static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 29 | static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const GrCaps& caps); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 30 | |
bsalomon | 758586c | 2016-04-06 14:02:39 -0700 | [diff] [blame] | 31 | DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrPorterDuff, reporter, ctxInfo) { |
bsalomon | 8b7451a | 2016-05-11 06:33:06 -0700 | [diff] [blame] | 32 | const GrCaps& caps = *ctxInfo.grContext()->getGpu()->caps(); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 33 | if (!caps.shaderCaps()->dualSourceBlendingSupport()) { |
| 34 | SkFAIL("Null context does not support dual source blending."); |
| 35 | return; |
| 36 | } |
| 37 | |
| 38 | test_color_unknown_with_coverage(reporter, caps); |
| 39 | test_color_unknown_no_coverage(reporter, caps); |
| 40 | test_color_opaque_with_coverage(reporter, caps); |
| 41 | test_color_opaque_no_coverage(reporter, caps); |
| 42 | test_lcd_coverage(reporter, caps); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 43 | test_lcd_coverage_fallback_case(reporter, caps); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | //////////////////////////////////////////////////////////////////////////////// |
| 47 | |
| 48 | #define TEST_ASSERT(...) REPORTER_ASSERT(reporter, __VA_ARGS__) |
| 49 | |
| 50 | enum { |
| 51 | kNone_OutputType, |
| 52 | kCoverage_OutputType, |
| 53 | kModulate_OutputType, |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 54 | kSAModulate_OutputType, |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 55 | kISAModulate_OutputType, |
| 56 | kISCModulate_OutputType |
| 57 | }; |
| 58 | |
| 59 | enum { |
bsalomon | 7765a47 | 2015-07-08 11:26:37 -0700 | [diff] [blame] | 60 | kNone_OptFlags = GrXferProcessor::kNone_OptFlags, |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 61 | kIgnoreColor_OptFlag = GrXferProcessor::kIgnoreColor_OptFlag, |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 62 | kCanTweakAlphaForCoverage_OptFlag = GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag |
| 63 | }; |
| 64 | |
| 65 | class GrPorterDuffTest { |
| 66 | public: |
| 67 | struct XPInfo { |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 68 | XPInfo(skiatest::Reporter* reporter, SkBlendMode xfermode, const GrCaps& caps, |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 69 | const GrProcessorSet::FragmentProcessorAnalysis& analysis) { |
Brian Salomon | a163392 | 2017-01-09 11:46:10 -0500 | [diff] [blame] | 70 | const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(xfermode); |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 71 | fReadsDst = GrXPFactory::WillReadDst(xpf, analysis); |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 72 | sk_sp<GrXferProcessor> xp(xpf->createXferProcessor(analysis, false, nullptr, caps)); |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 73 | TEST_ASSERT(!GrXPFactory::WillNeedDstTexture(xpf, caps, analysis)); |
Brian Salomon | bfd5183 | 2017-01-04 13:22:08 -0500 | [diff] [blame] | 74 | GrColor ignoredOverrideColor; |
| 75 | fOptFlags = xp->getOptimizations(analysis, false, &ignoredOverrideColor, caps); |
Hal Canary | 342b7ac | 2016-11-04 11:49:42 -0400 | [diff] [blame] | 76 | GetXPOutputTypes(xp.get(), &fPrimaryOutputType, &fSecondaryOutputType); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 77 | xp->getBlendInfo(&fBlendInfo); |
| 78 | TEST_ASSERT(!xp->willReadDstColor()); |
| 79 | TEST_ASSERT(xp->hasSecondaryOutput() == GrBlendCoeffRefsSrc2(fBlendInfo.fDstBlend)); |
| 80 | } |
| 81 | |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 82 | bool fReadsDst; |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 83 | int fOptFlags; |
| 84 | int fPrimaryOutputType; |
| 85 | int fSecondaryOutputType; |
| 86 | GrXferProcessor::BlendInfo fBlendInfo; |
| 87 | }; |
| 88 | |
| 89 | static void GetXPOutputTypes(const GrXferProcessor* xp, int* outPrimary, int* outSecondary) { |
egdaniel | f234272 | 2015-11-20 15:12:59 -0800 | [diff] [blame] | 90 | GrPorterDuffXPFactory::TestGetXPOutputTypes(xp, outPrimary, outSecondary); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 91 | } |
| 92 | }; |
| 93 | |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 94 | static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 95 | GrPipelineInput lcdInput; |
| 96 | lcdInput.setToLCDCoverage(); |
| 97 | GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineInput(), lcdInput, caps); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 98 | |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 99 | SkASSERT(!analysis.isOutputColorOpaque()); |
| 100 | SkASSERT(!analysis.hasKnownOutputColor()); |
| 101 | SkASSERT(analysis.hasLCDCoverage()); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 102 | |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 103 | for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) { |
| 104 | SkBlendMode xfermode = static_cast<SkBlendMode>(m); |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 105 | const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, analysis); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 106 | switch (xfermode) { |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 107 | case SkBlendMode::kClear: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 108 | TEST_ASSERT(xpi.fReadsDst); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 109 | TEST_ASSERT((kIgnoreColor_OptFlag) == xpi.fOptFlags); |
| 110 | TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType); |
| 111 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 112 | TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 113 | TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 114 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 115 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 116 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 117 | case SkBlendMode::kSrc: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 118 | TEST_ASSERT(xpi.fReadsDst); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 119 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
| 120 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 121 | TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); |
| 122 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 123 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 124 | TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 125 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 126 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 127 | case SkBlendMode::kDst: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 128 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 02baee9 | 2017-02-24 10:37:15 -0500 | [diff] [blame] | 129 | TEST_ASSERT((kIgnoreColor_OptFlag | |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 130 | kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 131 | TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); |
| 132 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 133 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 134 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 135 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 136 | TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); |
| 137 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 138 | case SkBlendMode::kSrcOver: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 139 | TEST_ASSERT(xpi.fReadsDst); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 140 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
| 141 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 142 | TEST_ASSERT(kSAModulate_OutputType == xpi.fSecondaryOutputType); |
| 143 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 144 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 145 | TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 146 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 147 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 148 | case SkBlendMode::kDstOver: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 149 | TEST_ASSERT(xpi.fReadsDst); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 150 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
| 151 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 152 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 153 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 154 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 155 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 156 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 157 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 158 | case SkBlendMode::kSrcIn: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 159 | TEST_ASSERT(xpi.fReadsDst); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 160 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
| 161 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 162 | TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); |
| 163 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 164 | TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 165 | TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 166 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 167 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 168 | case SkBlendMode::kDstIn: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 169 | TEST_ASSERT(xpi.fReadsDst); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 170 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
| 171 | TEST_ASSERT(kISAModulate_OutputType == xpi.fPrimaryOutputType); |
| 172 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 173 | TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 174 | TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 175 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 176 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 177 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 178 | case SkBlendMode::kSrcOut: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 179 | TEST_ASSERT(xpi.fReadsDst); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 180 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
| 181 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 182 | TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); |
| 183 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 184 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 185 | TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 186 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 187 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 188 | case SkBlendMode::kDstOut: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 189 | TEST_ASSERT(xpi.fReadsDst); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 190 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
| 191 | TEST_ASSERT(kSAModulate_OutputType == xpi.fPrimaryOutputType); |
| 192 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 193 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 194 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 195 | TEST_ASSERT(kISC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 196 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 197 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 198 | case SkBlendMode::kSrcATop: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 199 | TEST_ASSERT(xpi.fReadsDst); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 200 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
| 201 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 202 | TEST_ASSERT(kSAModulate_OutputType == xpi.fSecondaryOutputType); |
| 203 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 204 | TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 205 | TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 206 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 207 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 208 | case SkBlendMode::kDstATop: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 209 | TEST_ASSERT(xpi.fReadsDst); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 210 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
| 211 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 212 | TEST_ASSERT(kISAModulate_OutputType == xpi.fSecondaryOutputType); |
| 213 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 214 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 215 | TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 216 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 217 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 218 | case SkBlendMode::kXor: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 219 | TEST_ASSERT(xpi.fReadsDst); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 220 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
| 221 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 222 | TEST_ASSERT(kSAModulate_OutputType == xpi.fSecondaryOutputType); |
| 223 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 224 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 225 | TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 226 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 227 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 228 | case SkBlendMode::kPlus: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 229 | TEST_ASSERT(xpi.fReadsDst); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 230 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
| 231 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 232 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 233 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 234 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 235 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 236 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 237 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 238 | case SkBlendMode::kModulate: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 239 | TEST_ASSERT(xpi.fReadsDst); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 240 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
| 241 | TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType); |
| 242 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 243 | TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 244 | TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 245 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 246 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 247 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 248 | case SkBlendMode::kScreen: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 249 | TEST_ASSERT(xpi.fReadsDst); |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 250 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
| 251 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 252 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 253 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 254 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 255 | TEST_ASSERT(kISC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 256 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 257 | break; |
| 258 | default: |
| 259 | ERRORF(reporter, "Invalid xfermode."); |
| 260 | break; |
| 261 | } |
| 262 | } |
| 263 | } |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 264 | static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 265 | GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineInput(), GrPipelineInput(), caps); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 266 | |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 267 | SkASSERT(!analysis.isOutputColorOpaque()); |
| 268 | SkASSERT(!analysis.hasKnownOutputColor()); |
| 269 | SkASSERT(!analysis.hasLCDCoverage()); |
| 270 | SkASSERT(analysis.hasCoverage()); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 271 | |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 272 | for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) { |
| 273 | SkBlendMode xfermode = static_cast<SkBlendMode>(m); |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 274 | const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, analysis); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 275 | switch (xfermode) { |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 276 | case SkBlendMode::kClear: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 277 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 278 | TEST_ASSERT((kIgnoreColor_OptFlag) == xpi.fOptFlags); |
| 279 | TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType); |
| 280 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 281 | TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 282 | TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 283 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 284 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 285 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 286 | case SkBlendMode::kSrc: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 287 | TEST_ASSERT(xpi.fReadsDst); |
bsalomon | 7765a47 | 2015-07-08 11:26:37 -0700 | [diff] [blame] | 288 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 289 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 290 | TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); |
| 291 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 292 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 293 | TEST_ASSERT(kIS2A_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 294 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 295 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 296 | case SkBlendMode::kDst: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 297 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 02baee9 | 2017-02-24 10:37:15 -0500 | [diff] [blame] | 298 | TEST_ASSERT((kIgnoreColor_OptFlag | |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 299 | kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 300 | TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); |
| 301 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 302 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 303 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 304 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 305 | TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); |
| 306 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 307 | case SkBlendMode::kSrcOver: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 308 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 309 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 310 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 311 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 312 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 313 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 314 | TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 315 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 316 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 317 | case SkBlendMode::kDstOver: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 318 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 319 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 320 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 321 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 322 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 323 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 324 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 325 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 326 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 327 | case SkBlendMode::kSrcIn: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 328 | TEST_ASSERT(xpi.fReadsDst); |
bsalomon | 7765a47 | 2015-07-08 11:26:37 -0700 | [diff] [blame] | 329 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 330 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 331 | TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); |
| 332 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 333 | TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 334 | TEST_ASSERT(kIS2A_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 335 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 336 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 337 | case SkBlendMode::kDstIn: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 338 | TEST_ASSERT(xpi.fReadsDst); |
bsalomon | 7765a47 | 2015-07-08 11:26:37 -0700 | [diff] [blame] | 339 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 340 | TEST_ASSERT(kISAModulate_OutputType == xpi.fPrimaryOutputType); |
| 341 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 342 | TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 343 | TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 344 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 345 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 346 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 347 | case SkBlendMode::kSrcOut: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 348 | TEST_ASSERT(xpi.fReadsDst); |
bsalomon | 7765a47 | 2015-07-08 11:26:37 -0700 | [diff] [blame] | 349 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 350 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 351 | TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); |
| 352 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 353 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 354 | TEST_ASSERT(kIS2A_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 355 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 356 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 357 | case SkBlendMode::kDstOut: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 358 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 359 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 360 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 361 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 362 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 363 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 364 | TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 365 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 366 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 367 | case SkBlendMode::kSrcATop: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 368 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 369 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 370 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 371 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 372 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 373 | TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 374 | TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 375 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 376 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 377 | case SkBlendMode::kDstATop: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 378 | TEST_ASSERT(xpi.fReadsDst); |
bsalomon | 7765a47 | 2015-07-08 11:26:37 -0700 | [diff] [blame] | 379 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 380 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 381 | TEST_ASSERT(kISAModulate_OutputType == xpi.fSecondaryOutputType); |
| 382 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 383 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 384 | TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 385 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 386 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 387 | case SkBlendMode::kXor: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 388 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 389 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 390 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 391 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 392 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 393 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 394 | TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 395 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 396 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 397 | case SkBlendMode::kPlus: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 398 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 399 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 400 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 401 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 402 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 403 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 404 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 405 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 406 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 407 | case SkBlendMode::kModulate: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 408 | TEST_ASSERT(xpi.fReadsDst); |
bsalomon | 7765a47 | 2015-07-08 11:26:37 -0700 | [diff] [blame] | 409 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 410 | TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType); |
| 411 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 412 | TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 413 | TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 414 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 415 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 416 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 417 | case SkBlendMode::kScreen: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 418 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 419 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 420 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 421 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 422 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 423 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 424 | TEST_ASSERT(kISC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 425 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 426 | break; |
| 427 | default: |
| 428 | ERRORF(reporter, "Invalid xfermode."); |
| 429 | break; |
| 430 | } |
| 431 | } |
| 432 | } |
| 433 | |
| 434 | static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 435 | GrProcessorSet::FragmentProcessorAnalysis analysis(GrColorPackRGBA(229, 0, 154, 240), |
| 436 | GrColorPackA4(255), caps); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 437 | |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 438 | SkASSERT(!analysis.isOutputColorOpaque()); |
| 439 | SkASSERT(analysis.hasKnownOutputColor()); |
| 440 | SkASSERT(!analysis.hasCoverage()); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 441 | |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 442 | for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) { |
| 443 | SkBlendMode xfermode = static_cast<SkBlendMode>(m); |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 444 | const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, analysis); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 445 | switch (xfermode) { |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 446 | case SkBlendMode::kClear: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 447 | TEST_ASSERT(!xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 448 | TEST_ASSERT(kIgnoreColor_OptFlag == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 449 | TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); |
| 450 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 451 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 452 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 453 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 454 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 455 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 456 | case SkBlendMode::kSrc: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 457 | TEST_ASSERT(!xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 458 | TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 459 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 460 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 461 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 462 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 463 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 464 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 465 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 466 | case SkBlendMode::kDst: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 467 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 02baee9 | 2017-02-24 10:37:15 -0500 | [diff] [blame] | 468 | TEST_ASSERT((kIgnoreColor_OptFlag | |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 469 | kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 470 | TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); |
| 471 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 472 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 473 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 474 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 475 | TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); |
| 476 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 477 | case SkBlendMode::kSrcOver: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 478 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 479 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 480 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 481 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 482 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 483 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 484 | TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 485 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 486 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 487 | case SkBlendMode::kDstOver: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 488 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 489 | TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 490 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 491 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 492 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 493 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 494 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 495 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 496 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 497 | case SkBlendMode::kSrcIn: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 498 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 499 | TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 500 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 501 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 502 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 503 | TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 504 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 505 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 506 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 507 | case SkBlendMode::kDstIn: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 508 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 509 | TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 510 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 511 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 512 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 513 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 514 | TEST_ASSERT(kSA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 515 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 516 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 517 | case SkBlendMode::kSrcOut: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 518 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 519 | TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 520 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 521 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 522 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 523 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 524 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 525 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 526 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 527 | case SkBlendMode::kDstOut: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 528 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 529 | TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 530 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 531 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 532 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 533 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 534 | TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 535 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 536 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 537 | case SkBlendMode::kSrcATop: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 538 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 539 | TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 540 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 541 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 542 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 543 | TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 544 | TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 545 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 546 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 547 | case SkBlendMode::kDstATop: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 548 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 549 | TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 550 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 551 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 552 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 553 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 554 | TEST_ASSERT(kSA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 555 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 556 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 557 | case SkBlendMode::kXor: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 558 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 559 | TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 560 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 561 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 562 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 563 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 564 | TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 565 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 566 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 567 | case SkBlendMode::kPlus: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 568 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 569 | TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 570 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 571 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 572 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 573 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 574 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 575 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 576 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 577 | case SkBlendMode::kModulate: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 578 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 579 | TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 580 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 581 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 582 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 583 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 584 | TEST_ASSERT(kSC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 585 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 586 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 587 | case SkBlendMode::kScreen: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 588 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 589 | TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 590 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 591 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 592 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 593 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 594 | TEST_ASSERT(kISC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 595 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 596 | break; |
| 597 | default: |
| 598 | ERRORF(reporter, "Invalid xfermode."); |
| 599 | break; |
| 600 | } |
| 601 | } |
| 602 | } |
| 603 | |
| 604 | static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 605 | GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineInput::Opaque::kYes, |
| 606 | GrPipelineInput(), caps); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 607 | |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 608 | SkASSERT(analysis.isOutputColorOpaque()); |
| 609 | SkASSERT(!analysis.hasKnownOutputColor()); |
| 610 | SkASSERT(analysis.hasCoverage()); |
| 611 | SkASSERT(!analysis.hasLCDCoverage()); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 612 | |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 613 | for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) { |
| 614 | SkBlendMode xfermode = static_cast<SkBlendMode>(m); |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 615 | const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, analysis); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 616 | switch (xfermode) { |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 617 | case SkBlendMode::kClear: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 618 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 619 | TEST_ASSERT((kIgnoreColor_OptFlag) == xpi.fOptFlags); |
| 620 | TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType); |
| 621 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 622 | TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 623 | TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 624 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 625 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 626 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 627 | case SkBlendMode::kSrc: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 628 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 629 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 630 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 631 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 632 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 633 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 634 | TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 635 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 636 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 637 | case SkBlendMode::kDst: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 638 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 02baee9 | 2017-02-24 10:37:15 -0500 | [diff] [blame] | 639 | TEST_ASSERT((kIgnoreColor_OptFlag | |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 640 | kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 641 | TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); |
| 642 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 643 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 644 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 645 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 646 | TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); |
| 647 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 648 | case SkBlendMode::kSrcOver: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 649 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 650 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 651 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 652 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 653 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 654 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 655 | TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 656 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 657 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 658 | case SkBlendMode::kDstOver: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 659 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 660 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 661 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 662 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 663 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 664 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 665 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 666 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 667 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 668 | case SkBlendMode::kSrcIn: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 669 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 670 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 671 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 672 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 673 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 674 | TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 675 | TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 676 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 677 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 678 | case SkBlendMode::kDstIn: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 679 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 02baee9 | 2017-02-24 10:37:15 -0500 | [diff] [blame] | 680 | TEST_ASSERT((kIgnoreColor_OptFlag | |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 681 | kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 682 | TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); |
| 683 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 684 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 685 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 686 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 687 | TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); |
| 688 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 689 | case SkBlendMode::kSrcOut: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 690 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 691 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 692 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 693 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 694 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 695 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 696 | TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 697 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 698 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 699 | case SkBlendMode::kDstOut: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 700 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 701 | TEST_ASSERT((kIgnoreColor_OptFlag) == xpi.fOptFlags); |
| 702 | TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType); |
| 703 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 704 | TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 705 | TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 706 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 707 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 708 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 709 | case SkBlendMode::kSrcATop: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 710 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 711 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 712 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 713 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 714 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 715 | TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 716 | TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 717 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 718 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 719 | case SkBlendMode::kDstATop: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 720 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 721 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 722 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 723 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 724 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 725 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 726 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 727 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 728 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 729 | case SkBlendMode::kXor: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 730 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 731 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 732 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 733 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 734 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 735 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 736 | TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 737 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 738 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 739 | case SkBlendMode::kPlus: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 740 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 741 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 742 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 743 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 744 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 745 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 746 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 747 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 748 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 749 | case SkBlendMode::kModulate: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 750 | TEST_ASSERT(xpi.fReadsDst); |
bsalomon | 7765a47 | 2015-07-08 11:26:37 -0700 | [diff] [blame] | 751 | TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 752 | TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType); |
| 753 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 754 | TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 755 | TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 756 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 757 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 758 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 759 | case SkBlendMode::kScreen: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 760 | TEST_ASSERT(xpi.fReadsDst); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 761 | TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 762 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 763 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 764 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 765 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 766 | TEST_ASSERT(kISC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 767 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 768 | break; |
| 769 | default: |
| 770 | ERRORF(reporter, "Invalid xfermode."); |
| 771 | break; |
| 772 | } |
| 773 | } |
| 774 | } |
| 775 | |
| 776 | static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 777 | GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineInput::Opaque::kYes, |
| 778 | GrColorPackA4(255), caps); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 779 | |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 780 | SkASSERT(analysis.isOutputColorOpaque()); |
| 781 | SkASSERT(!analysis.hasKnownOutputColor()); |
| 782 | SkASSERT(!analysis.hasCoverage()); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 783 | |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 784 | for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) { |
| 785 | SkBlendMode xfermode = static_cast<SkBlendMode>(m); |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 786 | const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, analysis); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 787 | |
| 788 | switch (xfermode) { |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 789 | case SkBlendMode::kClear: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 790 | TEST_ASSERT(!xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 791 | TEST_ASSERT(kIgnoreColor_OptFlag == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 792 | TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); |
| 793 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 794 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 795 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 796 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 797 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 798 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 799 | case SkBlendMode::kSrc: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 800 | TEST_ASSERT(!xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 801 | TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 802 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 803 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 804 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 805 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 806 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 807 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 808 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 809 | case SkBlendMode::kDst: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 810 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 02baee9 | 2017-02-24 10:37:15 -0500 | [diff] [blame] | 811 | TEST_ASSERT((kIgnoreColor_OptFlag | |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 812 | kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 813 | TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); |
| 814 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 815 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 816 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 817 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 818 | TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); |
| 819 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 820 | case SkBlendMode::kSrcOver: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 821 | TEST_ASSERT(!xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 822 | TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 823 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 824 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 825 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 826 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 827 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 828 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 829 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 830 | case SkBlendMode::kDstOver: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 831 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 832 | TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 833 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 834 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 835 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 836 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 837 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 838 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 839 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 840 | case SkBlendMode::kSrcIn: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 841 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 842 | TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 843 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 844 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 845 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 846 | TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 847 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 848 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 849 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 850 | case SkBlendMode::kDstIn: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 851 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 02baee9 | 2017-02-24 10:37:15 -0500 | [diff] [blame] | 852 | TEST_ASSERT((kIgnoreColor_OptFlag | |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 853 | kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); |
| 854 | TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); |
| 855 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 856 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 857 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 858 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 859 | TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); |
| 860 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 861 | case SkBlendMode::kSrcOut: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 862 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 863 | TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 864 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 865 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 866 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 867 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 868 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 869 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 870 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 871 | case SkBlendMode::kDstOut: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 872 | TEST_ASSERT(!xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 873 | TEST_ASSERT(kIgnoreColor_OptFlag == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 874 | TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); |
| 875 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 876 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 877 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 878 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 879 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 880 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 881 | case SkBlendMode::kSrcATop: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 882 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 883 | TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 884 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 885 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 886 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 887 | TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 888 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 889 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 890 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 891 | case SkBlendMode::kDstATop: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 892 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 893 | TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 894 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 895 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 896 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 897 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 898 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 899 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 900 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 901 | case SkBlendMode::kXor: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 902 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 903 | TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 904 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 905 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 906 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 907 | TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 908 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 909 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 910 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 911 | case SkBlendMode::kPlus: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 912 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 913 | TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 914 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 915 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 916 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 917 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 918 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 919 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 920 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 921 | case SkBlendMode::kModulate: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 922 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 923 | TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 924 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 925 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 926 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 927 | TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 928 | TEST_ASSERT(kSC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 929 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 930 | break; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 931 | case SkBlendMode::kScreen: |
Brian Salomon | 9a51498 | 2017-02-14 10:28:22 -0500 | [diff] [blame] | 932 | TEST_ASSERT(xpi.fReadsDst); |
Brian Salomon | 8c852be | 2017-01-04 10:44:42 -0500 | [diff] [blame] | 933 | TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 934 | TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); |
| 935 | TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); |
| 936 | TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); |
| 937 | TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); |
| 938 | TEST_ASSERT(kISC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); |
| 939 | TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
| 940 | break; |
| 941 | default: |
| 942 | ERRORF(reporter, "Invalid xfermode."); |
| 943 | break; |
| 944 | } |
| 945 | } |
| 946 | } |
| 947 | |
egdaniel | 723b050 | 2015-09-15 09:31:40 -0700 | [diff] [blame] | 948 | static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const GrCaps& caps) { |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 949 | class TestLCDCoverageOp : public GrMeshDrawOp { |
reed | 1b55a96 | 2015-09-17 20:16:13 -0700 | [diff] [blame] | 950 | public: |
Brian Salomon | 25a8809 | 2016-12-01 09:36:50 -0500 | [diff] [blame] | 951 | DEFINE_OP_CLASS_ID |
reed | 1b55a96 | 2015-09-17 20:16:13 -0700 | [diff] [blame] | 952 | |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 953 | TestLCDCoverageOp() : INHERITED(ClassID()) {} |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 954 | |
Brian Salomon | 09d994e | 2016-12-21 11:14:46 -0500 | [diff] [blame] | 955 | const char* name() const override { return "Test LCD Text Op"; } |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 956 | |
| 957 | private: |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 958 | void getFragmentProcessorAnalysisInputs( |
| 959 | FragmentProcessorAnalysisInputs* input) const override { |
| 960 | input->colorInput()->setToConstant(GrColorPackRGBA(123, 45, 67, 221)); |
| 961 | input->coverageInput()->setToLCDCoverage(); |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 962 | } |
| 963 | |
| 964 | void applyPipelineOptimizations(const GrPipelineOptimizations&) override {} |
Brian Salomon | 25a8809 | 2016-12-01 09:36:50 -0500 | [diff] [blame] | 965 | bool onCombineIfPossible(GrOp*, const GrCaps&) override { return false; } |
Mike Klein | fc6c37b | 2016-09-27 09:34:10 -0400 | [diff] [blame] | 966 | void onPrepareDraws(Target*) const override {} |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 967 | |
Brian Salomon | dad2923 | 2016-12-01 16:40:24 -0500 | [diff] [blame] | 968 | typedef GrMeshDrawOp INHERITED; |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 969 | } testLCDCoverageOp; |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 970 | |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 971 | GrProcessorSet::FragmentProcessorAnalysis analysis; |
| 972 | GrAppliedClip clip(SkRect::MakeLargest()); |
| 973 | testLCDCoverageOp.analyzeProcessors(&analysis, GrProcessorSet(GrPaint()), clip, caps); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 974 | |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 975 | SkASSERT(analysis.hasKnownOutputColor()); |
| 976 | SkASSERT(analysis.hasLCDCoverage()); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 977 | |
Brian Salomon | a163392 | 2017-01-09 11:46:10 -0500 | [diff] [blame] | 978 | const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(SkBlendMode::kSrcOver); |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 979 | TEST_ASSERT(!GrXPFactory::WillNeedDstTexture(xpf, caps, analysis)); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 980 | |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 981 | sk_sp<GrXferProcessor> xp(xpf->createXferProcessor(analysis, false, nullptr, caps)); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 982 | if (!xp) { |
| 983 | ERRORF(reporter, "Failed to create an XP with LCD coverage."); |
| 984 | return; |
| 985 | } |
| 986 | |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 987 | TEST_ASSERT(GrXPFactory::WillReadDst(xpf, analysis)); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 988 | |
| 989 | GrColor overrideColor; |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 990 | xp->getOptimizations(analysis, false, &overrideColor, caps); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 991 | |
| 992 | GrXferProcessor::BlendInfo blendInfo; |
| 993 | xp->getBlendInfo(&blendInfo); |
| 994 | TEST_ASSERT(blendInfo.fWriteColor); |
| 995 | } |
| 996 | |
kkinnunen | 1530283 | 2015-12-01 04:35:26 -0800 | [diff] [blame] | 997 | DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, /*factory*/) { |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 998 | GrContextOptions opts; |
| 999 | opts.fSuppressDualSourceBlending = true; |
bsalomon | 3724e57 | 2016-03-30 18:56:19 -0700 | [diff] [blame] | 1000 | sk_gpu_test::GrContextFactory mockFactory(opts); |
bsalomon | 85b4b53 | 2016-04-05 11:06:27 -0700 | [diff] [blame] | 1001 | GrContext* ctx = mockFactory.get(sk_gpu_test::GrContextFactory::kNullGL_ContextType); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 1002 | if (!ctx) { |
| 1003 | SkFAIL("Failed to create null context without ARB_blend_func_extended."); |
| 1004 | return; |
| 1005 | } |
| 1006 | |
bsalomon | 7622863 | 2015-05-29 08:02:10 -0700 | [diff] [blame] | 1007 | const GrCaps& caps = *ctx->caps(); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 1008 | if (caps.shaderCaps()->dualSourceBlendingSupport()) { |
| 1009 | SkFAIL("Null context failed to honor request for no ARB_blend_func_extended."); |
| 1010 | return; |
| 1011 | } |
| 1012 | |
bsalomon | 091f60c | 2015-11-10 11:54:56 -0800 | [diff] [blame] | 1013 | GrBackendObject backendTex = |
bungeman | 6bd5284 | 2016-10-27 09:30:08 -0700 | [diff] [blame] | 1014 | ctx->getGpu()->createTestingOnlyBackendTexture(nullptr, 100, 100, kRGBA_8888_GrPixelConfig); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 1015 | GrBackendTextureDesc fakeDesc; |
| 1016 | fakeDesc.fConfig = kRGBA_8888_GrPixelConfig; |
| 1017 | fakeDesc.fWidth = fakeDesc.fHeight = 100; |
bsalomon | 091f60c | 2015-11-10 11:54:56 -0800 | [diff] [blame] | 1018 | fakeDesc.fTextureHandle = backendTex; |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 1019 | GrXferProcessor::DstTexture fakeDstTexture; |
bungeman | 6bd5284 | 2016-10-27 09:30:08 -0700 | [diff] [blame] | 1020 | fakeDstTexture.setTexture( |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame^] | 1021 | ctx->resourceProvider()->wrapBackendTexture(fakeDesc, kBorrow_GrWrapOwnership)); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 1022 | |
Brian Salomon | c6b7146 | 2017-02-14 11:33:01 -0500 | [diff] [blame] | 1023 | static const GrPipelineInput colorInputs[] = {GrPipelineInput(), |
| 1024 | GrPipelineInput(GrPipelineInput::Opaque::kYes), |
| 1025 | GrPipelineInput(GrColorPackRGBA(0, 82, 17, 100)), |
| 1026 | GrPipelineInput(GrColorPackRGBA(0, 82, 17, 255))}; |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 1027 | |
Brian Salomon | c6b7146 | 2017-02-14 11:33:01 -0500 | [diff] [blame] | 1028 | for (const auto& colorInput : colorInputs) { |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 1029 | GrProcessorSet::FragmentProcessorAnalysis analysis; |
Brian Salomon | c6b7146 | 2017-02-14 11:33:01 -0500 | [diff] [blame] | 1030 | for (bool fractionalCoverage : {true, false}) { |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 1031 | if (fractionalCoverage) { |
| 1032 | analysis = GrProcessorSet::FragmentProcessorAnalysis(colorInput, GrPipelineInput(), |
| 1033 | caps); |
| 1034 | } else { |
| 1035 | analysis = GrProcessorSet::FragmentProcessorAnalysis(colorInput, GrColorPackA4(255), |
| 1036 | caps); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 1037 | } |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 1038 | for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) { |
| 1039 | SkBlendMode xfermode = static_cast<SkBlendMode>(m); |
Brian Salomon | a163392 | 2017-01-09 11:46:10 -0500 | [diff] [blame] | 1040 | const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(xfermode); |
cdalton | 86ae0a9 | 2015-06-08 15:11:04 -0700 | [diff] [blame] | 1041 | GrXferProcessor::DstTexture* dstTexture = |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 1042 | GrXPFactory::WillNeedDstTexture(xpf, caps, analysis) ? &fakeDstTexture : 0; |
Hal Canary | 342b7ac | 2016-11-04 11:49:42 -0400 | [diff] [blame] | 1043 | sk_sp<GrXferProcessor> xp( |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 1044 | xpf->createXferProcessor(analysis, false, dstTexture, caps)); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 1045 | if (!xp) { |
| 1046 | ERRORF(reporter, "Failed to create an XP without dual source blending."); |
| 1047 | return; |
| 1048 | } |
| 1049 | TEST_ASSERT(!xp->hasSecondaryOutput()); |
Brian Salomon | bfd5183 | 2017-01-04 13:22:08 -0500 | [diff] [blame] | 1050 | GrColor ignoredOverrideColor; |
| 1051 | xp->getOptimizations(analysis, false, &ignoredOverrideColor, caps); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 1052 | TEST_ASSERT(!xp->hasSecondaryOutput()); |
| 1053 | } |
| 1054 | } |
| 1055 | } |
bsalomon | 091f60c | 2015-11-10 11:54:56 -0800 | [diff] [blame] | 1056 | ctx->getGpu()->deleteTestingOnlyBackendTexture(backendTex); |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 1057 | } |
| 1058 | |
| 1059 | #endif |