16fd158ea47472c4d038e48980a95e36623f840c9cdalton/* 26fd158ea47472c4d038e48980a95e36623f840c9cdalton * Copyright 2015 Google Inc. 36fd158ea47472c4d038e48980a95e36623f840c9cdalton * 46fd158ea47472c4d038e48980a95e36623f840c9cdalton * Use of this source code is governed by a BSD-style license that can be 56fd158ea47472c4d038e48980a95e36623f840c9cdalton * found in the LICENSE file. 66fd158ea47472c4d038e48980a95e36623f840c9cdalton */ 76fd158ea47472c4d038e48980a95e36623f840c9cdalton 86fd158ea47472c4d038e48980a95e36623f840c9cdalton#include "SkXfermode.h" 96fd158ea47472c4d038e48980a95e36623f840c9cdalton#include "Test.h" 106fd158ea47472c4d038e48980a95e36623f840c9cdalton 116fd158ea47472c4d038e48980a95e36623f840c9cdalton#if SK_SUPPORT_GPU 126fd158ea47472c4d038e48980a95e36623f840c9cdalton 136fd158ea47472c4d038e48980a95e36623f840c9cdalton#include "GrContextFactory.h" 146fd158ea47472c4d038e48980a95e36623f840c9cdalton#include "GrContextOptions.h" 156fd158ea47472c4d038e48980a95e36623f840c9cdalton#include "GrGpu.h" 166fd158ea47472c4d038e48980a95e36623f840c9cdalton#include "GrResourceProvider.h" 176fd158ea47472c4d038e48980a95e36623f840c9cdalton#include "GrXferProcessor.h" 1816b991390bb988b194a868ab8de66db4c21c7c13bsalomon#include "batches/GrVertexBatch.h" 196fd158ea47472c4d038e48980a95e36623f840c9cdalton#include "effects/GrPorterDuffXferProcessor.h" 206fd158ea47472c4d038e48980a95e36623f840c9cdalton#include "gl/GrGLCaps.h" 216fd158ea47472c4d038e48980a95e36623f840c9cdalton 226fd158ea47472c4d038e48980a95e36623f840c9cdalton//////////////////////////////////////////////////////////////////////////////// 236fd158ea47472c4d038e48980a95e36623f840c9cdalton 246fd158ea47472c4d038e48980a95e36623f840c9cdaltonstatic void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps); 256fd158ea47472c4d038e48980a95e36623f840c9cdaltonstatic void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps); 266fd158ea47472c4d038e48980a95e36623f840c9cdaltonstatic void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps); 276fd158ea47472c4d038e48980a95e36623f840c9cdaltonstatic void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps); 286fd158ea47472c4d038e48980a95e36623f840c9cdaltonstatic void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps); 29723b0501e22373bb3e6c306daaceae02cda8a124egdanielstatic void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const GrCaps& caps); 306fd158ea47472c4d038e48980a95e36623f840c9cdalton 311530283c483cb88aa725bce50a6d193dd00ee570kkinnunenDEF_GPUTEST_FOR_NULL_CONTEXT(GrPorterDuff, reporter, context) { 321530283c483cb88aa725bce50a6d193dd00ee570kkinnunen const GrCaps& caps = *context->getGpu()->caps(); 336fd158ea47472c4d038e48980a95e36623f840c9cdalton if (!caps.shaderCaps()->dualSourceBlendingSupport()) { 346fd158ea47472c4d038e48980a95e36623f840c9cdalton SkFAIL("Null context does not support dual source blending."); 356fd158ea47472c4d038e48980a95e36623f840c9cdalton return; 366fd158ea47472c4d038e48980a95e36623f840c9cdalton } 376fd158ea47472c4d038e48980a95e36623f840c9cdalton 386fd158ea47472c4d038e48980a95e36623f840c9cdalton test_color_unknown_with_coverage(reporter, caps); 396fd158ea47472c4d038e48980a95e36623f840c9cdalton test_color_unknown_no_coverage(reporter, caps); 406fd158ea47472c4d038e48980a95e36623f840c9cdalton test_color_opaque_with_coverage(reporter, caps); 416fd158ea47472c4d038e48980a95e36623f840c9cdalton test_color_opaque_no_coverage(reporter, caps); 426fd158ea47472c4d038e48980a95e36623f840c9cdalton test_lcd_coverage(reporter, caps); 43723b0501e22373bb3e6c306daaceae02cda8a124egdaniel test_lcd_coverage_fallback_case(reporter, caps); 446fd158ea47472c4d038e48980a95e36623f840c9cdalton} 456fd158ea47472c4d038e48980a95e36623f840c9cdalton 466fd158ea47472c4d038e48980a95e36623f840c9cdalton//////////////////////////////////////////////////////////////////////////////// 476fd158ea47472c4d038e48980a95e36623f840c9cdalton 486fd158ea47472c4d038e48980a95e36623f840c9cdalton#define TEST_ASSERT(...) REPORTER_ASSERT(reporter, __VA_ARGS__) 496fd158ea47472c4d038e48980a95e36623f840c9cdalton 506fd158ea47472c4d038e48980a95e36623f840c9cdaltonenum { 516fd158ea47472c4d038e48980a95e36623f840c9cdalton kNone_OutputType, 526fd158ea47472c4d038e48980a95e36623f840c9cdalton kCoverage_OutputType, 536fd158ea47472c4d038e48980a95e36623f840c9cdalton kModulate_OutputType, 54723b0501e22373bb3e6c306daaceae02cda8a124egdaniel kSAModulate_OutputType, 556fd158ea47472c4d038e48980a95e36623f840c9cdalton kISAModulate_OutputType, 566fd158ea47472c4d038e48980a95e36623f840c9cdalton kISCModulate_OutputType 576fd158ea47472c4d038e48980a95e36623f840c9cdalton}; 586fd158ea47472c4d038e48980a95e36623f840c9cdalton 596fd158ea47472c4d038e48980a95e36623f840c9cdaltonenum { 607765a477ee3ca5e2c6ada1e16c31dfaae2079240bsalomon kNone_OptFlags = GrXferProcessor::kNone_OptFlags, 616fd158ea47472c4d038e48980a95e36623f840c9cdalton kSkipDraw_OptFlag = GrXferProcessor::kSkipDraw_OptFlag, 626fd158ea47472c4d038e48980a95e36623f840c9cdalton kIgnoreColor_OptFlag = GrXferProcessor::kIgnoreColor_OptFlag, 636fd158ea47472c4d038e48980a95e36623f840c9cdalton kIgnoreCoverage_OptFlag = GrXferProcessor::kIgnoreCoverage_OptFlag, 646fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag = GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag 656fd158ea47472c4d038e48980a95e36623f840c9cdalton}; 666fd158ea47472c4d038e48980a95e36623f840c9cdalton 676fd158ea47472c4d038e48980a95e36623f840c9cdaltonclass GrPorterDuffTest { 686fd158ea47472c4d038e48980a95e36623f840c9cdaltonpublic: 696fd158ea47472c4d038e48980a95e36623f840c9cdalton struct XPInfo { 706fd158ea47472c4d038e48980a95e36623f840c9cdalton XPInfo(skiatest::Reporter* reporter, SkXfermode::Mode xfermode, const GrCaps& caps, 71de4166a3b45d859512e27e3257841f064d67549cethannicholas const GrPipelineOptimizations& optimizations) { 72f234272cbdcbcd46be462317e75cd138999c9fe9egdaniel SkAutoTUnref<GrXPFactory> xpf(GrPorterDuffXPFactory::Create(xfermode)); 7386ae0a9e465f157eaa263ef7515e10619946ff83cdalton SkAutoTUnref<GrXferProcessor> xp( 74de4166a3b45d859512e27e3257841f064d67549cethannicholas xpf->createXferProcessor(optimizations, false, nullptr, caps)); 75de4166a3b45d859512e27e3257841f064d67549cethannicholas TEST_ASSERT(!xpf->willNeedDstTexture(caps, optimizations, false)); 76de4166a3b45d859512e27e3257841f064d67549cethannicholas xpf->getInvariantBlendedColor(optimizations.fColorPOI, &fBlendedColor); 77de4166a3b45d859512e27e3257841f064d67549cethannicholas fOptFlags = xp->getOptimizations(optimizations, false, nullptr, caps); 786fd158ea47472c4d038e48980a95e36623f840c9cdalton GetXPOutputTypes(xp, &fPrimaryOutputType, &fSecondaryOutputType); 796fd158ea47472c4d038e48980a95e36623f840c9cdalton xp->getBlendInfo(&fBlendInfo); 806fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(!xp->willReadDstColor()); 816fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xp->hasSecondaryOutput() == GrBlendCoeffRefsSrc2(fBlendInfo.fDstBlend)); 826fd158ea47472c4d038e48980a95e36623f840c9cdalton } 836fd158ea47472c4d038e48980a95e36623f840c9cdalton 841fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton GrXPFactory::InvariantBlendedColor fBlendedColor; 856fd158ea47472c4d038e48980a95e36623f840c9cdalton int fOptFlags; 866fd158ea47472c4d038e48980a95e36623f840c9cdalton int fPrimaryOutputType; 876fd158ea47472c4d038e48980a95e36623f840c9cdalton int fSecondaryOutputType; 886fd158ea47472c4d038e48980a95e36623f840c9cdalton GrXferProcessor::BlendInfo fBlendInfo; 896fd158ea47472c4d038e48980a95e36623f840c9cdalton }; 906fd158ea47472c4d038e48980a95e36623f840c9cdalton 916fd158ea47472c4d038e48980a95e36623f840c9cdalton static void GetXPOutputTypes(const GrXferProcessor* xp, int* outPrimary, int* outSecondary) { 92f234272cbdcbcd46be462317e75cd138999c9fe9egdaniel GrPorterDuffXPFactory::TestGetXPOutputTypes(xp, outPrimary, outSecondary); 936fd158ea47472c4d038e48980a95e36623f840c9cdalton } 946fd158ea47472c4d038e48980a95e36623f840c9cdalton}; 956fd158ea47472c4d038e48980a95e36623f840c9cdalton 96723b0501e22373bb3e6c306daaceae02cda8a124egdanielstatic void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { 97de4166a3b45d859512e27e3257841f064d67549cethannicholas GrPipelineOptimizations opt; 98de4166a3b45d859512e27e3257841f064d67549cethannicholas opt.fColorPOI.calcWithInitialValues(NULL, 0, 0, kNone_GrColorComponentFlags, false); 99723b0501e22373bb3e6c306daaceae02cda8a124egdaniel // Setting 2nd to last value to false and last to true will force covPOI to LCD coverage. 100de4166a3b45d859512e27e3257841f064d67549cethannicholas opt.fCoveragePOI.calcWithInitialValues(NULL, 0, 0, kNone_GrColorComponentFlags, false, true); 101723b0501e22373bb3e6c306daaceae02cda8a124egdaniel 102de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(!opt.fColorPOI.isOpaque()); 103de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(!opt.fColorPOI.isSolidWhite()); 104de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(!opt.fCoveragePOI.isSolidWhite()); 105de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(opt.fCoveragePOI.isFourChannelOutput()); 106723b0501e22373bb3e6c306daaceae02cda8a124egdaniel 107723b0501e22373bb3e6c306daaceae02cda8a124egdaniel for (int m = 0; m <= SkXfermode::kLastCoeffMode; m++) { 108723b0501e22373bb3e6c306daaceae02cda8a124egdaniel SkXfermode::Mode xfermode = static_cast<SkXfermode::Mode>(m); 109de4166a3b45d859512e27e3257841f064d67549cethannicholas const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, opt); 110723b0501e22373bb3e6c306daaceae02cda8a124egdaniel 111723b0501e22373bb3e6c306daaceae02cda8a124egdaniel switch (xfermode) { 112723b0501e22373bb3e6c306daaceae02cda8a124egdaniel case SkXfermode::kClear_Mode: 113723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); 114723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor); 115723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 116723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT((kIgnoreColor_OptFlag) == xpi.fOptFlags); 117723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType); 118723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 119723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); 120723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 121723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 122723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 123723b0501e22373bb3e6c306daaceae02cda8a124egdaniel break; 124723b0501e22373bb3e6c306daaceae02cda8a124egdaniel case SkXfermode::kSrc_Mode: 125723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); 126723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 127723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 128723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 129723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); 130723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 131723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 132723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 133723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 134723b0501e22373bb3e6c306daaceae02cda8a124egdaniel break; 135723b0501e22373bb3e6c306daaceae02cda8a124egdaniel case SkXfermode::kDst_Mode: 136723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 137723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 138723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT((kSkipDraw_OptFlag | 139723b0501e22373bb3e6c306daaceae02cda8a124egdaniel kIgnoreColor_OptFlag | 140723b0501e22373bb3e6c306daaceae02cda8a124egdaniel kIgnoreCoverage_OptFlag | 141723b0501e22373bb3e6c306daaceae02cda8a124egdaniel kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 142723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); 143723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 144723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 145723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 146723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 147723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); 148723b0501e22373bb3e6c306daaceae02cda8a124egdaniel break; 149723b0501e22373bb3e6c306daaceae02cda8a124egdaniel case SkXfermode::kSrcOver_Mode: 150723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 151723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 152723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 153723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 154723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kSAModulate_OutputType == xpi.fSecondaryOutputType); 155723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 156723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 157723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 158723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 159723b0501e22373bb3e6c306daaceae02cda8a124egdaniel break; 160723b0501e22373bb3e6c306daaceae02cda8a124egdaniel case SkXfermode::kDstOver_Mode: 161723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 162723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 163723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 164723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 165723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 166723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 167723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 168723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 169723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 170723b0501e22373bb3e6c306daaceae02cda8a124egdaniel break; 171723b0501e22373bb3e6c306daaceae02cda8a124egdaniel case SkXfermode::kSrcIn_Mode: 172723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 173723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 174723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 175723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 176723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); 177723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 178723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 179723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 180723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 181723b0501e22373bb3e6c306daaceae02cda8a124egdaniel break; 182723b0501e22373bb3e6c306daaceae02cda8a124egdaniel case SkXfermode::kDstIn_Mode: 183723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 184723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 185723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 186723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kISAModulate_OutputType == xpi.fPrimaryOutputType); 187723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 188723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); 189723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 190723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 191723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 192723b0501e22373bb3e6c306daaceae02cda8a124egdaniel break; 193723b0501e22373bb3e6c306daaceae02cda8a124egdaniel case SkXfermode::kSrcOut_Mode: 194723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 195723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 196723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 197723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 198723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); 199723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 200723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 201723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 202723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 203723b0501e22373bb3e6c306daaceae02cda8a124egdaniel break; 204723b0501e22373bb3e6c306daaceae02cda8a124egdaniel case SkXfermode::kDstOut_Mode: 205723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 206723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 207723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 208723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kSAModulate_OutputType == xpi.fPrimaryOutputType); 209723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 210723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 211723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 212723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kISC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 213723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 214723b0501e22373bb3e6c306daaceae02cda8a124egdaniel break; 215723b0501e22373bb3e6c306daaceae02cda8a124egdaniel case SkXfermode::kSrcATop_Mode: 216723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 217723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 218723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 219723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 220723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kSAModulate_OutputType == xpi.fSecondaryOutputType); 221723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 222723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 223723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 224723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 225723b0501e22373bb3e6c306daaceae02cda8a124egdaniel break; 226723b0501e22373bb3e6c306daaceae02cda8a124egdaniel case SkXfermode::kDstATop_Mode: 227723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 228723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 229723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 230723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 231723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kISAModulate_OutputType == xpi.fSecondaryOutputType); 232723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 233723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 234723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 235723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 236723b0501e22373bb3e6c306daaceae02cda8a124egdaniel break; 237723b0501e22373bb3e6c306daaceae02cda8a124egdaniel case SkXfermode::kXor_Mode: 238723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 239723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 240723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 241723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 242723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kSAModulate_OutputType == xpi.fSecondaryOutputType); 243723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 244723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 245723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 246723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 247723b0501e22373bb3e6c306daaceae02cda8a124egdaniel break; 248723b0501e22373bb3e6c306daaceae02cda8a124egdaniel case SkXfermode::kPlus_Mode: 249723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 250723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 251723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 252723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 253723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 254723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 255723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 256723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 257723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 258723b0501e22373bb3e6c306daaceae02cda8a124egdaniel break; 259723b0501e22373bb3e6c306daaceae02cda8a124egdaniel case SkXfermode::kModulate_Mode: 260723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 261723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 262723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 263723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType); 264723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 265723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); 266723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 267723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 268723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 269723b0501e22373bb3e6c306daaceae02cda8a124egdaniel break; 270723b0501e22373bb3e6c306daaceae02cda8a124egdaniel case SkXfermode::kScreen_Mode: 271723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 272723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 273723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 274723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 275723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 276723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 277723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 278723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(kISC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 279723b0501e22373bb3e6c306daaceae02cda8a124egdaniel TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 280723b0501e22373bb3e6c306daaceae02cda8a124egdaniel break; 281723b0501e22373bb3e6c306daaceae02cda8a124egdaniel default: 282723b0501e22373bb3e6c306daaceae02cda8a124egdaniel ERRORF(reporter, "Invalid xfermode."); 283723b0501e22373bb3e6c306daaceae02cda8a124egdaniel break; 284723b0501e22373bb3e6c306daaceae02cda8a124egdaniel } 285723b0501e22373bb3e6c306daaceae02cda8a124egdaniel } 286723b0501e22373bb3e6c306daaceae02cda8a124egdaniel} 2876fd158ea47472c4d038e48980a95e36623f840c9cdaltonstatic void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { 288de4166a3b45d859512e27e3257841f064d67549cethannicholas GrPipelineOptimizations optimizations; 289de4166a3b45d859512e27e3257841f064d67549cethannicholas optimizations.fColorPOI.calcWithInitialValues(nullptr, 0, 0, kNone_GrColorComponentFlags, 290de4166a3b45d859512e27e3257841f064d67549cethannicholas false); 291de4166a3b45d859512e27e3257841f064d67549cethannicholas optimizations.fCoveragePOI.calcWithInitialValues(nullptr, 0, 0, kNone_GrColorComponentFlags, 292de4166a3b45d859512e27e3257841f064d67549cethannicholas true); 2936fd158ea47472c4d038e48980a95e36623f840c9cdalton 294de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(!optimizations.fColorPOI.isOpaque()); 295de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(!optimizations.fColorPOI.isSolidWhite()); 296de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(!optimizations.fCoveragePOI.isSolidWhite()); 297de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(!optimizations.fCoveragePOI.isFourChannelOutput()); 2986fd158ea47472c4d038e48980a95e36623f840c9cdalton 2996fd158ea47472c4d038e48980a95e36623f840c9cdalton for (int m = 0; m <= SkXfermode::kLastCoeffMode; m++) { 3006fd158ea47472c4d038e48980a95e36623f840c9cdalton SkXfermode::Mode xfermode = static_cast<SkXfermode::Mode>(m); 301de4166a3b45d859512e27e3257841f064d67549cethannicholas const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, optimizations); 3026fd158ea47472c4d038e48980a95e36623f840c9cdalton 303723b0501e22373bb3e6c306daaceae02cda8a124egdaniel 3046fd158ea47472c4d038e48980a95e36623f840c9cdalton switch (xfermode) { 3056fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kClear_Mode: 3061fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); 3071fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor); 3081fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 3096fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreColor_OptFlag) == xpi.fOptFlags); 3106fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType); 3116fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 3126fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); 3136fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 3146fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 3156fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 3166fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 3176fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrc_Mode: 3181fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); 3191fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 3207765a477ee3ca5e2c6ada1e16c31dfaae2079240bsalomon TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 3216fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 3226fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); 3236fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 3246fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 3256fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIS2A_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 3266fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 3276fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 3286fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDst_Mode: 3291fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 3301fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 3316fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kSkipDraw_OptFlag | 3326fd158ea47472c4d038e48980a95e36623f840c9cdalton kIgnoreColor_OptFlag | 3336fd158ea47472c4d038e48980a95e36623f840c9cdalton kIgnoreCoverage_OptFlag | 3346fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 3356fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); 3366fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 3376fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 3386fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 3396fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 3406fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); 3416fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 3426fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrcOver_Mode: 3431fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 3441fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 3456fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 3466fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 3476fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 3486fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 3496fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 3506fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 3516fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 3526fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 3536fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDstOver_Mode: 3541fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 3551fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 3566fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 3576fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 3586fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 3596fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 3606fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 3616fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 3626fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 3636fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 3646fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrcIn_Mode: 3651fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 3661fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 3677765a477ee3ca5e2c6ada1e16c31dfaae2079240bsalomon TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 3686fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 3696fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); 3706fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 3716fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 3726fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIS2A_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 3736fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 3746fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 3756fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDstIn_Mode: 3761fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 3771fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 3787765a477ee3ca5e2c6ada1e16c31dfaae2079240bsalomon TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 3796fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISAModulate_OutputType == xpi.fPrimaryOutputType); 3806fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 3816fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); 3826fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 3836fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 3846fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 3856fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 3866fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrcOut_Mode: 3871fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 3881fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 3897765a477ee3ca5e2c6ada1e16c31dfaae2079240bsalomon TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 3906fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 3916fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); 3926fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 3936fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 3946fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIS2A_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 3956fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 3966fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 3976fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDstOut_Mode: 3981fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 3991fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 4006fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 4016fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 4026fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 4036fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 4046fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 4056fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 4066fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 4076fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 4086fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrcATop_Mode: 4091fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 4101fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 4116fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 4126fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 4136fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 4146fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 4156fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 4166fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 4176fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 4186fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 4196fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDstATop_Mode: 4201fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 4211fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 4227765a477ee3ca5e2c6ada1e16c31dfaae2079240bsalomon TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 4236fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 4246fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISAModulate_OutputType == xpi.fSecondaryOutputType); 4256fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 4266fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 4276fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 4286fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 4296fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 4306fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kXor_Mode: 4311fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 4321fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 4336fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 4346fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 4356fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 4366fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 4376fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 4386fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 4396fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 4406fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 4416fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kPlus_Mode: 4421fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 4431fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 4446fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 4456fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 4466fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 4476fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 4486fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 4496fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 4506fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 4516fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 4526fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kModulate_Mode: 4531fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 4541fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 4557765a477ee3ca5e2c6ada1e16c31dfaae2079240bsalomon TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 4566fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType); 4576fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 4586fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); 4596fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 4606fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 4616fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 4626fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 4636fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kScreen_Mode: 4641fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 4651fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 4666fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 4676fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 4686fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 4696fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 4706fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 4716fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 4726fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 4736fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 4746fd158ea47472c4d038e48980a95e36623f840c9cdalton default: 4756fd158ea47472c4d038e48980a95e36623f840c9cdalton ERRORF(reporter, "Invalid xfermode."); 4766fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 4776fd158ea47472c4d038e48980a95e36623f840c9cdalton } 4786fd158ea47472c4d038e48980a95e36623f840c9cdalton } 4796fd158ea47472c4d038e48980a95e36623f840c9cdalton} 4806fd158ea47472c4d038e48980a95e36623f840c9cdalton 4816fd158ea47472c4d038e48980a95e36623f840c9cdaltonstatic void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { 482de4166a3b45d859512e27e3257841f064d67549cethannicholas GrPipelineOptimizations optimizations; 483de4166a3b45d859512e27e3257841f064d67549cethannicholas optimizations.fColorPOI.calcWithInitialValues(nullptr, 0, GrColorPackRGBA(229, 0, 154, 0), 4846fd158ea47472c4d038e48980a95e36623f840c9cdalton kR_GrColorComponentFlag | kB_GrColorComponentFlag, false); 485de4166a3b45d859512e27e3257841f064d67549cethannicholas optimizations.fCoveragePOI.calcWithInitialValues(nullptr, 0, GrColorPackA4(255), 486de4166a3b45d859512e27e3257841f064d67549cethannicholas kRGBA_GrColorComponentFlags, true); 4876fd158ea47472c4d038e48980a95e36623f840c9cdalton 488de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(!optimizations.fColorPOI.isOpaque()); 489de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(!optimizations.fColorPOI.isSolidWhite()); 490de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(optimizations.fCoveragePOI.isSolidWhite()); 491de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(!optimizations.fCoveragePOI.isFourChannelOutput()); 4926fd158ea47472c4d038e48980a95e36623f840c9cdalton 4936fd158ea47472c4d038e48980a95e36623f840c9cdalton for (int m = 0; m <= SkXfermode::kLastCoeffMode; m++) { 4946fd158ea47472c4d038e48980a95e36623f840c9cdalton SkXfermode::Mode xfermode = static_cast<SkXfermode::Mode>(m); 495de4166a3b45d859512e27e3257841f064d67549cethannicholas const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, optimizations); 4966fd158ea47472c4d038e48980a95e36623f840c9cdalton 4976fd158ea47472c4d038e48980a95e36623f840c9cdalton switch (xfermode) { 4986fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kClear_Mode: 4991fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); 5001fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor); 5011fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 5026fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreColor_OptFlag | 5036fd158ea47472c4d038e48980a95e36623f840c9cdalton kIgnoreCoverage_OptFlag) == xpi.fOptFlags); 5046fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); 5056fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 5066fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 5076fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 5086fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 5096fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 5106fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 5116fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrc_Mode: 5121fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); 5131fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(229 == GrColorUnpackR(xpi.fBlendedColor.fKnownColor)); 5141fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(154 == GrColorUnpackB(xpi.fBlendedColor.fKnownColor)); 5156fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kR_GrColorComponentFlag | 5161fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton kB_GrColorComponentFlag) == xpi.fBlendedColor.fKnownColorFlags); 5176fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags); 5186fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 5196fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 5206fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 5216fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 5226fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 5236fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 5246fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 5256fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDst_Mode: 5261fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 5271fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 5286fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kSkipDraw_OptFlag | 5296fd158ea47472c4d038e48980a95e36623f840c9cdalton kIgnoreColor_OptFlag | 5306fd158ea47472c4d038e48980a95e36623f840c9cdalton kIgnoreCoverage_OptFlag | 5316fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 5326fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); 5336fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 5346fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 5356fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 5366fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 5376fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); 5386fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 5396fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrcOver_Mode: 5401fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 5411fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 5426fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag | 5436fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 5446fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 5456fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 5466fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 5476fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 5486fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 5496fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 5506fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 5516fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDstOver_Mode: 5521fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 5531fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 5546fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag | 5556fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 5566fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 5576fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 5586fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 5596fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 5606fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 5616fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 5626fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 5636fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrcIn_Mode: 5641fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 5651fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 5666fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags); 5676fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 5686fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 5696fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 5706fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 5716fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 5726fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 5736fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 5746fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDstIn_Mode: 5751fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 5761fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 5776fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags); 5786fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 5796fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 5806fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 5816fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 5826fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kSA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 5836fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 5846fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 5856fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrcOut_Mode: 5861fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 5871fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 5886fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags); 5896fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 5906fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 5916fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 5926fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 5936fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 5946fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 5956fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 5966fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDstOut_Mode: 5971fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 5981fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 5996fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag | 6006fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 6016fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 6026fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 6036fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 6046fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 6056fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 6066fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 6076fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 6086fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrcATop_Mode: 6091fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 6101fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 6116fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag | 6126fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 6136fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 6146fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 6156fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 6166fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 6176fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 6186fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 6196fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 6206fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDstATop_Mode: 6211fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 6221fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 6236fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags); 6246fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 6256fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 6266fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 6276fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 6286fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kSA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 6296fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 6306fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 6316fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kXor_Mode: 6321fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 6331fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 6346fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag | 6356fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 6366fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 6376fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 6386fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 6396fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 6406fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 6416fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 6426fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 6436fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kPlus_Mode: 6441fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 6451fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 6466fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag | 6476fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 6486fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 6496fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 6506fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 6516fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 6526fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 6536fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 6546fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 6556fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kModulate_Mode: 6561fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 6571fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 6586fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags); 6596fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 6606fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 6616fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 6626fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 6636fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kSC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 6646fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 6656fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 6666fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kScreen_Mode: 6671fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 6681fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 6696fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag | 6706fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 6716fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 6726fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 6736fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 6746fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 6756fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 6766fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 6776fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 6786fd158ea47472c4d038e48980a95e36623f840c9cdalton default: 6796fd158ea47472c4d038e48980a95e36623f840c9cdalton ERRORF(reporter, "Invalid xfermode."); 6806fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 6816fd158ea47472c4d038e48980a95e36623f840c9cdalton } 6826fd158ea47472c4d038e48980a95e36623f840c9cdalton } 6836fd158ea47472c4d038e48980a95e36623f840c9cdalton} 6846fd158ea47472c4d038e48980a95e36623f840c9cdalton 6856fd158ea47472c4d038e48980a95e36623f840c9cdaltonstatic void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { 686de4166a3b45d859512e27e3257841f064d67549cethannicholas GrPipelineOptimizations optimizations; 687de4166a3b45d859512e27e3257841f064d67549cethannicholas optimizations.fColorPOI.calcWithInitialValues(nullptr, 0, GrColorPackA4(255), 688de4166a3b45d859512e27e3257841f064d67549cethannicholas kA_GrColorComponentFlag, false); 689de4166a3b45d859512e27e3257841f064d67549cethannicholas optimizations.fCoveragePOI.calcWithInitialValues(nullptr, 0, 0, kNone_GrColorComponentFlags, 690de4166a3b45d859512e27e3257841f064d67549cethannicholas true); 6916fd158ea47472c4d038e48980a95e36623f840c9cdalton 692de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(optimizations.fColorPOI.isOpaque()); 693de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(!optimizations.fColorPOI.isSolidWhite()); 694de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(!optimizations.fCoveragePOI.isSolidWhite()); 695de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(!optimizations.fCoveragePOI.isFourChannelOutput()); 6966fd158ea47472c4d038e48980a95e36623f840c9cdalton 6976fd158ea47472c4d038e48980a95e36623f840c9cdalton for (int m = 0; m <= SkXfermode::kLastCoeffMode; m++) { 6986fd158ea47472c4d038e48980a95e36623f840c9cdalton SkXfermode::Mode xfermode = static_cast<SkXfermode::Mode>(m); 699de4166a3b45d859512e27e3257841f064d67549cethannicholas const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, optimizations); 7006fd158ea47472c4d038e48980a95e36623f840c9cdalton 7016fd158ea47472c4d038e48980a95e36623f840c9cdalton switch (xfermode) { 7026fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kClear_Mode: 7031fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); 7041fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor); 7051fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 7066fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreColor_OptFlag) == xpi.fOptFlags); 7076fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType); 7086fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 7096fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); 7106fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 7116fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 7126fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 7136fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 7146fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrc_Mode: 7151fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); 7161fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(255 == GrColorUnpackA(xpi.fBlendedColor.fKnownColor)); 7171fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kA_GrColorComponentFlag == xpi.fBlendedColor.fKnownColorFlags); 7186fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 7196fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 7206fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 7216fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 7226fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 7236fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 7246fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 7256fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 7266fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDst_Mode: 7271fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 7281fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 7296fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kSkipDraw_OptFlag | 7306fd158ea47472c4d038e48980a95e36623f840c9cdalton kIgnoreColor_OptFlag | 7316fd158ea47472c4d038e48980a95e36623f840c9cdalton kIgnoreCoverage_OptFlag | 7326fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 7336fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); 7346fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 7356fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 7366fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 7376fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 7386fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); 7396fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 7406fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrcOver_Mode: 7411fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); 7421fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(255 == GrColorUnpackA(xpi.fBlendedColor.fKnownColor)); 7431fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kA_GrColorComponentFlag == xpi.fBlendedColor.fKnownColorFlags); 7446fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 7456fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 7466fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 7476fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 7486fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 7496fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 7506fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 7516fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 7526fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDstOver_Mode: 7531fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 7541fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 7556fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 7566fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 7576fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 7586fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 7596fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 7606fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 7616fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 7626fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 7636fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrcIn_Mode: 7641fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 7651fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 7666fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 7676fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 7686fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 7696fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 7706fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 7716fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 7726fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 7736fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 7746fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDstIn_Mode: 7751fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 7761fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 7776fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kSkipDraw_OptFlag | 7786fd158ea47472c4d038e48980a95e36623f840c9cdalton kIgnoreColor_OptFlag | 7796fd158ea47472c4d038e48980a95e36623f840c9cdalton kIgnoreCoverage_OptFlag | 7806fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 7816fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); 7826fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 7836fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 7846fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 7856fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 7866fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); 7876fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 7886fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrcOut_Mode: 7891fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 7901fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 7916fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 7926fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 7936fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 7946fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 7956fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 7966fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 7976fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 7986fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 7996fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDstOut_Mode: 8001fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); 8011fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor); 8021fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 8036fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreColor_OptFlag) == xpi.fOptFlags); 8046fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType); 8056fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 8066fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); 8076fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 8086fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 8096fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 8106fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 8116fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrcATop_Mode: 8121fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 8131fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 8146fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 8156fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 8166fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 8176fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 8186fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 8196fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 8206fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 8216fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 8226fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDstATop_Mode: 8231fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 8241fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 8256fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 8266fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 8276fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 8286fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 8296fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 8306fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 8316fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 8326fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 8336fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kXor_Mode: 8341fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 8351fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 8366fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 8376fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 8386fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 8396fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 8406fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 8416fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 8426fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 8436fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 8446fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kPlus_Mode: 8451fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 8461fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 8476fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 8486fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 8496fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 8506fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 8516fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 8526fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 8536fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 8546fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 8556fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kModulate_Mode: 8561fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 8571fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 8587765a477ee3ca5e2c6ada1e16c31dfaae2079240bsalomon TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags); 8596fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType); 8606fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 8616fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); 8626fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 8636fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 8646fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 8656fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 8666fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kScreen_Mode: 8671fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 8681fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 8696fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 8706fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 8716fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 8726fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 8736fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 8746fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 8756fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 8766fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 8776fd158ea47472c4d038e48980a95e36623f840c9cdalton default: 8786fd158ea47472c4d038e48980a95e36623f840c9cdalton ERRORF(reporter, "Invalid xfermode."); 8796fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 8806fd158ea47472c4d038e48980a95e36623f840c9cdalton } 8816fd158ea47472c4d038e48980a95e36623f840c9cdalton } 8826fd158ea47472c4d038e48980a95e36623f840c9cdalton} 8836fd158ea47472c4d038e48980a95e36623f840c9cdalton 8846fd158ea47472c4d038e48980a95e36623f840c9cdaltonstatic void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { 885de4166a3b45d859512e27e3257841f064d67549cethannicholas GrPipelineOptimizations optimizations; 886de4166a3b45d859512e27e3257841f064d67549cethannicholas optimizations.fColorPOI.calcWithInitialValues(nullptr, 0, GrColorPackRGBA(0, 82, 0, 255), 8876fd158ea47472c4d038e48980a95e36623f840c9cdalton kG_GrColorComponentFlag | kA_GrColorComponentFlag, false); 888de4166a3b45d859512e27e3257841f064d67549cethannicholas optimizations.fCoveragePOI.calcWithInitialValues(nullptr, 0, GrColorPackA4(255), 889de4166a3b45d859512e27e3257841f064d67549cethannicholas kRGBA_GrColorComponentFlags, true); 8906fd158ea47472c4d038e48980a95e36623f840c9cdalton 891de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(optimizations.fColorPOI.isOpaque()); 892de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(!optimizations.fColorPOI.isSolidWhite()); 893de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(optimizations.fCoveragePOI.isSolidWhite()); 894de4166a3b45d859512e27e3257841f064d67549cethannicholas SkASSERT(!optimizations.fCoveragePOI.isFourChannelOutput()); 8956fd158ea47472c4d038e48980a95e36623f840c9cdalton 8966fd158ea47472c4d038e48980a95e36623f840c9cdalton for (int m = 0; m <= SkXfermode::kLastCoeffMode; m++) { 8976fd158ea47472c4d038e48980a95e36623f840c9cdalton SkXfermode::Mode xfermode = static_cast<SkXfermode::Mode>(m); 898de4166a3b45d859512e27e3257841f064d67549cethannicholas const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, optimizations); 8996fd158ea47472c4d038e48980a95e36623f840c9cdalton 9006fd158ea47472c4d038e48980a95e36623f840c9cdalton switch (xfermode) { 9016fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kClear_Mode: 9021fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); 9031fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor); 9041fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 9056fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreColor_OptFlag | 9066fd158ea47472c4d038e48980a95e36623f840c9cdalton kIgnoreCoverage_OptFlag) == xpi.fOptFlags); 9076fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); 9086fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 9096fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 9106fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 9116fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 9126fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 9136fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 9146fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrc_Mode: 9151fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); 9161fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(82 == GrColorUnpackG(xpi.fBlendedColor.fKnownColor)); 9171fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(255 == GrColorUnpackA(xpi.fBlendedColor.fKnownColor)); 9186fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kG_GrColorComponentFlag | 9191fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton kA_GrColorComponentFlag) == xpi.fBlendedColor.fKnownColorFlags); 9206fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags); 9216fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 9226fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 9236fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 9246fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 9256fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 9266fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 9276fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 9286fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDst_Mode: 9291fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 9301fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 9316fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kSkipDraw_OptFlag | 9326fd158ea47472c4d038e48980a95e36623f840c9cdalton kIgnoreColor_OptFlag | 9336fd158ea47472c4d038e48980a95e36623f840c9cdalton kIgnoreCoverage_OptFlag | 9346fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 9356fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); 9366fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 9376fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 9386fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 9396fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 9406fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); 9416fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 9426fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrcOver_Mode: 9431fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); 9441fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(82 == GrColorUnpackG(xpi.fBlendedColor.fKnownColor)); 9451fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(255 == GrColorUnpackA(xpi.fBlendedColor.fKnownColor)); 9466fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kG_GrColorComponentFlag | 9471fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton kA_GrColorComponentFlag) == xpi.fBlendedColor.fKnownColorFlags); 9486fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags); 9496fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 9506fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 9516fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 9526fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 9536fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 9546fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 9556fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 9566fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDstOver_Mode: 9571fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 9581fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 9596fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag | 9606fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 9616fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 9626fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 9636fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 9646fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 9656fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 9666fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 9676fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 9686fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrcIn_Mode: 9691fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 9701fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 9716fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags); 9726fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 9736fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 9746fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 9756fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 9766fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 9776fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 9786fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 9796fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDstIn_Mode: 9801fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 9811fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 9826fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kSkipDraw_OptFlag | 9836fd158ea47472c4d038e48980a95e36623f840c9cdalton kIgnoreColor_OptFlag | 9846fd158ea47472c4d038e48980a95e36623f840c9cdalton kIgnoreCoverage_OptFlag | 9856fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 9866fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); 9876fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 9886fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 9896fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 9906fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 9916fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); 9926fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 9936fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrcOut_Mode: 9941fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 9951fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 9966fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags); 9976fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 9986fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 9996fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 10006fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 10016fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 10026fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 10036fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 10046fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDstOut_Mode: 10051fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); 10061fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor); 10071fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 10086fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreColor_OptFlag | 10096fd158ea47472c4d038e48980a95e36623f840c9cdalton kIgnoreCoverage_OptFlag) == xpi.fOptFlags); 10106fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); 10116fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 10126fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 10136fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 10146fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 10156fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 10166fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 10176fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kSrcATop_Mode: 10181fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 10191fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 10206fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags); 10216fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 10226fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 10236fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 10246fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 10256fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 10266fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 10276fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 10286fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kDstATop_Mode: 10291fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 10301fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 10316fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag | 10326fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 10336fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 10346fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 10356fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 10366fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 10376fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 10386fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 10396fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 10406fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kXor_Mode: 10411fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 10421fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 10436fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags); 10446fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 10456fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 10466fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 10476fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 10486fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 10496fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 10506fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 10516fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kPlus_Mode: 10521fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 10531fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 10546fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag | 10556fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 10566fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 10576fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 10586fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 10596fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 10606fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 10616fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 10626fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 10636fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kModulate_Mode: 10641fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 10651fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 10666fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags); 10676fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 10686fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 10696fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 10706fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 10716fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kSC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 10726fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 10736fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 10746fd158ea47472c4d038e48980a95e36623f840c9cdalton case SkXfermode::kScreen_Mode: 10751fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); 10761fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); 10776fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT((kIgnoreCoverage_OptFlag | 10786fd158ea47472c4d038e48980a95e36623f840c9cdalton kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); 10796fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); 10806fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); 10816fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); 10826fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); 10836fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(kISC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); 10846fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(xpi.fBlendInfo.fWriteColor); 10856fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 10866fd158ea47472c4d038e48980a95e36623f840c9cdalton default: 10876fd158ea47472c4d038e48980a95e36623f840c9cdalton ERRORF(reporter, "Invalid xfermode."); 10886fd158ea47472c4d038e48980a95e36623f840c9cdalton break; 10896fd158ea47472c4d038e48980a95e36623f840c9cdalton } 10906fd158ea47472c4d038e48980a95e36623f840c9cdalton } 10916fd158ea47472c4d038e48980a95e36623f840c9cdalton} 10926fd158ea47472c4d038e48980a95e36623f840c9cdalton 1093723b0501e22373bb3e6c306daaceae02cda8a124egdanielstatic void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const GrCaps& caps) { 10941b55a963a2374a14bb82eb887bb99ee91680f0ebreed class TestLCDCoverageBatch: public GrVertexBatch { 10951b55a963a2374a14bb82eb887bb99ee91680f0ebreed public: 10961b55a963a2374a14bb82eb887bb99ee91680f0ebreed DEFINE_BATCH_CLASS_ID 10971b55a963a2374a14bb82eb887bb99ee91680f0ebreed 10981b55a963a2374a14bb82eb887bb99ee91680f0ebreed TestLCDCoverageBatch() : INHERITED(ClassID()) {} 10991b55a963a2374a14bb82eb887bb99ee91680f0ebreed 11001b55a963a2374a14bb82eb887bb99ee91680f0ebreed private: 1101ff2103200bad7abcf8929ae22ac78a9f4f725142ethannicholas void computePipelineOptimizations(GrInitInvariantOutput* color, 1102ff2103200bad7abcf8929ae22ac78a9f4f725142ethannicholas GrInitInvariantOutput* coverage, 1103ff2103200bad7abcf8929ae22ac78a9f4f725142ethannicholas GrBatchToXPOverrides* overrides) const override { 1104ff2103200bad7abcf8929ae22ac78a9f4f725142ethannicholas color->setKnownFourComponents(GrColorPackRGBA(123, 45, 67, 221)); 1105ff2103200bad7abcf8929ae22ac78a9f4f725142ethannicholas coverage->setUnknownFourComponents(); 11062279325d539700ee3da29d6e874b3b3ce1dcf49cethannicholas coverage->setUsingLCDCoverage(); } 11076fd158ea47472c4d038e48980a95e36623f840c9cdalton 11086fd158ea47472c4d038e48980a95e36623f840c9cdalton const char* name() const override { return "Test LCD Text Batch"; } 1109ff2103200bad7abcf8929ae22ac78a9f4f725142ethannicholas void initBatchTracker(const GrXPOverridesForBatch&) override {} 1110cb02b38b2c48bfde333ce3c699dd0451e2d867fabsalomon bool onCombineIfPossible(GrBatch*, const GrCaps&) override { return false; } 1111144c3c8b7ff3ebc389b41211f3388fb24a7ff0c2joshualitt void onPrepareDraws(Target*) const override {}; 11126fd158ea47472c4d038e48980a95e36623f840c9cdalton 11131b55a963a2374a14bb82eb887bb99ee91680f0ebreed typedef GrVertexBatch INHERITED; 11146fd158ea47472c4d038e48980a95e36623f840c9cdalton } testLCDCoverageBatch; 11156fd158ea47472c4d038e48980a95e36623f840c9cdalton 1116ff2103200bad7abcf8929ae22ac78a9f4f725142ethannicholas GrPipelineOptimizations opts; 1117ff2103200bad7abcf8929ae22ac78a9f4f725142ethannicholas testLCDCoverageBatch.getPipelineOptimizations(&opts); 1118ff2103200bad7abcf8929ae22ac78a9f4f725142ethannicholas GrProcOptInfo colorPOI = opts.fColorPOI; 1119ff2103200bad7abcf8929ae22ac78a9f4f725142ethannicholas GrProcOptInfo covPOI = opts.fCoveragePOI; 11206fd158ea47472c4d038e48980a95e36623f840c9cdalton 11216fd158ea47472c4d038e48980a95e36623f840c9cdalton SkASSERT(kRGBA_GrColorComponentFlags == colorPOI.validFlags()); 11226fd158ea47472c4d038e48980a95e36623f840c9cdalton SkASSERT(covPOI.isFourChannelOutput()); 11236fd158ea47472c4d038e48980a95e36623f840c9cdalton 1124f234272cbdcbcd46be462317e75cd138999c9fe9egdaniel SkAutoTUnref<GrXPFactory> xpf(GrPorterDuffXPFactory::Create(SkXfermode::kSrcOver_Mode)); 1125de4166a3b45d859512e27e3257841f064d67549cethannicholas TEST_ASSERT(!xpf->willNeedDstTexture(caps, opts, false)); 11266fd158ea47472c4d038e48980a95e36623f840c9cdalton 112786ae0a9e465f157eaa263ef7515e10619946ff83cdalton SkAutoTUnref<GrXferProcessor> xp( 1128de4166a3b45d859512e27e3257841f064d67549cethannicholas xpf->createXferProcessor(opts, false, nullptr, caps)); 11296fd158ea47472c4d038e48980a95e36623f840c9cdalton if (!xp) { 11306fd158ea47472c4d038e48980a95e36623f840c9cdalton ERRORF(reporter, "Failed to create an XP with LCD coverage."); 11316fd158ea47472c4d038e48980a95e36623f840c9cdalton return; 11326fd158ea47472c4d038e48980a95e36623f840c9cdalton } 11336fd158ea47472c4d038e48980a95e36623f840c9cdalton 11341fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton GrXPFactory::InvariantBlendedColor blendedColor; 11351fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton xpf->getInvariantBlendedColor(colorPOI, &blendedColor); 11361fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(blendedColor.fWillBlendWithDst); 11371fa4572d1a32e9fbf102d7388efe5e44bef460f1cdalton TEST_ASSERT(kNone_GrColorComponentFlags == blendedColor.fKnownColorFlags); 11386fd158ea47472c4d038e48980a95e36623f840c9cdalton 11396fd158ea47472c4d038e48980a95e36623f840c9cdalton GrColor overrideColor; 1140de4166a3b45d859512e27e3257841f064d67549cethannicholas xp->getOptimizations(opts, false, &overrideColor, caps); 11416fd158ea47472c4d038e48980a95e36623f840c9cdalton 11426fd158ea47472c4d038e48980a95e36623f840c9cdalton GrXferProcessor::BlendInfo blendInfo; 11436fd158ea47472c4d038e48980a95e36623f840c9cdalton xp->getBlendInfo(&blendInfo); 11446fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(blendInfo.fWriteColor); 11456fd158ea47472c4d038e48980a95e36623f840c9cdalton} 11466fd158ea47472c4d038e48980a95e36623f840c9cdalton 11471530283c483cb88aa725bce50a6d193dd00ee570kkinnunenDEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, /*factory*/) { 11486fd158ea47472c4d038e48980a95e36623f840c9cdalton GrContextOptions opts; 11496fd158ea47472c4d038e48980a95e36623f840c9cdalton opts.fSuppressDualSourceBlending = true; 11501530283c483cb88aa725bce50a6d193dd00ee570kkinnunen GrContextFactory mockFactory(opts); 11511530283c483cb88aa725bce50a6d193dd00ee570kkinnunen GrContext* ctx = mockFactory.get(GrContextFactory::kNull_GLContextType); 11526fd158ea47472c4d038e48980a95e36623f840c9cdalton if (!ctx) { 11536fd158ea47472c4d038e48980a95e36623f840c9cdalton SkFAIL("Failed to create null context without ARB_blend_func_extended."); 11546fd158ea47472c4d038e48980a95e36623f840c9cdalton return; 11556fd158ea47472c4d038e48980a95e36623f840c9cdalton } 11566fd158ea47472c4d038e48980a95e36623f840c9cdalton 1157762286309545c8a1e4bbc05dcd1fe3085d2a1f47bsalomon const GrCaps& caps = *ctx->caps(); 11586fd158ea47472c4d038e48980a95e36623f840c9cdalton if (caps.shaderCaps()->dualSourceBlendingSupport()) { 11596fd158ea47472c4d038e48980a95e36623f840c9cdalton SkFAIL("Null context failed to honor request for no ARB_blend_func_extended."); 11606fd158ea47472c4d038e48980a95e36623f840c9cdalton return; 11616fd158ea47472c4d038e48980a95e36623f840c9cdalton } 11626fd158ea47472c4d038e48980a95e36623f840c9cdalton 1163091f60c2a0e4504c017b8a67ff96a0e829519b14bsalomon GrBackendObject backendTex = 11641530283c483cb88aa725bce50a6d193dd00ee570kkinnunen ctx->getGpu()->createTestingOnlyBackendTexture(nullptr, 100, 100, 11651530283c483cb88aa725bce50a6d193dd00ee570kkinnunen kRGBA_8888_GrPixelConfig); 11666fd158ea47472c4d038e48980a95e36623f840c9cdalton GrBackendTextureDesc fakeDesc; 11676fd158ea47472c4d038e48980a95e36623f840c9cdalton fakeDesc.fConfig = kRGBA_8888_GrPixelConfig; 11686fd158ea47472c4d038e48980a95e36623f840c9cdalton fakeDesc.fWidth = fakeDesc.fHeight = 100; 1169091f60c2a0e4504c017b8a67ff96a0e829519b14bsalomon fakeDesc.fTextureHandle = backendTex; 1170eae6200acbec2255ac00ab363ffbe16758ec9076bsalomon SkAutoTUnref<GrTexture> fakeTexture(ctx->textureProvider()->wrapBackendTexture(fakeDesc, 11716dc6f5f4a153d33ed91565cb3cd397a310a937d0bsalomon kBorrow_GrWrapOwnership)); 11726fd158ea47472c4d038e48980a95e36623f840c9cdalton GrXferProcessor::DstTexture fakeDstTexture; 11736fd158ea47472c4d038e48980a95e36623f840c9cdalton fakeDstTexture.setTexture(fakeTexture); 11746fd158ea47472c4d038e48980a95e36623f840c9cdalton 11756fd158ea47472c4d038e48980a95e36623f840c9cdalton static const GrColor testColors[] = { 11766fd158ea47472c4d038e48980a95e36623f840c9cdalton 0, 11776fd158ea47472c4d038e48980a95e36623f840c9cdalton GrColorPackRGBA(0, 82, 0, 255), 11786fd158ea47472c4d038e48980a95e36623f840c9cdalton GrColorPackA4(255) 11796fd158ea47472c4d038e48980a95e36623f840c9cdalton }; 11806fd158ea47472c4d038e48980a95e36623f840c9cdalton static const GrColorComponentFlags testColorFlags[] = { 11816fd158ea47472c4d038e48980a95e36623f840c9cdalton kNone_GrColorComponentFlags, 11826fd158ea47472c4d038e48980a95e36623f840c9cdalton kG_GrColorComponentFlag | kA_GrColorComponentFlag, 11836fd158ea47472c4d038e48980a95e36623f840c9cdalton kRGBA_GrColorComponentFlags 11846fd158ea47472c4d038e48980a95e36623f840c9cdalton }; 11856fd158ea47472c4d038e48980a95e36623f840c9cdalton GR_STATIC_ASSERT(SK_ARRAY_COUNT(testColors) == SK_ARRAY_COUNT(testColorFlags)); 11866fd158ea47472c4d038e48980a95e36623f840c9cdalton 11876fd158ea47472c4d038e48980a95e36623f840c9cdalton for (size_t c = 0; c < SK_ARRAY_COUNT(testColors); c++) { 1188de4166a3b45d859512e27e3257841f064d67549cethannicholas GrPipelineOptimizations optimizations; 1189de4166a3b45d859512e27e3257841f064d67549cethannicholas optimizations.fColorPOI.calcWithInitialValues(nullptr, 0, testColors[c], testColorFlags[c], 1190de4166a3b45d859512e27e3257841f064d67549cethannicholas false); 11916fd158ea47472c4d038e48980a95e36623f840c9cdalton for (int f = 0; f <= 1; f++) { 11926fd158ea47472c4d038e48980a95e36623f840c9cdalton if (!f) { 1193de4166a3b45d859512e27e3257841f064d67549cethannicholas optimizations.fCoveragePOI.calcWithInitialValues(nullptr, 0, 0, 1194de4166a3b45d859512e27e3257841f064d67549cethannicholas kNone_GrColorComponentFlags, true); 11956fd158ea47472c4d038e48980a95e36623f840c9cdalton } else { 1196de4166a3b45d859512e27e3257841f064d67549cethannicholas optimizations.fCoveragePOI.calcWithInitialValues(nullptr, 0, GrColorPackA4(255), 1197de4166a3b45d859512e27e3257841f064d67549cethannicholas kRGBA_GrColorComponentFlags, true); 11986fd158ea47472c4d038e48980a95e36623f840c9cdalton } 11996fd158ea47472c4d038e48980a95e36623f840c9cdalton for (int m = 0; m <= SkXfermode::kLastCoeffMode; m++) { 12006fd158ea47472c4d038e48980a95e36623f840c9cdalton SkXfermode::Mode xfermode = static_cast<SkXfermode::Mode>(m); 1201f234272cbdcbcd46be462317e75cd138999c9fe9egdaniel SkAutoTUnref<GrXPFactory> xpf(GrPorterDuffXPFactory::Create(xfermode)); 120286ae0a9e465f157eaa263ef7515e10619946ff83cdalton GrXferProcessor::DstTexture* dstTexture = 1203de4166a3b45d859512e27e3257841f064d67549cethannicholas xpf->willNeedDstTexture(caps, optimizations, false) ? &fakeDstTexture : 0; 120486ae0a9e465f157eaa263ef7515e10619946ff83cdalton SkAutoTUnref<GrXferProcessor> xp( 1205de4166a3b45d859512e27e3257841f064d67549cethannicholas xpf->createXferProcessor(optimizations, false, dstTexture, caps)); 12066fd158ea47472c4d038e48980a95e36623f840c9cdalton if (!xp) { 12076fd158ea47472c4d038e48980a95e36623f840c9cdalton ERRORF(reporter, "Failed to create an XP without dual source blending."); 12086fd158ea47472c4d038e48980a95e36623f840c9cdalton return; 12096fd158ea47472c4d038e48980a95e36623f840c9cdalton } 12106fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(!xp->hasSecondaryOutput()); 1211de4166a3b45d859512e27e3257841f064d67549cethannicholas xp->getOptimizations(optimizations, false, 0, caps); 12126fd158ea47472c4d038e48980a95e36623f840c9cdalton TEST_ASSERT(!xp->hasSecondaryOutput()); 12136fd158ea47472c4d038e48980a95e36623f840c9cdalton } 12146fd158ea47472c4d038e48980a95e36623f840c9cdalton } 12156fd158ea47472c4d038e48980a95e36623f840c9cdalton } 1216091f60c2a0e4504c017b8a67ff96a0e829519b14bsalomon ctx->getGpu()->deleteTestingOnlyBackendTexture(backendTex); 12176fd158ea47472c4d038e48980a95e36623f840c9cdalton} 12186fd158ea47472c4d038e48980a95e36623f840c9cdalton 12196fd158ea47472c4d038e48980a95e36623f840c9cdalton#endif 12206fd158ea47472c4d038e48980a95e36623f840c9cdalton 1221