Remove component flags from GrPipelineInput.

We don't use these anywhere downstream except to check for opaqueness.

Change-Id: I897137135d69004ed45c0f4c1e7297183f49fc6d
Reviewed-on: https://skia-review.googlesource.com/8402
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Brian Salomon 2017-02-14 11:33:01 -05:00 committed by Skia Commit-Bot
parent 9a51498720
commit c6b7146eef
31 changed files with 148 additions and 150 deletions

View File

@ -351,7 +351,7 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::RunInSeries(sk_sp<GrFragmentProc
return series[0];
}
// Run the through the series, do the invariant output processing, and look for eliminations.
GrProcOptInfo info(0x0, kNone_GrColorComponentFlags);
GrProcOptInfo info;
info.analyzeProcessors(sk_sp_address_as_pointer_address(series), cnt);
SkTArray<sk_sp<GrFragmentProcessor>> replacementSeries;
GrColor4f knownColor;

View File

@ -76,7 +76,7 @@ void GrPaint::addCoverageTextureProcessor(GrContext* ctx, sk_sp<GrTextureProxy>
}
bool GrPaint::internalIsConstantBlendedColor(GrColor paintColor, GrColor* color) const {
GrProcOptInfo colorProcInfo(paintColor, kRGBA_GrColorComponentFlags);
GrProcOptInfo colorProcInfo((GrPipelineInput(paintColor)));
colorProcInfo.analyzeProcessors(
sk_sp_address_as_pointer_address(fColorFragmentProcessors.begin()),
this->numColorFragmentProcessors());

View File

@ -15,33 +15,60 @@
* of a GrPipeline. This is also the GrPrimitiveProcessor color or coverage *output*.
*/
struct GrPipelineInput {
GrPipelineInput()
: fValidFlags(kNone_GrColorComponentFlags), fColor(0), fIsLCDCoverage(false) {}
enum class Opaque {
kNo,
kYes,
};
void setKnownFourComponents(GrColor color) {
explicit GrPipelineInput(Opaque opaque = Opaque::kNo)
: fFlags(opaque == Opaque::kYes ? kIsOpaque_Flag : 0) {}
explicit GrPipelineInput(GrColor color) : fFlags(kColorIsKnown_Flag), fColor(color) {}
void setToConstant(GrColor color) {
fColor = color;
fValidFlags = kRGBA_GrColorComponentFlags;
if (GrColorIsOpaque(color)) {
fFlags = kColorIsKnown_Flag | kIsOpaque_Flag;
} else {
fFlags = kColorIsKnown_Flag;
}
}
void setUnknownFourComponents() { fValidFlags = kNone_GrColorComponentFlags; }
void setToUnknown() { fFlags = 0; }
void setUnknownOpaqueFourComponents() {
fColor = 0xffU << GrColor_SHIFT_A;
fValidFlags = kA_GrColorComponentFlag;
void setToUnknownOpaque() { fFlags = kIsOpaque_Flag; }
void setToSolidCoverage() {
fColor = GrColor_WHITE;
fFlags = kColorIsKnown_Flag | kColorIsKnown_Flag;
}
void setKnownSingleComponent(uint8_t alpha) {
fColor = GrColorPackRGBA(alpha, alpha, alpha, alpha);
fValidFlags = kRGBA_GrColorComponentFlags;
void setToScalar(uint8_t alpha) {
this->setToConstant(GrColorPackRGBA(alpha, alpha, alpha, alpha));
}
void setUnknownSingleComponent() { fValidFlags = kNone_GrColorComponentFlags; }
void setToLCDCoverage() { fFlags = kIsLCDCoverage_Flag; }
void setUsingLCDCoverage() { fIsLCDCoverage = true; }
bool isLCDCoverage() const { return SkToBool(kIsLCDCoverage_Flag & fFlags); }
GrColorComponentFlags fValidFlags;
bool isOpaque() const { return SkToBool(kIsOpaque_Flag & fFlags); }
bool isConstant(GrColor* color) const {
if (kColorIsKnown_Flag & fFlags) {
*color = fColor;
return true;
}
return false;
}
private:
enum Flags {
kColorIsKnown_Flag = 0x1,
kIsOpaque_Flag = 0x2,
kIsLCDCoverage_Flag = 0x4,
};
uint32_t fFlags;
GrColor fColor;
bool fIsLCDCoverage;
};
#endif

View File

@ -22,23 +22,24 @@ class GrPrimitiveProcessor;
*/
class GrProcOptInfo {
public:
GrProcOptInfo() { this->reset(0, kNone_GrColorComponentFlags); }
GrProcOptInfo() = default;
GrProcOptInfo(GrColor color, GrColorComponentFlags colorFlags) {
this->reset(color, colorFlags);
GrProcOptInfo(const GrPipelineInput& input) : GrProcOptInfo() {
fIsLCDCoverage = input.isLCDCoverage();
fIsOpaque = input.isOpaque();
GrColor color;
if (input.isConstant(&color)) {
fLastKnownOutputColor = GrColor4f::FromGrColor(color);
fProcessorsVisitedWithKnownOutput = 0;
}
}
void resetToLCDCoverage(GrColor color, GrColorComponentFlags colorFlags) {
this->internalReset(color, colorFlags, true);
void resetToLCDCoverage() {
*this = GrProcOptInfo();
fIsLCDCoverage = true;
}
void reset(GrColor color, GrColorComponentFlags colorFlags) {
this->internalReset(color, colorFlags, false);
}
void reset(const GrPipelineInput& input) {
this->internalReset(input.fColor, input.fValidFlags, input.fIsLCDCoverage);
}
void reset(const GrPipelineInput& input) { *this = GrProcOptInfo(input); }
/**
* Runs through a series of processors and updates calculated values. This can be called
@ -85,25 +86,12 @@ public:
}
private:
void internalReset(GrColor color, GrColorComponentFlags colorFlags, bool isLCDCoverage) {
fTotalProcessorsVisited = 0;
fIsLCDCoverage = isLCDCoverage;
fIsOpaque = (kA_GrColorComponentFlag & colorFlags) && GrColorIsOpaque(color);
fAllProcessorsModulatePremul = true;
if (kRGBA_GrColorComponentFlags == colorFlags) {
fProcessorsVisitedWithKnownOutput = 0;
fLastKnownOutputColor = GrColor4f::FromGrColor(color);
} else {
// -1 so that we know that even without adding processors that the color is not known.
fProcessorsVisitedWithKnownOutput = -1;
}
}
int fTotalProcessorsVisited;
int fProcessorsVisitedWithKnownOutput;
bool fIsLCDCoverage;
bool fIsOpaque;
bool fAllProcessorsModulatePremul;
int fTotalProcessorsVisited = 0;
// negative one means even the color is unknown before adding the first processor.
int fProcessorsVisitedWithKnownOutput = -1;
bool fIsLCDCoverage = false;
bool fIsOpaque = false;
bool fAllProcessorsModulatePremul = true;
GrColor4f fLastKnownOutputColor;
};

View File

@ -341,14 +341,14 @@ void InstancedRendering::Op::appendParamsTexel(SkScalar x, SkScalar y, SkScalar
}
void InstancedRendering::Op::getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const {
input->pipelineColorInput()->setKnownFourComponents(this->getSingleInstance().fColor);
input->pipelineColorInput()->setToConstant(this->getSingleInstance().fColor);
if (AntialiasMode::kCoverage == fInfo.fAntialiasMode ||
(AntialiasMode::kNone == fInfo.fAntialiasMode &&
!fInfo.isSimpleRects() && fInfo.fCannotDiscard)) {
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineCoverageInput()->setToUnknown();
} else {
input->pipelineCoverageInput()->setKnownSingleComponent(255);
input->pipelineCoverageInput()->setToSolidCoverage();
}
}

View File

@ -748,8 +748,8 @@ private:
}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(fColor);
input->pipelineCoverageInput()->setToUnknown();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -169,8 +169,8 @@ private:
}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fShapes[0].fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(fShapes[0].fColor);
input->pipelineCoverageInput()->setToUnknown();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -204,8 +204,8 @@ public:
private:
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(this->first()->color());
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(this->first()->color());
input->pipelineCoverageInput()->setToUnknown();
}
void onPrepareDraws(Target* target) const override {

View File

@ -717,8 +717,8 @@ private:
}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(fColor);
input->pipelineCoverageInput()->setToUnknown();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -173,8 +173,8 @@ private:
}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fPaths[0].fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(fPaths[0].fColor);
input->pipelineCoverageInput()->setToUnknown();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -167,8 +167,8 @@ private:
AAStrokeRectOp() : INHERITED(ClassID()) {}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fRects[0].fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(fRects[0].fColor);
input->pipelineCoverageInput()->setToUnknown();
}
void applyPipelineOptimizations(const GrPipelineOptimizations&) override;
void onPrepareDraws(Target*) const override;

View File

@ -270,8 +270,8 @@ public:
private:
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fGeoData[0].fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(fGeoData[0].fColor);
input->pipelineCoverageInput()->setToUnknown();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -47,22 +47,21 @@ SkString GrAtlasTextOp::dumpInfo() const {
void GrAtlasTextOp::getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const {
if (kColorBitmapMask_MaskType == fMaskType) {
input->pipelineColorInput()->setUnknownFourComponents();
input->pipelineColorInput()->setToUnknown();
} else {
input->pipelineColorInput()->setKnownFourComponents(fColor);
input->pipelineColorInput()->setToConstant(fColor);
}
switch (fMaskType) {
case kGrayscaleDistanceField_MaskType:
case kGrayscaleCoverageMask_MaskType:
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineCoverageInput()->setToUnknown();
break;
case kLCDCoverageMask_MaskType:
case kLCDDistanceField_MaskType:
input->pipelineCoverageInput()->setUnknownOpaqueFourComponents();
input->pipelineCoverageInput()->setUsingLCDCoverage();
input->pipelineCoverageInput()->setToLCDCoverage();
break;
case kColorBitmapMask_MaskType:
input->pipelineCoverageInput()->setKnownSingleComponent(0xff);
input->pipelineCoverageInput()->setToSolidCoverage();
}
}

View File

@ -297,8 +297,8 @@ private:
}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(fColor);
input->pipelineCoverageInput()->setToUnknown();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -133,8 +133,8 @@ private:
}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fColor);
input->pipelineCoverageInput()->setKnownSingleComponent(this->coverage());
input->pipelineColorInput()->setToConstant(fColor);
input->pipelineCoverageInput()->setToScalar(this->coverage());
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -41,11 +41,11 @@ private:
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
if (this->hasColors()) {
input->pipelineColorInput()->setUnknownFourComponents();
input->pipelineColorInput()->setToUnknown();
} else {
input->pipelineColorInput()->setKnownFourComponents(fGeoData[0].fColor);
input->pipelineColorInput()->setToConstant(fGeoData[0].fColor);
}
input->pipelineCoverageInput()->setKnownSingleComponent(0xff);
input->pipelineCoverageInput()->setToSolidCoverage();
}
void onPrepareDraws(Target*) const override;

View File

@ -37,8 +37,8 @@ protected:
private:
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fColor);
input->pipelineCoverageInput()->setKnownSingleComponent(0xFF);
input->pipelineColorInput()->setToConstant(fColor);
input->pipelineCoverageInput()->setToSolidCoverage();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -107,11 +107,11 @@ GrDrawVerticesOp::GrDrawVerticesOp(sk_sp<SkVertices> vertices, GrPrimitiveType p
void GrDrawVerticesOp::getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const {
if (this->requiresPerVertexColors()) {
input->pipelineColorInput()->setUnknownFourComponents();
input->pipelineColorInput()->setToUnknown();
} else {
input->pipelineColorInput()->setKnownFourComponents(fMeshes[0].fColor);
input->pipelineColorInput()->setToConstant(fMeshes[0].fColor);
}
input->pipelineCoverageInput()->setKnownSingleComponent(0xff);
input->pipelineCoverageInput()->setToSolidCoverage();
}
void GrDrawVerticesOp::applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) {

View File

@ -62,8 +62,8 @@ public:
private:
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setUnknownFourComponents();
input->pipelineCoverageInput()->setKnownSingleComponent(0xff);
input->pipelineColorInput()->setToUnknown();
input->pipelineCoverageInput()->setToSolidCoverage();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& analysioptimizations) override {

View File

@ -260,8 +260,8 @@ private:
}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fPaths[0].fColor);
input->pipelineCoverageInput()->setKnownSingleComponent(0xff);
input->pipelineColorInput()->setToConstant(fPaths[0].fColor);
input->pipelineCoverageInput()->setToSolidCoverage();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -111,8 +111,8 @@ private:
NonAAFillRectOp() : INHERITED(ClassID()) {}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fRects[0].fColor);
input->pipelineCoverageInput()->setKnownSingleComponent(0xff);
input->pipelineColorInput()->setToConstant(fRects[0].fColor);
input->pipelineCoverageInput()->setToSolidCoverage();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -131,8 +131,8 @@ private:
NonAAFillRectPerspectiveOp() : INHERITED(ClassID()) {}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fRects[0].fColor);
input->pipelineCoverageInput()->setKnownSingleComponent(0xff);
input->pipelineColorInput()->setToConstant(fRects[0].fColor);
input->pipelineCoverageInput()->setToSolidCoverage();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -103,8 +103,8 @@ private:
NonAAStrokeRectOp() : INHERITED(ClassID()) {}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fColor);
input->pipelineCoverageInput()->setKnownSingleComponent(0xFF);
input->pipelineColorInput()->setToConstant(fColor);
input->pipelineCoverageInput()->setToSolidCoverage();
}
void onPrepareDraws(Target* target) const override {

View File

@ -806,8 +806,8 @@ private:
CircleOp() : INHERITED(ClassID()) {}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fGeoData[0].fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(fGeoData[0].fColor);
input->pipelineCoverageInput()->setToUnknown();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
@ -1257,8 +1257,8 @@ private:
EllipseOp() : INHERITED(ClassID()) {}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fGeoData[0].fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(fGeoData[0].fColor);
input->pipelineCoverageInput()->setToUnknown();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
@ -1471,8 +1471,8 @@ private:
DIEllipseOp() : INHERITED(ClassID()) {}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fGeoData[0].fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(fGeoData[0].fColor);
input->pipelineCoverageInput()->setToUnknown();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
@ -1786,8 +1786,8 @@ public:
private:
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fGeoData[0].fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(fGeoData[0].fColor);
input->pipelineCoverageInput()->setToUnknown();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
@ -2148,8 +2148,8 @@ private:
EllipticalRRectOp() : INHERITED(ClassID()) {}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fGeoData[0].fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(fGeoData[0].fColor);
input->pipelineCoverageInput()->setToUnknown();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -782,8 +782,8 @@ private:
}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(fColor);
input->pipelineCoverageInput()->setToUnknown();
input->setUsesPLSDstRead();
}

View File

@ -78,8 +78,8 @@ public:
private:
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fRegions[0].fColor);
input->pipelineCoverageInput()->setKnownSingleComponent(0xff);
input->pipelineColorInput()->setToConstant(fRegions[0].fColor);
input->pipelineCoverageInput()->setToSolidCoverage();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -150,8 +150,8 @@ private:
ShadowCircleOp() : INHERITED(ClassID()) {}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fCircles[0].fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(fCircles[0].fColor);
input->pipelineCoverageInput()->setToUnknown();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
@ -584,8 +584,8 @@ public:
private:
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fGeoData[0].fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(fGeoData[0].fColor);
input->pipelineCoverageInput()->setToUnknown();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -181,8 +181,8 @@ public:
private:
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(fColor);
input->pipelineCoverageInput()->setToUnknown();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -34,8 +34,8 @@ protected:
private:
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToConstant(fColor);
input->pipelineCoverageInput()->setToUnknown();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -97,9 +97,8 @@ public:
static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
GrPipelineAnalysis analysis;
analysis.fColorPOI.reset(0, kNone_GrColorComponentFlags);
// Setting the last argument to true will force covPOI to LCD coverage.
analysis.fCoveragePOI.resetToLCDCoverage(0, kNone_GrColorComponentFlags);
analysis.fCoveragePOI.resetToLCDCoverage();
SkASSERT(!analysis.fColorPOI.isOpaque());
SkASSERT(!analysis.fColorPOI.isSolidWhite());
@ -286,8 +285,6 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
}
static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
GrPipelineAnalysis analysis;
analysis.fColorPOI.reset(0, kNone_GrColorComponentFlags);
analysis.fCoveragePOI.reset(0, kNone_GrColorComponentFlags);
SkASSERT(!analysis.fColorPOI.isOpaque());
SkASSERT(!analysis.fColorPOI.isSolidWhite());
@ -475,8 +472,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
GrPipelineAnalysis analysis;
analysis.fColorPOI.reset(GrColorPackRGBA(229, 0, 154, 240), kRGBA_GrColorComponentFlags);
analysis.fCoveragePOI.reset(GrColorPackA4(255), kRGBA_GrColorComponentFlags);
analysis.fColorPOI.reset(GrPipelineInput(GrColorPackRGBA(229, 0, 154, 240)));
analysis.fCoveragePOI.reset(GrPipelineInput(GrColorPackA4(255)));
SkASSERT(!analysis.fColorPOI.isOpaque());
SkASSERT(!analysis.fColorPOI.isSolidWhite());
@ -668,8 +665,7 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
GrPipelineAnalysis analysis;
analysis.fColorPOI.reset(GrColorPackA4(255), kA_GrColorComponentFlag);
analysis.fCoveragePOI.reset(0, kNone_GrColorComponentFlags);
analysis.fColorPOI.reset(GrPipelineInput(GrPipelineInput::Opaque::kYes));
SkASSERT(analysis.fColorPOI.isOpaque());
SkASSERT(!analysis.fColorPOI.isSolidWhite());
@ -860,9 +856,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
GrPipelineAnalysis analysis;
analysis.fColorPOI.reset(GrColorPackRGBA(0, 82, 0, 255),
kG_GrColorComponentFlag | kA_GrColorComponentFlag);
analysis.fCoveragePOI.reset(GrColorPackA4(255), kRGBA_GrColorComponentFlags);
analysis.fColorPOI.reset(GrPipelineInput(GrPipelineInput::Opaque::kYes));
analysis.fCoveragePOI.reset(GrPipelineInput(GrColorPackA4(255)));
SkASSERT(analysis.fColorPOI.isOpaque());
SkASSERT(!analysis.fColorPOI.isSolidWhite());
@ -888,7 +883,6 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
break;
case SkBlendMode::kSrc:
TEST_ASSERT(!xpi.fReadsDst);
// We don't really track per-component blended output anymore.
TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
@ -1065,9 +1059,8 @@ static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const
private:
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(GrColorPackRGBA(123, 45, 67, 221));
input->pipelineCoverageInput()->setUnknownFourComponents();
input->pipelineCoverageInput()->setUsingLCDCoverage();
input->pipelineColorInput()->setToConstant(GrColorPackRGBA(123, 45, 67, 221));
input->pipelineCoverageInput()->setToLCDCoverage();
}
void applyPipelineOptimizations(const GrPipelineOptimizations&) override {}
@ -1135,26 +1128,17 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, /*factory*/) {
fakeDstTexture.setTexture(
ctx->textureProvider()->wrapBackendTexture(fakeDesc, kBorrow_GrWrapOwnership));
static const GrColor testColors[] = {
0,
GrColorPackRGBA(0, 82, 0, 255),
GrColorPackA4(255)
};
static const GrColorComponentFlags testColorFlags[] = {
kNone_GrColorComponentFlags,
kG_GrColorComponentFlag | kA_GrColorComponentFlag,
kRGBA_GrColorComponentFlags
};
GR_STATIC_ASSERT(SK_ARRAY_COUNT(testColors) == SK_ARRAY_COUNT(testColorFlags));
static const GrPipelineInput colorInputs[] = {GrPipelineInput(),
GrPipelineInput(GrPipelineInput::Opaque::kYes),
GrPipelineInput(GrColorPackRGBA(0, 82, 17, 100)),
GrPipelineInput(GrColorPackRGBA(0, 82, 17, 255))};
for (size_t c = 0; c < SK_ARRAY_COUNT(testColors); c++) {
for (const auto& colorInput : colorInputs) {
GrPipelineAnalysis analysis;
analysis.fColorPOI.reset(testColors[c], testColorFlags[c]);
for (int f = 0; f <= 1; f++) {
if (!f) {
analysis.fCoveragePOI.reset(0, kNone_GrColorComponentFlags);
} else {
analysis.fCoveragePOI.reset(GrColorPackA4(255), kRGBA_GrColorComponentFlags);
analysis.fColorPOI = colorInput;
for (bool fractionalCoverage : {true, false}) {
if (!fractionalCoverage) {
analysis.fCoveragePOI.reset(GrPipelineInput(GrColorPackA4(255)));
}
for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
SkBlendMode xfermode = static_cast<SkBlendMode>(m);

View File

@ -41,8 +41,8 @@ private:
}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setUnknownFourComponents();
input->pipelineCoverageInput()->setUnknownSingleComponent();
input->pipelineColorInput()->setToUnknown();
input->pipelineCoverageInput()->setToUnknown();
}
void applyPipelineOptimizations(const GrPipelineOptimizations&) override {}