Flutter Engine
The Flutter Engine
Classes | Macros | Enumerations | Functions | Variables
GrPorterDuffTest.cpp File Reference
#include "include/core/SkBlendMode.h"
#include "include/core/SkColorType.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkTypes.h"
#include "include/gpu/GpuTypes.h"
#include "include/gpu/GrBackendSurface.h"
#include "include/gpu/GrContextOptions.h"
#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrTypes.h"
#include "include/gpu/mock/GrMockTypes.h"
#include "include/private/SkColorData.h"
#include "include/private/gpu/ganesh/GrTypesPriv.h"
#include "src/gpu/Blend.h"
#include "src/gpu/Swizzle.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrColor.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "src/gpu/ganesh/GrDstProxyView.h"
#include "src/gpu/ganesh/GrGpu.h"
#include "src/gpu/ganesh/GrPaint.h"
#include "src/gpu/ganesh/GrProcessorAnalysis.h"
#include "src/gpu/ganesh/GrProcessorSet.h"
#include "src/gpu/ganesh/GrProxyProvider.h"
#include "src/gpu/ganesh/GrShaderCaps.h"
#include "src/gpu/ganesh/GrSurfaceProxy.h"
#include "src/gpu/ganesh/GrUserStencilSettings.h"
#include "src/gpu/ganesh/GrXferProcessor.h"
#include "src/gpu/ganesh/effects/GrPorterDuffXferProcessor.h"
#include "tests/CtsEnforcement.h"
#include "tests/Test.h"
#include "tools/gpu/ContextType.h"
#include "tools/gpu/ManagedBackendTexture.h"
#include <initializer_list>
#include <utility>

Go to the source code of this file.

Classes

class  GrPorterDuffTest
 
struct  GrPorterDuffTest::XPInfo
 

Macros

#define TEST_ASSERT(...)   REPORTER_ASSERT(reporter, __VA_ARGS__)
 

Enumerations

enum  {
  kNone_OutputType , kCoverage_OutputType , kModulate_OutputType , kSAModulate_OutputType ,
  kISAModulate_OutputType , kISCModulate_OutputType
}
 

Functions

static void test_color_unknown_with_coverage (skiatest::Reporter *reporter, const GrCaps &caps)
 
static void test_color_not_opaque_no_coverage (skiatest::Reporter *reporter, const GrCaps &caps)
 
static void test_color_opaque_with_coverage (skiatest::Reporter *reporter, const GrCaps &caps)
 
static void test_color_opaque_no_coverage (skiatest::Reporter *reporter, const GrCaps &caps)
 
static void test_lcd_coverage (skiatest::Reporter *reporter, const GrCaps &caps)
 
static void test_lcd_coverage_fallback_case (skiatest::Reporter *reporter, const GrCaps &caps)
 
 DEF_GANESH_TEST (GrPorterDuff, reporter,, CtsEnforcement::kApiLevel_T)
 
static GrProcessorSet::Analysis do_analysis (const GrXPFactory *xpf, const GrProcessorAnalysisColor &colorInput, GrProcessorAnalysisCoverage coverageInput, const GrCaps &caps)
 
 DEF_GANESH_TEST (PorterDuffNoDualSourceBlending, reporter, options, CtsEnforcement::kApiLevel_T)
 

Variables

static const int kInvalid_OutputType = -1
 

Macro Definition Documentation

◆ TEST_ASSERT

#define TEST_ASSERT (   ...)    REPORTER_ASSERT(reporter, __VA_ARGS__)

Definition at line 75 of file GrPorterDuffTest.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kNone_OutputType 
kCoverage_OutputType 
kModulate_OutputType 
kSAModulate_OutputType 
kISAModulate_OutputType 
kISCModulate_OutputType 

Definition at line 77 of file GrPorterDuffTest.cpp.

Function Documentation

◆ DEF_GANESH_TEST() [1/2]

DEF_GANESH_TEST ( GrPorterDuff  ,
reporter  ,
CtsEnforcement::kApiLevel_T   
)

Definition at line 55 of file GrPorterDuffTest.cpp.

55 {
56 GrMockOptions mockOptions;
57 mockOptions.fDualSourceBlendingSupport = true;
59 const GrCaps& caps = *context->priv().getGpu()->caps();
60
62 SK_ABORT("Null context does not support dual source blending.");
63 }
64
71}
reporter
Definition: FontMgrTest.cpp:39
static void test_color_not_opaque_no_coverage(skiatest::Reporter *reporter, const GrCaps &caps)
static void test_color_opaque_no_coverage(skiatest::Reporter *reporter, const GrCaps &caps)
static void test_color_opaque_with_coverage(skiatest::Reporter *reporter, const GrCaps &caps)
static void test_color_unknown_with_coverage(skiatest::Reporter *reporter, const GrCaps &caps)
static void test_lcd_coverage_fallback_case(skiatest::Reporter *reporter, const GrCaps &caps)
static void test_lcd_coverage(skiatest::Reporter *reporter, const GrCaps &caps)
#define SK_ABORT(message,...)
Definition: SkAssert.h:70
Definition: GrCaps.h:57
const GrShaderCaps * shaderCaps() const
Definition: GrCaps.h:63
static sk_sp< GrDirectContext > MakeMock(const GrMockOptions *, const GrContextOptions &)
GrDirectContextPriv priv()
const GrCaps * caps() const
Definition: GrGpu.h:73
bool fDualSourceBlendingSupport
Definition: GrMockTypes.h:160
bool fDualSourceBlendingSupport
Definition: SkSLUtil.h:84

◆ DEF_GANESH_TEST() [2/2]

DEF_GANESH_TEST ( PorterDuffNoDualSourceBlending  ,
reporter  ,
options  ,
CtsEnforcement::kApiLevel_T   
)

Definition at line 1086 of file GrPorterDuffTest.cpp.

1086 {
1088 opts.fSuppressDualSourceBlending = true;
1089 sk_gpu_test::GrContextFactory mockFactory(opts);
1090 auto ctx = mockFactory.get(skgpu::ContextType::kMock);
1091 if (!ctx) {
1092 SK_ABORT("Failed to create mock context without ARB_blend_func_extended.");
1093 }
1094
1095 GrProxyProvider* proxyProvider = ctx->priv().proxyProvider();
1096 const GrCaps& caps = *ctx->priv().caps();
1098 SK_ABORT("Mock context failed to honor request for no ARB_blend_func_extended.");
1099 }
1100
1101 auto mbet = sk_gpu_test::ManagedBackendTexture::MakeWithoutData(
1103 if (!mbet) {
1104 ERRORF(reporter, "Could not make texture.");
1105 return;
1106 }
1107 GrDstProxyView fakeDstProxyView;
1108 {
1109 sk_sp<GrTextureProxy> proxy = proxyProvider->wrapBackendTexture(
1111 mbet->refCountedCallback());
1112 skgpu::Swizzle swizzle =
1113 caps.getReadSwizzle(mbet->texture().getBackendFormat(), GrColorType::kRGBA_8888);
1114 fakeDstProxyView.setProxyView({std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle});
1115 }
1116
1117 static const GrProcessorAnalysisColor colorInputs[] = {
1121
1122 for (const auto& colorInput : colorInputs) {
1123 for (GrProcessorAnalysisCoverage coverageType :
1125 for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
1126 SkBlendMode xfermode = static_cast<SkBlendMode>(m);
1127 const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(xfermode);
1129 GrXPFactory::MakeXferProcessor(xpf, colorInput, coverageType, caps,
1131 if (!xp) {
1132 ERRORF(reporter, "Failed to create an XP without dual source blending.");
1133 return;
1134 }
1135 TEST_ASSERT(!xp->hasSecondaryOutput());
1136 }
1137 }
1138 }
1139}
const char * options
static GrColor GrColorPackRGBA(unsigned r, unsigned g, unsigned b, unsigned a)
Definition: GrColor.h:46
#define TEST_ASSERT(...)
GrProcessorAnalysisCoverage
@ kRead_GrIOType
Definition: GrTypesPriv.h:403
@ kBorrow_GrWrapOwnership
Definition: GrTypesPriv.h:79
@ kTopLeft_GrSurfaceOrigin
Definition: GrTypes.h:148
SkBlendMode
Definition: SkBlendMode.h:38
@ kLastCoeffMode
last porter duff blend mode
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkColorType.h:24
#define ERRORF(r,...)
Definition: Test.h:293
skgpu::Swizzle getReadSwizzle(const GrBackendFormat &format, GrColorType colorType) const
Definition: GrCaps.cpp:443
void setProxyView(GrSurfaceProxyView view)
static const GrXPFactory * Get(SkBlendMode blendMode)
sk_sp< GrTextureProxy > wrapBackendTexture(const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable, GrIOType, sk_sp< skgpu::RefCntedCallback >=nullptr)
static sk_sp< const GrXferProcessor > MakeXferProcessor(const GrXPFactory *, const GrProcessorAnalysisColor &, GrProcessorAnalysisCoverage, const GrCaps &caps, GrClampType)
@ kMock
Dawn on OpenGL ES.
static SkRGBA4f FromBytes_RGBA(uint32_t color)

◆ do_analysis()

static GrProcessorSet::Analysis do_analysis ( const GrXPFactory xpf,
const GrProcessorAnalysisColor colorInput,
GrProcessorAnalysisCoverage  coverageInput,
const GrCaps caps 
)
static

Definition at line 87 of file GrPorterDuffTest.cpp.

90 {
92 paint.setXPFactory(xpf);
93 GrProcessorSet procs(std::move(paint));
94 SkPMColor4f overrideColor;
95 GrProcessorSet::Analysis analysis = procs.finalize(
96 colorInput, coverageInput, nullptr, &GrUserStencilSettings::kUnused, caps,
97 GrClampType::kAuto, &overrideColor);
98 return analysis;
99}
const Paint & paint
Definition: color_source.cc:38
static const GrUserStencilSettings & kUnused

◆ test_color_not_opaque_no_coverage()

static void test_color_not_opaque_no_coverage ( skiatest::Reporter reporter,
const GrCaps caps 
)
static

Definition at line 508 of file GrPorterDuffTest.cpp.

508 {
509 GrProcessorAnalysisColor inputColor(
512
513 for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
514 SkBlendMode xfermode = static_cast<SkBlendMode>(m);
515 const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, inputColor, inputCoverage);
516 switch (xfermode) {
518 TEST_ASSERT(xpi.fIgnoresInputColor);
519 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
520 TEST_ASSERT(xpi.fUnaffectedByDstValue);
521 TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
522 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
523 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
524 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
525 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
526 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
527 break;
529 TEST_ASSERT(!xpi.fIgnoresInputColor);
530 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
531 TEST_ASSERT(xpi.fUnaffectedByDstValue);
532 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
533 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
534 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
535 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
536 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
537 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
538 break;
540 TEST_ASSERT(xpi.fIgnoresInputColor);
541 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
542 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
543 TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
544 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
545 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
546 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
547 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
548 TEST_ASSERT(!xpi.fBlendInfo.fWritesColor);
549 break;
551 TEST_ASSERT(!xpi.fIgnoresInputColor);
552 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
553 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
554 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
555 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
556 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
557 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
558 TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
559 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
560 break;
562 TEST_ASSERT(!xpi.fIgnoresInputColor);
563 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
564 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
565 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
566 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
567 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
568 TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
569 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
570 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
571 break;
573 TEST_ASSERT(!xpi.fIgnoresInputColor);
574 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
575 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
576 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
577 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
578 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
579 TEST_ASSERT(skgpu::BlendCoeff::kDA == xpi.fBlendInfo.fSrcBlend);
580 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
581 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
582 break;
584 TEST_ASSERT(!xpi.fIgnoresInputColor);
585 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
586 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
587 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
588 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
589 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
590 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
591 TEST_ASSERT(skgpu::BlendCoeff::kSA == xpi.fBlendInfo.fDstBlend);
592 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
593 break;
595 TEST_ASSERT(!xpi.fIgnoresInputColor);
596 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
597 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
598 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
599 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
600 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
601 TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
602 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
603 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
604 break;
606 TEST_ASSERT(!xpi.fIgnoresInputColor);
607 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
608 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
609 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
610 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
611 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
612 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
613 TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
614 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
615 break;
617 TEST_ASSERT(!xpi.fIgnoresInputColor);
618 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
619 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
620 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
621 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
622 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
623 TEST_ASSERT(skgpu::BlendCoeff::kDA == xpi.fBlendInfo.fSrcBlend);
624 TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
625 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
626 break;
628 TEST_ASSERT(!xpi.fIgnoresInputColor);
629 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
630 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
631 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
632 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
633 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
634 TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
635 TEST_ASSERT(skgpu::BlendCoeff::kSA == xpi.fBlendInfo.fDstBlend);
636 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
637 break;
639 TEST_ASSERT(!xpi.fIgnoresInputColor);
640 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
641 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
642 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
643 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
644 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
645 TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
646 TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
647 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
648 break;
650 TEST_ASSERT(!xpi.fIgnoresInputColor);
651 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
652 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
653 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
654 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
655 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
656 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
657 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
658 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
659 break;
661 TEST_ASSERT(!xpi.fIgnoresInputColor);
662 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
663 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
664 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
665 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
666 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
667 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
668 TEST_ASSERT(skgpu::BlendCoeff::kSC == xpi.fBlendInfo.fDstBlend);
669 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
670 break;
672 TEST_ASSERT(!xpi.fIgnoresInputColor);
673 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
674 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
675 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
676 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
677 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
678 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
679 TEST_ASSERT(skgpu::BlendCoeff::kISC == xpi.fBlendInfo.fDstBlend);
680 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
681 break;
682 default:
683 ERRORF(reporter, "Invalid xfermode.");
684 break;
685 }
686 }
687}
@ kSrcOut
r = s * (1-da)
@ kPlus
r = min(s + d, 1)
@ kDstIn
r = d * sa
@ kModulate
r = s*d
@ kScreen
r = s + d - s*d
@ kSrcOver
r = s + (1-sa)*d
@ kXor
r = s*(1-da) + d*(1-sa)
@ kSrcATop
r = s*da + d*(1-sa)
@ kDstATop
r = d*sa + s*(1-da)
@ kDstOver
r = d + (1-da)*s
@ kDstOut
r = d * (1-sa)
@ kSrcIn
r = s * da
@ kClear
r = 0

◆ test_color_opaque_no_coverage()

static void test_color_opaque_no_coverage ( skiatest::Reporter reporter,
const GrCaps caps 
)
static

Definition at line 867 of file GrPorterDuffTest.cpp.

867 {
870
871 for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
872 SkBlendMode xfermode = static_cast<SkBlendMode>(m);
873 const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, inputColor, inputCoverage);
874
875 switch (xfermode) {
877 TEST_ASSERT(xpi.fIgnoresInputColor);
878 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
879 TEST_ASSERT(xpi.fUnaffectedByDstValue);
880 TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
881 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
882 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
883 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
884 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
885 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
886 break;
888 TEST_ASSERT(!xpi.fIgnoresInputColor);
889 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
890 TEST_ASSERT(xpi.fUnaffectedByDstValue);
891 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
892 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
893 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
894 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
895 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
896 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
897 break;
899 TEST_ASSERT(xpi.fIgnoresInputColor);
900 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
901 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
902 TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
903 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
904 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
905 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
906 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
907 TEST_ASSERT(!xpi.fBlendInfo.fWritesColor);
908 break;
910 // We don't specialize opaque src-over. See note in GrPorterDuffXferProcessor.cpp
911 TEST_ASSERT(!xpi.fIgnoresInputColor);
912 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
913 TEST_ASSERT(xpi.fUnaffectedByDstValue);
914 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
915 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
916 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
917 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
919 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
920 } else {
921 TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
922 }
923 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
924 break;
926 TEST_ASSERT(!xpi.fIgnoresInputColor);
927 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
928 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
929 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
930 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
931 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
932 TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
933 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
934 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
935 break;
937 TEST_ASSERT(!xpi.fIgnoresInputColor);
938 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
939 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
940 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
941 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
942 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
943 TEST_ASSERT(skgpu::BlendCoeff::kDA == xpi.fBlendInfo.fSrcBlend);
944 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
945 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
946 break;
948 TEST_ASSERT(xpi.fIgnoresInputColor);
949 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
950 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
951 TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
952 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
953 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
954 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
955 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
956 TEST_ASSERT(!xpi.fBlendInfo.fWritesColor);
957 break;
959 TEST_ASSERT(!xpi.fIgnoresInputColor);
960 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
961 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
962 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
963 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
964 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
965 TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
966 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
967 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
968 break;
970 TEST_ASSERT(xpi.fIgnoresInputColor);
971 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
972 TEST_ASSERT(xpi.fUnaffectedByDstValue);
973 TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
974 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
975 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
976 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
977 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
978 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
979 break;
981 TEST_ASSERT(!xpi.fIgnoresInputColor);
982 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
983 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
984 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
985 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
986 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
987 TEST_ASSERT(skgpu::BlendCoeff::kDA == xpi.fBlendInfo.fSrcBlend);
988 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
989 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
990 break;
992 TEST_ASSERT(!xpi.fIgnoresInputColor);
993 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
994 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
995 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
996 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
997 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
998 TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
999 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
1000 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
1001 break;
1002 case SkBlendMode::kXor:
1003 TEST_ASSERT(!xpi.fIgnoresInputColor);
1004 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
1005 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
1006 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
1007 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
1008 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
1009 TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
1010 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
1011 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
1012 break;
1013 case SkBlendMode::kPlus:
1014 TEST_ASSERT(!xpi.fIgnoresInputColor);
1015 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
1016 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
1017 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
1018 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
1019 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
1020 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
1021 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
1022 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
1023 break;
1025 TEST_ASSERT(!xpi.fIgnoresInputColor);
1026 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
1027 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
1028 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
1029 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
1030 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
1031 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
1032 TEST_ASSERT(skgpu::BlendCoeff::kSC == xpi.fBlendInfo.fDstBlend);
1033 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
1034 break;
1036 TEST_ASSERT(!xpi.fIgnoresInputColor);
1037 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
1038 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
1039 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
1040 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
1041 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
1042 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
1043 TEST_ASSERT(skgpu::BlendCoeff::kISC == xpi.fBlendInfo.fDstBlend);
1044 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
1045 break;
1046 default:
1047 ERRORF(reporter, "Invalid xfermode.");
1048 break;
1049 }
1050 }
1051}
bool shouldCollapseSrcOverToSrcWhenAble() const
Definition: GrCaps.h:179

◆ test_color_opaque_with_coverage()

static void test_color_opaque_with_coverage ( skiatest::Reporter reporter,
const GrCaps caps 
)
static

Definition at line 689 of file GrPorterDuffTest.cpp.

689 {
692
693 for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
694 SkBlendMode xfermode = static_cast<SkBlendMode>(m);
695 const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, inputColor, inputCoverage);
696 switch (xfermode) {
698 TEST_ASSERT(xpi.fIgnoresInputColor);
699 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
700 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
701 TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType);
702 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
703 TEST_ASSERT(skgpu::BlendEquation::kReverseSubtract == xpi.fBlendInfo.fEquation);
704 TEST_ASSERT(skgpu::BlendCoeff::kDC == xpi.fBlendInfo.fSrcBlend);
705 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
706 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
707 break;
709 TEST_ASSERT(!xpi.fIgnoresInputColor);
710 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
711 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
712 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
713 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
714 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
715 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
716 TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
717 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
718 break;
720 TEST_ASSERT(xpi.fIgnoresInputColor);
721 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
722 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
723 TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
724 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
725 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
726 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
727 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
728 TEST_ASSERT(!xpi.fBlendInfo.fWritesColor);
729 break;
731 TEST_ASSERT(!xpi.fIgnoresInputColor);
732 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
733 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
734 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
735 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
736 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
737 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
738 TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
739 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
740 break;
742 TEST_ASSERT(!xpi.fIgnoresInputColor);
743 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
744 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
745 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
746 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
747 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
748 TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
749 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
750 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
751 break;
753 TEST_ASSERT(!xpi.fIgnoresInputColor);
754 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
755 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
756 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
757 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
758 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
759 TEST_ASSERT(skgpu::BlendCoeff::kDA == xpi.fBlendInfo.fSrcBlend);
760 TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
761 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
762 break;
764 TEST_ASSERT(xpi.fIgnoresInputColor);
765 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
766 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
767 TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
768 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
769 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
770 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
771 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
772 TEST_ASSERT(!xpi.fBlendInfo.fWritesColor);
773 break;
775 TEST_ASSERT(!xpi.fIgnoresInputColor);
776 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
777 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
778 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
779 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
780 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
781 TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
782 TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
783 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
784 break;
786 TEST_ASSERT(xpi.fIgnoresInputColor);
787 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
788 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
789 TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType);
790 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
791 TEST_ASSERT(skgpu::BlendEquation::kReverseSubtract == xpi.fBlendInfo.fEquation);
792 TEST_ASSERT(skgpu::BlendCoeff::kDC == xpi.fBlendInfo.fSrcBlend);
793 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
794 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
795 break;
797 TEST_ASSERT(!xpi.fIgnoresInputColor);
798 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
799 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
800 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
801 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
802 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
803 TEST_ASSERT(skgpu::BlendCoeff::kDA == xpi.fBlendInfo.fSrcBlend);
804 TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
805 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
806 break;
808 TEST_ASSERT(!xpi.fIgnoresInputColor);
809 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
810 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
811 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
812 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
813 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
814 TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
815 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
816 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
817 break;
819 TEST_ASSERT(!xpi.fIgnoresInputColor);
820 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
821 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
822 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
823 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
824 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
825 TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
826 TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
827 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
828 break;
830 TEST_ASSERT(!xpi.fIgnoresInputColor);
831 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
832 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
833 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
834 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
835 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
836 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
837 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
838 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
839 break;
841 TEST_ASSERT(!xpi.fIgnoresInputColor);
842 TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType);
843 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
844 TEST_ASSERT(skgpu::BlendEquation::kReverseSubtract == xpi.fBlendInfo.fEquation);
845 TEST_ASSERT(skgpu::BlendCoeff::kDC == xpi.fBlendInfo.fSrcBlend);
846 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
847 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
848 break;
850 TEST_ASSERT(!xpi.fIgnoresInputColor);
851 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
852 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
853 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
854 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
855 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
856 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
857 TEST_ASSERT(skgpu::BlendCoeff::kISC == xpi.fBlendInfo.fDstBlend);
858 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
859 break;
860 default:
861 ERRORF(reporter, "Invalid xfermode.");
862 break;
863 }
864 }
865}

◆ test_color_unknown_with_coverage()

static void test_color_unknown_with_coverage ( skiatest::Reporter reporter,
const GrCaps caps 
)
static

Definition at line 328 of file GrPorterDuffTest.cpp.

328 {
331
332 for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
333 SkBlendMode xfermode = static_cast<SkBlendMode>(m);
334 const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, inputColor, inputCoverage);
335 switch (xfermode) {
337 TEST_ASSERT(xpi.fIgnoresInputColor);
338 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
339 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
340 TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType);
341 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
342 TEST_ASSERT(skgpu::BlendEquation::kReverseSubtract == xpi.fBlendInfo.fEquation);
343 TEST_ASSERT(skgpu::BlendCoeff::kDC == xpi.fBlendInfo.fSrcBlend);
344 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
345 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
346 break;
348 TEST_ASSERT(!xpi.fIgnoresInputColor);
349 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
350 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
351 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
352 TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
353 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
354 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
355 TEST_ASSERT(skgpu::BlendCoeff::kIS2A == xpi.fBlendInfo.fDstBlend);
356 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
357 break;
359 TEST_ASSERT(xpi.fIgnoresInputColor);
360 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
361 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
362 TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
363 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
364 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
365 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
366 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
367 TEST_ASSERT(!xpi.fBlendInfo.fWritesColor);
368 break;
370 TEST_ASSERT(!xpi.fIgnoresInputColor);
371 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
372 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
373 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
374 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
375 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
376 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
377 TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
378 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
379 break;
381 TEST_ASSERT(!xpi.fIgnoresInputColor);
382 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
383 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
384 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
385 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
386 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
387 TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
388 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
389 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
390 break;
392 TEST_ASSERT(!xpi.fIgnoresInputColor);
393 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
394 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
395 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
396 TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
397 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
398 TEST_ASSERT(skgpu::BlendCoeff::kDA == xpi.fBlendInfo.fSrcBlend);
399 TEST_ASSERT(skgpu::BlendCoeff::kIS2A == xpi.fBlendInfo.fDstBlend);
400 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
401 break;
403 TEST_ASSERT(!xpi.fIgnoresInputColor);
404 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
405 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
406 TEST_ASSERT(kISAModulate_OutputType == xpi.fPrimaryOutputType);
407 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
408 TEST_ASSERT(skgpu::BlendEquation::kReverseSubtract == xpi.fBlendInfo.fEquation);
409 TEST_ASSERT(skgpu::BlendCoeff::kDC == xpi.fBlendInfo.fSrcBlend);
410 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
411 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
412 break;
414 TEST_ASSERT(!xpi.fIgnoresInputColor);
415 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
416 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
417 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
418 TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
419 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
420 TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
421 TEST_ASSERT(skgpu::BlendCoeff::kIS2A == xpi.fBlendInfo.fDstBlend);
422 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
423 break;
425 TEST_ASSERT(!xpi.fIgnoresInputColor);
426 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
427 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
428 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
429 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
430 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
431 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
432 TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
433 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
434 break;
436 TEST_ASSERT(!xpi.fIgnoresInputColor);
437 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
438 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
439 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
440 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
441 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
442 TEST_ASSERT(skgpu::BlendCoeff::kDA == xpi.fBlendInfo.fSrcBlend);
443 TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
444 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
445 break;
447 TEST_ASSERT(!xpi.fIgnoresInputColor);
448 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
449 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
450 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
451 TEST_ASSERT(kISAModulate_OutputType == xpi.fSecondaryOutputType);
452 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
453 TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
454 TEST_ASSERT(skgpu::BlendCoeff::kIS2C == xpi.fBlendInfo.fDstBlend);
455 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
456 break;
458 TEST_ASSERT(!xpi.fIgnoresInputColor);
459 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
460 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
461 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
462 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
463 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
464 TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
465 TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
466 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
467 break;
469 TEST_ASSERT(!xpi.fIgnoresInputColor);
470 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
471 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
472 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
473 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
474 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
475 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
476 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
477 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
478 break;
480 TEST_ASSERT(!xpi.fIgnoresInputColor);
481 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
482 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
483 TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType);
484 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
485 TEST_ASSERT(skgpu::BlendEquation::kReverseSubtract == xpi.fBlendInfo.fEquation);
486 TEST_ASSERT(skgpu::BlendCoeff::kDC == xpi.fBlendInfo.fSrcBlend);
487 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
488 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
489 break;
491 TEST_ASSERT(!xpi.fIgnoresInputColor);
492 TEST_ASSERT(xpi.fCompatibleWithCoverageAsAlpha);
493 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
494 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
495 TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
496 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
497 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
498 TEST_ASSERT(skgpu::BlendCoeff::kISC == xpi.fBlendInfo.fDstBlend);
499 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
500 break;
501 default:
502 ERRORF(reporter, "Invalid xfermode.");
503 break;
504 }
505 }
506}

◆ test_lcd_coverage()

static void test_lcd_coverage ( skiatest::Reporter reporter,
const GrCaps caps 
)
static

Definition at line 149 of file GrPorterDuffTest.cpp.

149 {
152
153 for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
154 SkBlendMode xfermode = static_cast<SkBlendMode>(m);
155 const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, inputColor, inputCoverage);
156 switch (xfermode) {
158 TEST_ASSERT(xpi.fIgnoresInputColor);
159 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
160 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
161 TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
162 TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
163 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
164 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
165 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
166 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
167 break;
169 TEST_ASSERT(!xpi.fIgnoresInputColor);
170 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
171 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
172 TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
173 TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
174 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
175 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
176 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
177 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
178 break;
180 TEST_ASSERT(xpi.fIgnoresInputColor);
181 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
182 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
183 TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
184 TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
185 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
186 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
187 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
188 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
189 break;
191 TEST_ASSERT(!xpi.fIgnoresInputColor);
192 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
193 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
194 TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
195 TEST_ASSERT(kSAModulate_OutputType == xpi.fSecondaryOutputType);
196 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
197 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
198 TEST_ASSERT(skgpu::BlendCoeff::kIS2C == xpi.fBlendInfo.fDstBlend);
199 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
200 break;
202 TEST_ASSERT(!xpi.fIgnoresInputColor);
203 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
204 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
205 TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
206 TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
207 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
208 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
209 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
210 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
211 break;
213 TEST_ASSERT(!xpi.fIgnoresInputColor);
214 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
215 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
216 TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
217 TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
218 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
219 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
220 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
221 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
222 break;
224 TEST_ASSERT(!xpi.fIgnoresInputColor);
225 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
226 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
227 TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
228 TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
229 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
230 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
231 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
232 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
233 break;
235 TEST_ASSERT(!xpi.fIgnoresInputColor);
236 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
237 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
238 TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
239 TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
240 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
241 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
242 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
243 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
244 break;
246 TEST_ASSERT(!xpi.fIgnoresInputColor);
247 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
248 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
249 TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
250 TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
251 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
252 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
253 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
254 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
255 break;
257 TEST_ASSERT(!xpi.fIgnoresInputColor);
258 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
259 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
260 TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
261 TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
262 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
263 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
264 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
265 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
266 break;
268 TEST_ASSERT(!xpi.fIgnoresInputColor);
269 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
270 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
271 TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
272 TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
273 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
274 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
275 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
276 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
277 break;
279 TEST_ASSERT(!xpi.fIgnoresInputColor);
280 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
281 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
282 TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
283 TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
284 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
285 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
286 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
287 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
288 break;
290 TEST_ASSERT(!xpi.fIgnoresInputColor);
291 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
292 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
293 TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
294 TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
295 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
296 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
297 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
298 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
299 break;
301 TEST_ASSERT(!xpi.fIgnoresInputColor);
302 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
303 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
304 TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
305 TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
306 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
307 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
308 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
309 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
310 break;
312 TEST_ASSERT(!xpi.fIgnoresInputColor);
313 TEST_ASSERT(!xpi.fCompatibleWithCoverageAsAlpha);
314 TEST_ASSERT(!xpi.fUnaffectedByDstValue);
315 TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
316 TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
317 TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
318 TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
319 TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
320 TEST_ASSERT(xpi.fBlendInfo.fWritesColor);
321 break;
322 default:
323 ERRORF(reporter, "Invalid xfermode.");
324 break;
325 }
326 }
327}
static const int kInvalid_OutputType

◆ test_lcd_coverage_fallback_case()

static void test_lcd_coverage_fallback_case ( skiatest::Reporter reporter,
const GrCaps caps 
)
static

Definition at line 1053 of file GrPorterDuffTest.cpp.

1053 {
1054 constexpr GrClampType autoClamp = GrClampType::kAuto;
1061 GrXPFactory::MakeXferProcessor(xpf, color, coverage, caps, autoClamp));
1062 if (!xp_opaque) {
1063 ERRORF(reporter, "Failed to create an XP with LCD coverage.");
1064 return;
1065 }
1066
1067 skgpu::BlendInfo blendInfo = xp_opaque->getBlendInfo();
1068 TEST_ASSERT(blendInfo.fWritesColor);
1069
1070 // Test with non-opaque alpha
1076 GrXPFactory::MakeXferProcessor(xpf, color, coverage, caps, autoClamp));
1077 if (!xp) {
1078 ERRORF(reporter, "Failed to create an XP with LCD coverage.");
1079 return;
1080 }
1081
1082 blendInfo = xp->getBlendInfo();
1083 TEST_ASSERT(blendInfo.fWritesColor);
1084}
GrClampType
Definition: GrTypesPriv.h:228
static AnalysisProperties GetAnalysisProperties(const GrXPFactory *, const GrProcessorAnalysisColor &, const GrProcessorAnalysisCoverage &, const GrCaps &, GrClampType)
DlColor color
bool fWritesColor
Definition: Blend.h:98

Variable Documentation

◆ kInvalid_OutputType

const int kInvalid_OutputType = -1
static

Definition at line 85 of file GrPorterDuffTest.cpp.