Split GrPipelineInput into separate color and coverage types, the latter of which is just an enum.

Assign names that indicate that they aren't just for the input phase since I plan to use them at the boundary between FPs and XPs as well.

Renamed GrProcOptInfo to GrColorFragmentProcessorAnalysis. This is now only used on the color side and the new name seems clearer to me.

Change GrMeshDrawOp::getFragmentProcessorAnalysisInputs to use the new color/coverage types directly rather than a class that has been reduced to simply bundling them together.

Change-Id: If93bae74c9d590486eecdf63f302418c96deab65
Reviewed-on: https://skia-review.googlesource.com/10161
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Brian Salomon 2017-03-27 13:09:36 -04:00 committed by Skia Commit-Bot
parent 88f9c1eff9
commit c0b642ca48
48 changed files with 298 additions and 325 deletions

View File

@ -134,8 +134,9 @@ skia_gpu_sources = [
"$_src/gpu/GrPreFlushResourceProvider.h", "$_src/gpu/GrPreFlushResourceProvider.h",
"$_src/gpu/GrPipeline.cpp", "$_src/gpu/GrPipeline.cpp",
"$_src/gpu/GrPipeline.h", "$_src/gpu/GrPipeline.h",
"$_src/gpu/GrPipelineAnalysis.cpp",
"$_src/gpu/GrPipelineAnalysis.h",
"$_src/gpu/GrPipelineBuilder.h", "$_src/gpu/GrPipelineBuilder.h",
"$_src/gpu/GrPipelineInput.h",
"$_src/gpu/GrPrimitiveProcessor.cpp", "$_src/gpu/GrPrimitiveProcessor.cpp",
"$_src/gpu/GrPrimitiveProcessor.h", "$_src/gpu/GrPrimitiveProcessor.h",
"$_src/gpu/GrProcessorSet.cpp", "$_src/gpu/GrProcessorSet.cpp",
@ -144,8 +145,6 @@ skia_gpu_sources = [
"$_src/gpu/GrProgramDesc.h", "$_src/gpu/GrProgramDesc.h",
"$_src/gpu/GrProcessor.cpp", "$_src/gpu/GrProcessor.cpp",
"$_src/gpu/GrProcessorUnitTest.cpp", "$_src/gpu/GrProcessorUnitTest.cpp",
"$_src/gpu/GrProcOptInfo.cpp",
"$_src/gpu/GrProcOptInfo.h",
"$_src/gpu/GrGpuResourceRef.cpp", "$_src/gpu/GrGpuResourceRef.cpp",
"$_src/gpu/GrQuad.h", "$_src/gpu/GrQuad.h",
"$_src/gpu/GrRect.h", "$_src/gpu/GrRect.h",

View File

@ -8,13 +8,13 @@
#include "GrFragmentProcessor.h" #include "GrFragmentProcessor.h"
#include "GrCoordTransform.h" #include "GrCoordTransform.h"
#include "GrPipeline.h" #include "GrPipeline.h"
#include "GrProcOptInfo.h" #include "GrPipelineAnalysis.h"
#include "effects/GrConstColorProcessor.h"
#include "effects/GrXfermodeFragmentProcessor.h"
#include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h" #include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLUniformHandler.h" #include "glsl/GrGLSLUniformHandler.h"
#include "effects/GrConstColorProcessor.h"
#include "effects/GrXfermodeFragmentProcessor.h"
GrFragmentProcessor::~GrFragmentProcessor() { GrFragmentProcessor::~GrFragmentProcessor() {
// If we got here then our ref count must have reached zero, so we will have converted refs // If we got here then our ref count must have reached zero, so we will have converted refs
@ -466,7 +466,7 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::RunInSeries(sk_sp<GrFragmentProc
return series[0]; return series[0];
} }
// Run the through the series, do the invariant output processing, and look for eliminations. // Run the through the series, do the invariant output processing, and look for eliminations.
GrProcOptInfo info; GrColorFragmentProcessorAnalysis info;
info.analyzeProcessors(sk_sp_address_as_pointer_address(series), cnt); info.analyzeProcessors(sk_sp_address_as_pointer_address(series), cnt);
SkTArray<sk_sp<GrFragmentProcessor>> replacementSeries; SkTArray<sk_sp<GrFragmentProcessor>> replacementSeries;
GrColor4f knownColor; GrColor4f knownColor;

View File

@ -6,7 +6,6 @@
*/ */
#include "GrPaint.h" #include "GrPaint.h"
#include "GrProcOptInfo.h"
#include "GrXferProcessor.h" #include "GrXferProcessor.h"
#include "effects/GrCoverageSetOpXP.h" #include "effects/GrCoverageSetOpXP.h"
#include "effects/GrPorterDuffXferProcessor.h" #include "effects/GrPorterDuffXferProcessor.h"

View File

@ -11,7 +11,6 @@
#include "GrCaps.h" #include "GrCaps.h"
#include "GrGpu.h" #include "GrGpu.h"
#include "GrPipelineBuilder.h" #include "GrPipelineBuilder.h"
#include "GrProcOptInfo.h"
#include "GrRenderTargetContext.h" #include "GrRenderTargetContext.h"
#include "GrRenderTargetOpList.h" #include "GrRenderTargetOpList.h"
#include "GrRenderTargetPriv.h" #include "GrRenderTargetPriv.h"

View File

@ -13,7 +13,6 @@
#include "GrNonAtomicRef.h" #include "GrNonAtomicRef.h"
#include "GrPendingProgramElement.h" #include "GrPendingProgramElement.h"
#include "GrPrimitiveProcessor.h" #include "GrPrimitiveProcessor.h"
#include "GrProcOptInfo.h"
#include "GrProcessorSet.h" #include "GrProcessorSet.h"
#include "GrProgramDesc.h" #include "GrProgramDesc.h"
#include "GrScissorState.h" #include "GrScissorState.h"

View File

@ -5,11 +5,12 @@
* found in the LICENSE file. * found in the LICENSE file.
*/ */
#include "GrProcOptInfo.h" #include "GrPipelineAnalysis.h"
#include "GrGeometryProcessor.h" #include "GrGeometryProcessor.h"
#include "ops/GrDrawOp.h" #include "ops/GrDrawOp.h"
void GrProcOptInfo::analyzeProcessors(const GrFragmentProcessor* const* processors, int cnt) { void GrColorFragmentProcessorAnalysis::analyzeProcessors(
const GrFragmentProcessor* const* processors, int cnt) {
for (int i = 0; i < cnt; ++i) { for (int i = 0; i < cnt; ++i) {
bool knowCurrentOutput = fProcessorsVisitedWithKnownOutput == fTotalProcessorsVisited; bool knowCurrentOutput = fProcessorsVisitedWithKnownOutput == fTotalProcessorsVisited;
if (fUsesLocalCoords && !knowCurrentOutput && if (fUsesLocalCoords && !knowCurrentOutput &&
@ -18,8 +19,8 @@ void GrProcOptInfo::analyzeProcessors(const GrFragmentProcessor* const* processo
return; return;
} }
const GrFragmentProcessor* fp = processors[i]; const GrFragmentProcessor* fp = processors[i];
if (knowCurrentOutput && fp->hasConstantOutputForConstantInput(fLastKnownOutputColor, if (knowCurrentOutput &&
&fLastKnownOutputColor)) { fp->hasConstantOutputForConstantInput(fLastKnownOutputColor, &fLastKnownOutputColor)) {
++fProcessorsVisitedWithKnownOutput; ++fProcessorsVisitedWithKnownOutput;
fIsOpaque = fLastKnownOutputColor.isOpaque(); fIsOpaque = fLastKnownOutputColor.isOpaque();
// We reset these since the caller is expected to not use the earlier fragment // We reset these since the caller is expected to not use the earlier fragment

View File

@ -5,27 +5,73 @@
* found in the LICENSE file. * found in the LICENSE file.
*/ */
#ifndef GrProcOptInfo_DEFINED #ifndef GrPipelineAnalysis_DEFINED
#define GrProcOptInfo_DEFINED #define GrPipelineAnalysis_DEFINED
#include "GrColor.h" #include "GrColor.h"
#include "GrPipelineInput.h"
class GrDrawOp; class GrDrawOp;
class GrFragmentProcessor; class GrFragmentProcessor;
class GrPrimitiveProcessor; class GrPrimitiveProcessor;
/** class GrPipelineAnalysisColor {
* GrProcOptInfo gathers invariant data from a set of processor stages.It is used to recognize
* optimizations related to eliminating stages and vertex attributes that aren't necessary for a
* draw.
*/
class GrProcOptInfo {
public: public:
GrProcOptInfo() = default; enum class Opaque {
kNo,
kYes,
};
GrProcOptInfo(const GrPipelineInput& input) : GrProcOptInfo() { GrPipelineAnalysisColor(Opaque opaque = Opaque::kNo)
fAllProcessorsCompatibleWithCoverageAsAlpha = !input.isLCDCoverage(); : fFlags(opaque == Opaque::kYes ? kIsOpaque_Flag : 0) {}
GrPipelineAnalysisColor(GrColor color) { this->setToConstant(color); }
void setToConstant(GrColor color) {
fColor = color;
if (GrColorIsOpaque(color)) {
fFlags = kColorIsKnown_Flag | kIsOpaque_Flag;
} else {
fFlags = kColorIsKnown_Flag;
}
}
void setToUnknown() { fFlags = 0; }
void setToUnknownOpaque() { fFlags = kIsOpaque_Flag; }
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,
};
uint32_t fFlags;
GrColor fColor;
};
enum class GrPipelineAnalysisCoverage { kNone, kSingleChannel, kLCD };
/**
* GrColorFragmentProcessorAnalysis gathers invariant data from a set of color fragment processor.
* It is used to recognize optimizations that can simplify the generated shader or make blending
* more effecient.
*/
class GrColorFragmentProcessorAnalysis {
public:
GrColorFragmentProcessorAnalysis() = default;
GrColorFragmentProcessorAnalysis(const GrPipelineAnalysisColor& input)
: GrColorFragmentProcessorAnalysis() {
fAllProcessorsCompatibleWithCoverageAsAlpha = true;
fIsOpaque = input.isOpaque(); fIsOpaque = input.isOpaque();
GrColor color; GrColor color;
if (input.isConstant(&color)) { if (input.isConstant(&color)) {
@ -34,7 +80,9 @@ public:
} }
} }
void reset(const GrPipelineInput& input) { *this = GrProcOptInfo(input); } void reset(const GrPipelineAnalysisColor& input) {
*this = GrColorFragmentProcessorAnalysis(input);
}
/** /**
* Runs through a series of processors and updates calculated values. This can be called * Runs through a series of processors and updates calculated values. This can be called
@ -80,14 +128,12 @@ public:
return SkTMax(0, fProcessorsVisitedWithKnownOutput); return SkTMax(0, fProcessorsVisitedWithKnownOutput);
} }
bool hasKnownOutputColor(GrColor* knownOutputColor = nullptr) const { GrPipelineAnalysisColor outputColor() const {
if (fProcessorsVisitedWithKnownOutput != fTotalProcessorsVisited) { if (fProcessorsVisitedWithKnownOutput != fTotalProcessorsVisited) {
return false; return GrPipelineAnalysisColor(fIsOpaque ? GrPipelineAnalysisColor::Opaque::kYes
: GrPipelineAnalysisColor::Opaque::kNo);
} }
if (knownOutputColor) { return GrPipelineAnalysisColor(fLastKnownOutputColor.toGrColor());
*knownOutputColor = fLastKnownOutputColor.toGrColor();
}
return true;
} }
private: private:

View File

@ -1,76 +0,0 @@
/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrPipelineInput_DEFINED
#define GrPipelineInput_DEFINED
#include "GrColor.h"
/**
* This describes the color or coverage input that will be seen by the first color or coverage stage
* of a GrPipeline. This is also the GrPrimitiveProcessor color or coverage *output*.
*/
struct GrPipelineInput {
enum class Opaque {
kNo,
kYes,
};
GrPipelineInput(Opaque opaque = Opaque::kNo)
: fFlags(opaque == Opaque::kYes ? kIsOpaque_Flag : 0) {}
GrPipelineInput(GrColor color) : fFlags(kColorIsKnown_Flag), fColor(color) {}
void setToConstant(GrColor color) {
fColor = color;
if (GrColorIsOpaque(color)) {
fFlags = kColorIsKnown_Flag | kIsOpaque_Flag;
} else {
fFlags = kColorIsKnown_Flag;
}
}
void setToUnknown() { fFlags = 0; }
void setToUnknownOpaque() { fFlags = kIsOpaque_Flag; }
void setToSolidCoverage() {
fColor = GrColor_WHITE;
fFlags = kColorIsKnown_Flag | kIsOpaque_Flag;
}
void setToScalar(uint8_t alpha) {
this->setToConstant(GrColorPackRGBA(alpha, alpha, alpha, alpha));
}
void setToLCDCoverage() { fFlags = kIsLCDCoverage_Flag; }
bool isLCDCoverage() const { return SkToBool(kIsLCDCoverage_Flag & fFlags); }
bool isOpaque() const { return SkToBool(kIsOpaque_Flag & fFlags); }
bool isSolidWhite() const { return (kColorIsKnown_Flag & fFlags) && GrColor_WHITE == fColor; }
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;
};
#endif

View File

@ -8,7 +8,7 @@
#include "GrProcessorSet.h" #include "GrProcessorSet.h"
#include "GrAppliedClip.h" #include "GrAppliedClip.h"
#include "GrCaps.h" #include "GrCaps.h"
#include "GrProcOptInfo.h" #include "GrPipelineAnalysis.h"
GrProcessorSet::GrProcessorSet(GrPaint&& paint) { GrProcessorSet::GrProcessorSet(GrPaint&& paint) {
fXPFactory = paint.fXPFactory; fXPFactory = paint.fXPFactory;
@ -80,13 +80,14 @@ bool GrProcessorSet::operator==(const GrProcessorSet& that) const {
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void GrProcessorSet::FragmentProcessorAnalysis::internalInit(const GrPipelineInput& colorInput, void GrProcessorSet::FragmentProcessorAnalysis::internalInit(
const GrPipelineInput coverageInput, const GrPipelineAnalysisColor& colorInput,
const GrProcessorSet& processors, const GrPipelineAnalysisCoverage coverageInput,
const GrFragmentProcessor* clipFP, const GrProcessorSet& processors,
const GrCaps& caps) { const GrFragmentProcessor* clipFP,
GrProcOptInfo colorInfo(colorInput); const GrCaps& caps) {
fCompatibleWithCoverageAsAlpha = !coverageInput.isLCDCoverage(); GrColorFragmentProcessorAnalysis colorInfo(colorInput);
fCompatibleWithCoverageAsAlpha = GrPipelineAnalysisCoverage::kLCD != coverageInput;
fValidInputColor = colorInput.isConstant(&fInputColor); fValidInputColor = colorInput.isConstant(&fInputColor);
const GrFragmentProcessor* const* fps = const GrFragmentProcessor* const* fps =
@ -115,27 +116,27 @@ void GrProcessorSet::FragmentProcessorAnalysis::internalInit(const GrPipelineInp
fInitialColorProcessorsToEliminate = colorInfo.initialProcessorsToEliminate(&fInputColor); fInitialColorProcessorsToEliminate = colorInfo.initialProcessorsToEliminate(&fInputColor);
fValidInputColor |= SkToBool(fInitialColorProcessorsToEliminate); fValidInputColor |= SkToBool(fInitialColorProcessorsToEliminate);
bool opaque = colorInfo.isOpaque(); GrPipelineAnalysisColor outputColor = colorInfo.outputColor();
if (colorInfo.hasKnownOutputColor(&fKnownOutputColor)) { if (outputColor.isConstant(&fKnownOutputColor)) {
fOutputColorType = static_cast<unsigned>(opaque ? ColorType::kOpaqueConstant fOutputColorType = static_cast<unsigned>(outputColor.isOpaque() ? ColorType::kOpaqueConstant
: ColorType::kConstant); : ColorType::kConstant);
} else if (opaque) { } else if (outputColor.isOpaque()) {
fOutputColorType = static_cast<unsigned>(ColorType::kOpaque); fOutputColorType = static_cast<unsigned>(ColorType::kOpaque);
} else { } else {
fOutputColorType = static_cast<unsigned>(ColorType::kUnknown); fOutputColorType = static_cast<unsigned>(ColorType::kUnknown);
} }
if (coverageInput.isLCDCoverage()) { if (GrPipelineAnalysisCoverage::kLCD == coverageInput) {
fOutputCoverageType = static_cast<unsigned>(CoverageType::kLCD); fOutputCoverageType = static_cast<unsigned>(GrPipelineAnalysisCoverage::kLCD);
} else if (hasCoverageFP || GrPipelineAnalysisCoverage::kSingleChannel == coverageInput) {
fOutputCoverageType = static_cast<unsigned>(GrPipelineAnalysisCoverage::kSingleChannel);
} else { } else {
fOutputCoverageType = hasCoverageFP || !coverageInput.isSolidWhite() fOutputCoverageType = static_cast<unsigned>(GrPipelineAnalysisCoverage::kNone);
? static_cast<unsigned>(CoverageType::kSingleChannel)
: static_cast<unsigned>(CoverageType::kNone);
} }
} }
void GrProcessorSet::FragmentProcessorAnalysis::init(const GrPipelineInput& colorInput, void GrProcessorSet::FragmentProcessorAnalysis::init(const GrPipelineAnalysisColor& colorInput,
const GrPipelineInput coverageInput, const GrPipelineAnalysisCoverage coverageInput,
const GrProcessorSet& processors, const GrProcessorSet& processors,
const GrAppliedClip* appliedClip, const GrAppliedClip* appliedClip,
const GrCaps& caps) { const GrCaps& caps) {
@ -146,16 +147,19 @@ void GrProcessorSet::FragmentProcessorAnalysis::init(const GrPipelineInput& colo
} }
GrProcessorSet::FragmentProcessorAnalysis::FragmentProcessorAnalysis( GrProcessorSet::FragmentProcessorAnalysis::FragmentProcessorAnalysis(
const GrPipelineInput& colorInput, const GrPipelineInput coverageInput, const GrCaps& caps) const GrPipelineAnalysisColor& colorInput,
const GrPipelineAnalysisCoverage coverageInput,
const GrCaps& caps)
: FragmentProcessorAnalysis() { : FragmentProcessorAnalysis() {
this->internalInit(colorInput, coverageInput, GrProcessorSet(GrPaint()), nullptr, caps); this->internalInit(colorInput, coverageInput, GrProcessorSet(GrPaint()), nullptr, caps);
} }
void GrProcessorSet::analyzeAndEliminateFragmentProcessors(FragmentProcessorAnalysis* analysis, void GrProcessorSet::analyzeAndEliminateFragmentProcessors(
const GrPipelineInput& colorInput, FragmentProcessorAnalysis* analysis,
const GrPipelineInput coverageInput, const GrPipelineAnalysisColor& colorInput,
const GrAppliedClip* clip, const GrPipelineAnalysisCoverage coverageInput,
const GrCaps& caps) { const GrAppliedClip* clip,
const GrCaps& caps) {
analysis->init(colorInput, coverageInput, *this, clip, caps); analysis->init(colorInput, coverageInput, *this, clip, caps);
if (analysis->fInitialColorProcessorsToEliminate > 0) { if (analysis->fInitialColorProcessorsToEliminate > 0) {
for (unsigned i = 0; i < analysis->fInitialColorProcessorsToEliminate; ++i) { for (unsigned i = 0; i < analysis->fInitialColorProcessorsToEliminate; ++i) {

View File

@ -10,7 +10,7 @@
#include "GrFragmentProcessor.h" #include "GrFragmentProcessor.h"
#include "GrPaint.h" #include "GrPaint.h"
#include "GrPipelineInput.h" #include "GrPipelineAnalysis.h"
#include "SkTemplates.h" #include "SkTemplates.h"
class GrAppliedClip; class GrAppliedClip;
@ -79,16 +79,16 @@ public:
: fIsInitializedWithProcessorSet(false) : fIsInitializedWithProcessorSet(false)
, fCompatibleWithCoverageAsAlpha(true) , fCompatibleWithCoverageAsAlpha(true)
, fValidInputColor(false) , fValidInputColor(false)
, fOutputCoverageType(static_cast<unsigned>(CoverageType::kNone)) , fOutputCoverageType(static_cast<unsigned>(GrPipelineAnalysisCoverage::kNone))
, fOutputColorType(static_cast<unsigned>(ColorType::kUnknown)) , fOutputColorType(static_cast<unsigned>(ColorType::kUnknown))
, fInitialColorProcessorsToEliminate(0) {} , fInitialColorProcessorsToEliminate(0) {}
// This version is used by a unit test that assumes no clip, no processors, and no PLS. // This version is used by a unit test that assumes no clip, no processors, and no PLS.
FragmentProcessorAnalysis(const GrPipelineInput& colorInput, FragmentProcessorAnalysis(const GrPipelineAnalysisColor&, GrPipelineAnalysisCoverage,
const GrPipelineInput coverageInput, const GrCaps&); const GrCaps&);
void init(const GrPipelineInput& colorInput, const GrPipelineInput coverageInput, void init(const GrPipelineAnalysisColor&, GrPipelineAnalysisCoverage, const GrProcessorSet&,
const GrProcessorSet&, const GrAppliedClip*, const GrCaps&); const GrAppliedClip*, const GrCaps&);
bool isInitializedWithProcessorSet() const { return fIsInitializedWithProcessorSet; } bool isInitializedWithProcessorSet() const { return fIsInitializedWithProcessorSet; }
@ -132,19 +132,19 @@ public:
} }
return constant; return constant;
} }
bool hasCoverage() const { return CoverageType::kNone != this->outputCoverageType(); } GrPipelineAnalysisCoverage outputCoverageType() const {
bool hasLCDCoverage() const { return CoverageType::kLCD == this->outputCoverageType(); } return static_cast<GrPipelineAnalysisCoverage>(fOutputCoverageType);
}
bool hasCoverage() const {
return this->outputCoverageType() != GrPipelineAnalysisCoverage::kNone;
}
private: private:
enum class ColorType : unsigned { kUnknown, kOpaqueConstant, kConstant, kOpaque }; enum class ColorType : unsigned { kUnknown, kOpaqueConstant, kConstant, kOpaque };
enum class CoverageType : unsigned { kNone, kSingleChannel, kLCD };
CoverageType outputCoverageType() const {
return static_cast<CoverageType>(fOutputCoverageType);
}
ColorType outputColorType() const { return static_cast<ColorType>(fOutputColorType); } ColorType outputColorType() const { return static_cast<ColorType>(fOutputColorType); }
void internalInit(const GrPipelineInput& colorInput, const GrPipelineInput coverageInput, void internalInit(const GrPipelineAnalysisColor&, const GrPipelineAnalysisCoverage,
const GrProcessorSet&, const GrFragmentProcessor* clipFP, const GrCaps&); const GrProcessorSet&, const GrFragmentProcessor* clipFP, const GrCaps&);
// MSVS 2015 won't pack a bool with an unsigned. // MSVS 2015 won't pack a bool with an unsigned.
@ -166,8 +166,8 @@ public:
GR_STATIC_ASSERT(sizeof(FragmentProcessorAnalysis) == 2 * sizeof(GrColor) + sizeof(uint32_t)); GR_STATIC_ASSERT(sizeof(FragmentProcessorAnalysis) == 2 * sizeof(GrColor) + sizeof(uint32_t));
void analyzeAndEliminateFragmentProcessors(FragmentProcessorAnalysis*, void analyzeAndEliminateFragmentProcessors(FragmentProcessorAnalysis*,
const GrPipelineInput& colorInput, const GrPipelineAnalysisColor& colorInput,
const GrPipelineInput coverageInput, const GrPipelineAnalysisCoverage coverageInput,
const GrAppliedClip*, const GrCaps&); const GrAppliedClip*, const GrCaps&);
private: private:

View File

@ -7,7 +7,6 @@
#include "GrXferProcessor.h" #include "GrXferProcessor.h"
#include "GrPipeline.h" #include "GrPipeline.h"
#include "GrProcOptInfo.h"
#include "gl/GrGLCaps.h" #include "gl/GrGLCaps.h"
GrXferProcessor::GrXferProcessor() GrXferProcessor::GrXferProcessor()

View File

@ -17,7 +17,6 @@
class GrShaderCaps; class GrShaderCaps;
class GrGLSLXferProcessor; class GrGLSLXferProcessor;
class GrProcOptInfo;
/** /**
* Barriers for blending. When a shader reads the dst directly, an Xfer barrier is sometimes * Barriers for blending. When a shader reads the dst directly, an Xfer barrier is sometimes

View File

@ -8,10 +8,9 @@
#include "effects/GrCoverageSetOpXP.h" #include "effects/GrCoverageSetOpXP.h"
#include "GrCaps.h" #include "GrCaps.h"
#include "GrColor.h" #include "GrColor.h"
#include "GrRenderTargetContext.h"
#include "GrPipeline.h" #include "GrPipeline.h"
#include "GrProcessor.h" #include "GrProcessor.h"
#include "GrProcOptInfo.h" #include "GrRenderTargetContext.h"
#include "glsl/GrGLSLBlend.h" #include "glsl/GrGLSLBlend.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLUniformHandler.h" #include "glsl/GrGLSLUniformHandler.h"

View File

@ -12,8 +12,6 @@
#include "GrXferProcessor.h" #include "GrXferProcessor.h"
#include "SkRegion.h" #include "SkRegion.h"
class GrProcOptInfo;
// See the comment above GrXPFactory's definition about this warning suppression. // See the comment above GrXPFactory's definition about this warning suppression.
#if defined(__GNUC__) || defined(__clang) #if defined(__GNUC__) || defined(__clang)
#pragma GCC diagnostic push #pragma GCC diagnostic push

View File

@ -52,12 +52,12 @@ static constexpr GrBlendEquation hw_blend_equation(SkBlendMode mode) {
#undef EQ_OFFSET #undef EQ_OFFSET
} }
static bool can_use_hw_blend_equation(GrBlendEquation equation, bool isLCDCoverage, static bool can_use_hw_blend_equation(GrBlendEquation equation, GrPipelineAnalysisCoverage coverage,
const GrCaps& caps) { const GrCaps& caps) {
if (!caps.advancedBlendEquationSupport()) { if (!caps.advancedBlendEquationSupport()) {
return false; return false;
} }
if (isLCDCoverage) { if (GrPipelineAnalysisCoverage::kLCD == coverage) {
return false; // LCD coverage must be applied after the blend equation. return false; // LCD coverage must be applied after the blend equation.
} }
if (caps.canUseAdvancedBlendEquation(equation)) { if (caps.canUseAdvancedBlendEquation(equation)) {
@ -347,7 +347,7 @@ GrXferProcessor* CustomXPFactory::onCreateXferProcessor(const GrCaps& caps,
bool hasMixedSamples, bool hasMixedSamples,
const DstTexture* dstTexture) const { const DstTexture* dstTexture) const {
SkASSERT(GrCustomXfermode::IsSupportedMode(fMode)); SkASSERT(GrCustomXfermode::IsSupportedMode(fMode));
if (can_use_hw_blend_equation(fHWBlendEquation, analysis.hasLCDCoverage(), caps)) { if (can_use_hw_blend_equation(fHWBlendEquation, analysis.outputCoverageType(), caps)) {
SkASSERT(!dstTexture || !dstTexture->texture()); SkASSERT(!dstTexture || !dstTexture->texture());
return new CustomXP(fMode, fHWBlendEquation); return new CustomXP(fMode, fHWBlendEquation);
} }
@ -356,7 +356,7 @@ GrXferProcessor* CustomXPFactory::onCreateXferProcessor(const GrCaps& caps,
bool CustomXPFactory::willReadDstInShader(const GrCaps& caps, bool CustomXPFactory::willReadDstInShader(const GrCaps& caps,
const FragmentProcessorAnalysis& analysis) const { const FragmentProcessorAnalysis& analysis) const {
return !can_use_hw_blend_equation(fHWBlendEquation, analysis.hasLCDCoverage(), caps); return !can_use_hw_blend_equation(fHWBlendEquation, analysis.outputCoverageType(), caps);
} }
GR_DEFINE_XP_FACTORY_TEST(CustomXPFactory); GR_DEFINE_XP_FACTORY_TEST(CustomXPFactory);

View File

@ -12,8 +12,6 @@
#include "GrXferProcessor.h" #include "GrXferProcessor.h"
#include "SkRefCnt.h" #include "SkRefCnt.h"
class GrProcOptInfo;
// See the comment above GrXPFactory's definition about this warning suppression. // See the comment above GrXPFactory's definition about this warning suppression.
#if defined(__GNUC__) || defined(__clang) #if defined(__GNUC__) || defined(__clang)
#pragma GCC diagnostic push #pragma GCC diagnostic push

View File

@ -10,8 +10,8 @@
#include "GrBlend.h" #include "GrBlend.h"
#include "GrCaps.h" #include "GrCaps.h"
#include "GrPipeline.h" #include "GrPipeline.h"
#include "GrPipelineAnalysis.h"
#include "GrProcessor.h" #include "GrProcessor.h"
#include "GrProcOptInfo.h"
#include "GrTypes.h" #include "GrTypes.h"
#include "GrXferProcessor.h" #include "GrXferProcessor.h"
#include "glsl/GrGLSLBlend.h" #include "glsl/GrGLSLBlend.h"
@ -19,7 +19,6 @@
#include "glsl/GrGLSLProgramDataManager.h" #include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLUniformHandler.h" #include "glsl/GrGLSLUniformHandler.h"
#include "glsl/GrGLSLXferProcessor.h" #include "glsl/GrGLSLXferProcessor.h"
#include <utility>
/** /**
* Wraps the shader outputs and HW blend state that comprise a Porter Duff blend mode with coverage. * Wraps the shader outputs and HW blend state that comprise a Porter Duff blend mode with coverage.
@ -736,7 +735,7 @@ GrXferProcessor* GrPorterDuffXPFactory::onCreateXferProcessor(
bool hasMixedSamples, bool hasMixedSamples,
const DstTexture* dstTexture) const { const DstTexture* dstTexture) const {
BlendFormula blendFormula; BlendFormula blendFormula;
if (analysis.hasLCDCoverage()) { if (analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kLCD) {
if (SkBlendMode::kSrcOver == fBlendMode && analysis.hasKnownOutputColor() && if (SkBlendMode::kSrcOver == fBlendMode && analysis.hasKnownOutputColor() &&
!caps.shaderCaps()->dualSourceBlendingSupport() && !caps.shaderCaps()->dualSourceBlendingSupport() &&
!caps.shaderCaps()->dstReadInShaderSupport()) { !caps.shaderCaps()->dstReadInShaderSupport()) {
@ -775,7 +774,7 @@ bool GrPorterDuffXPFactory::willReadDstInShader(const GrCaps& caps,
// When we have four channel coverage we always need to read the dst in order to correctly // When we have four channel coverage we always need to read the dst in order to correctly
// blend. The one exception is when we are using srcover mode and we know the input color into // blend. The one exception is when we are using srcover mode and we know the input color into
// the XP. // the XP.
if (analysis.hasLCDCoverage()) { if (analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kLCD) {
if (SkBlendMode::kSrcOver == fBlendMode && analysis.hasKnownOutputColor() && if (SkBlendMode::kSrcOver == fBlendMode && analysis.hasKnownOutputColor() &&
!caps.shaderCaps()->dstReadInShaderSupport()) { !caps.shaderCaps()->dstReadInShaderSupport()) {
return false; return false;
@ -838,7 +837,7 @@ GrXferProcessor* GrPorterDuffXPFactory::CreateSrcOverXferProcessor(
// doing lcd blending we will just use our global SimpleSrcOverXP. This slightly differs from // doing lcd blending we will just use our global SimpleSrcOverXP. This slightly differs from
// the general case where we convert a src-over blend that has solid coverage and an opaque // the general case where we convert a src-over blend that has solid coverage and an opaque
// color to src-mode, which allows disabling of blending. // color to src-mode, which allows disabling of blending.
if (!analysis.hasLCDCoverage()) { if (analysis.outputCoverageType() != GrPipelineAnalysisCoverage::kLCD) {
// We return nullptr here, which our caller interprets as meaning "use SimpleSrcOverXP". // We return nullptr here, which our caller interprets as meaning "use SimpleSrcOverXP".
// We don't simply return the address of that XP here because our caller would have to unref // We don't simply return the address of that XP here because our caller would have to unref
// it and since it is a global object and GrProgramElement's ref-cnting system is not thread // it and since it is a global object and GrProgramElement's ref-cnting system is not thread
@ -880,7 +879,7 @@ bool GrPorterDuffXPFactory::WillSrcOverNeedDstTexture(const GrCaps& caps,
// When we have four channel coverage we always need to read the dst in order to correctly // When we have four channel coverage we always need to read the dst in order to correctly
// blend. The one exception is when we are using srcover mode and we know the input color // blend. The one exception is when we are using srcover mode and we know the input color
// into the XP. // into the XP.
if (analysis.hasLCDCoverage()) { if (analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kLCD) {
if (analysis.hasKnownOutputColor() && !caps.shaderCaps()->dstReadInShaderSupport()) { if (analysis.hasKnownOutputColor() && !caps.shaderCaps()->dstReadInShaderSupport()) {
return false; return false;
} }

View File

@ -12,8 +12,6 @@
#include "GrXferProcessor.h" #include "GrXferProcessor.h"
#include "SkBlendMode.h" #include "SkBlendMode.h"
class GrProcOptInfo;
// See the comment above GrXPFactory's definition about this warning suppression. // See the comment above GrXPFactory's definition about this warning suppression.
#if defined(__GNUC__) || defined(__clang) #if defined(__GNUC__) || defined(__clang)
#pragma GCC diagnostic push #pragma GCC diagnostic push

View File

@ -334,12 +334,12 @@ void InstancedRendering::Op::appendParamsTexel(SkScalar x, SkScalar y, SkScalar
bool InstancedRendering::Op::xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip) { bool InstancedRendering::Op::xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip) {
GrProcessorSet::FragmentProcessorAnalysis analysis; GrProcessorSet::FragmentProcessorAnalysis analysis;
GrPipelineInput coverageInput; GrPipelineAnalysisCoverage coverageInput;
if (GrAAType::kCoverage == fInfo.aaType() || if (GrAAType::kCoverage == fInfo.aaType() ||
(GrAAType::kNone == fInfo.aaType() && !fInfo.isSimpleRects() && fInfo.fCannotDiscard)) { (GrAAType::kNone == fInfo.aaType() && !fInfo.isSimpleRects() && fInfo.fCannotDiscard)) {
coverageInput = GrPipelineInput(); coverageInput = GrPipelineAnalysisCoverage::kSingleChannel;
} else { } else {
coverageInput = GrColor_WHITE; coverageInput = GrPipelineAnalysisCoverage::kNone;
} }
fProcessors.analyzeAndEliminateFragmentProcessors(&analysis, this->getSingleInstance().fColor, fProcessors.analyzeAndEliminateFragmentProcessors(&analysis, this->getSingleInstance().fColor,
coverageInput, clip, caps); coverageInput, clip, caps);
@ -470,18 +470,18 @@ void InstancedRendering::Op::onExecute(GrOpFlushState* state) {
state->gpu()->handleDirtyContext(); state->gpu()->handleDirtyContext();
GrProcessorSet::FragmentProcessorAnalysis analysis; GrProcessorSet::FragmentProcessorAnalysis analysis;
GrPipelineInput coverageInput; GrPipelineAnalysisCoverage coverageInput;
if (GrAAType::kCoverage == fInfo.aaType() || if (GrAAType::kCoverage == fInfo.aaType() ||
(GrAAType::kNone == fInfo.aaType() && !fInfo.isSimpleRects() && fInfo.fCannotDiscard)) { (GrAAType::kNone == fInfo.aaType() && !fInfo.isSimpleRects() && fInfo.fCannotDiscard)) {
coverageInput = GrPipelineInput(); coverageInput = GrPipelineAnalysisCoverage::kSingleChannel;
} else { } else {
coverageInput = GrColor_WHITE; coverageInput = GrPipelineAnalysisCoverage::kNone;
} }
GrPipelineInput colorInput; GrPipelineAnalysisColor colorInput;
if (fDrawColorsAreSame) { if (fDrawColorsAreSame) {
colorInput = fHeadDraw->fInstance.fColor; colorInput = fHeadDraw->fInstance.fColor;
} else if (fDrawColorsAreOpaque) { } else if (fDrawColorsAreOpaque) {
colorInput = GrPipelineInput::Opaque::kYes; colorInput = GrPipelineAnalysisColor::Opaque::kYes;
} }
const GrAppliedClip* clip = state->drawOpArgs().fAppliedClip; const GrAppliedClip* clip = state->drawOpArgs().fAppliedClip;
analysis.init(colorInput, coverageInput, fProcessors, clip, state->caps()); analysis.init(colorInput, coverageInput, fProcessors, clip, state->caps());

View File

@ -747,9 +747,10 @@ private:
this->setTransformedBounds(path.getBounds(), viewMatrix, HasAABloat::kYes, IsZeroArea::kNo); this->setTransformedBounds(path.getBounds(), viewMatrix, HasAABloat::kYes, IsZeroArea::kNo);
} }
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToConstant(fColor);
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -203,9 +203,10 @@ public:
} }
private: private:
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(this->first()->color()); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToConstant(this->first()->color());
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void onPrepareDraws(Target* target) const override { void onPrepareDraws(Target* target) const override {

View File

@ -710,9 +710,10 @@ private:
IsZeroArea::kYes); IsZeroArea::kYes);
} }
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToConstant(fColor);
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -172,9 +172,10 @@ private:
this->setTransformedBounds(bounds, viewMatrix, HasAABloat::kYes, IsZeroArea::kNo); this->setTransformedBounds(bounds, viewMatrix, HasAABloat::kYes, IsZeroArea::kNo);
} }
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fPaths[0].fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToConstant(fPaths[0].fColor);
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -174,9 +174,10 @@ public:
private: private:
AAStrokeRectOp() : INHERITED(ClassID()) {} AAStrokeRectOp() : INHERITED(ClassID()) {}
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fRects[0].fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToConstant(fRects[0].fColor);
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations&) override; void applyPipelineOptimizations(const GrPipelineOptimizations&) override;
void onPrepareDraws(Target*) const override; void onPrepareDraws(Target*) const override;

View File

@ -269,9 +269,10 @@ public:
} }
private: private:
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fGeoData[0].fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToConstant(fGeoData[0].fColor);
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -46,24 +46,25 @@ SkString GrAtlasTextOp::dumpInfo() const {
return str; return str;
} }
void GrAtlasTextOp::getFragmentProcessorAnalysisInputs( void GrAtlasTextOp::getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
FragmentProcessorAnalysisInputs* input) const { GrPipelineAnalysisCoverage* coverage) const {
if (kColorBitmapMask_MaskType == fMaskType) { if (kColorBitmapMask_MaskType == fMaskType) {
input->colorInput()->setToUnknown(); color->setToUnknown();
} else { } else {
input->colorInput()->setToConstant(fColor); color->setToConstant(fColor);
} }
switch (fMaskType) { switch (fMaskType) {
case kGrayscaleDistanceField_MaskType: case kGrayscaleDistanceField_MaskType:
case kGrayscaleCoverageMask_MaskType: case kGrayscaleCoverageMask_MaskType:
input->coverageInput()->setToUnknown(); *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
break; break;
case kLCDCoverageMask_MaskType: case kLCDCoverageMask_MaskType:
case kLCDDistanceField_MaskType: case kLCDDistanceField_MaskType:
input->coverageInput()->setToLCDCoverage(); *coverage = GrPipelineAnalysisCoverage::kLCD;
break; break;
case kColorBitmapMask_MaskType: case kColorBitmapMask_MaskType:
input->coverageInput()->setToSolidCoverage(); *coverage = GrPipelineAnalysisCoverage::kNone;
break;
} }
} }

View File

@ -99,7 +99,8 @@ public:
SkString dumpInfo() const override; SkString dumpInfo() const override;
private: private:
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs*) const override; void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor*,
GrPipelineAnalysisCoverage*) const override;
void applyPipelineOptimizations(const GrPipelineOptimizations&) override; void applyPipelineOptimizations(const GrPipelineOptimizations&) override;
struct FlushInfo { struct FlushInfo {

View File

@ -296,9 +296,10 @@ private:
this->setTransformedBounds(bounds, combinedMatrix, aaBloat, zeroArea); this->setTransformedBounds(bounds, combinedMatrix, aaBloat, zeroArea);
} }
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToConstant(fColor);
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -132,9 +132,11 @@ private:
isHairline ? IsZeroArea::kYes : IsZeroArea::kNo); isHairline ? IsZeroArea::kYes : IsZeroArea::kNo);
} }
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToScalar(this->coverage()); color->setToConstant(fColor);
*coverage = this->coverage() == 0xff ? GrPipelineAnalysisCoverage::kNone
: GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -39,13 +39,14 @@ private:
GrDrawAtlasOp(GrColor color, const SkMatrix& viewMatrix, int spriteCount, GrDrawAtlasOp(GrColor color, const SkMatrix& viewMatrix, int spriteCount,
const SkRSXform* xforms, const SkRect* rects, const SkColor* colors); const SkRSXform* xforms, const SkRect* rects, const SkColor* colors);
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
GrPipelineAnalysisCoverage* coverage) const override {
if (this->hasColors()) { if (this->hasColors()) {
input->colorInput()->setToUnknown(); color->setToUnknown();
} else { } else {
input->colorInput()->setToConstant(fGeoData[0].fColor); color->setToConstant(fGeoData[0].fColor);
} }
input->coverageInput()->setToSolidCoverage(); *coverage = GrPipelineAnalysisCoverage::kNone;
} }
void onPrepareDraws(Target*) const override; void onPrepareDraws(Target*) const override;

View File

@ -43,8 +43,8 @@ protected:
GrPipelineOptimizations initPipeline(const GrOpFlushState&, GrPipeline*); GrPipelineOptimizations initPipeline(const GrOpFlushState&, GrPipeline*);
const GrProcessorSet::FragmentProcessorAnalysis& doFragmentProcessorAnalysis( const GrProcessorSet::FragmentProcessorAnalysis& doFragmentProcessorAnalysis(
const GrCaps& caps, const GrAppliedClip* clip) { const GrCaps& caps, const GrAppliedClip* clip) {
fProcessorSet.analyzeAndEliminateFragmentProcessors(&fAnalysis, fAnalysis.inputColor(), fProcessorSet.analyzeAndEliminateFragmentProcessors(
GrColor_WHITE, clip, caps); &fAnalysis, fAnalysis.inputColor(), GrPipelineAnalysisCoverage::kNone, clip, caps);
return fAnalysis; return fAnalysis;
} }
const GrProcessorSet::FragmentProcessorAnalysis& fragmentProcessorAnalysis() const { const GrProcessorSet::FragmentProcessorAnalysis& fragmentProcessorAnalysis() const {

View File

@ -75,13 +75,13 @@ GrDrawVerticesOp::GrDrawVerticesOp(sk_sp<SkVertices> vertices, GrPrimitiveType p
} }
void GrDrawVerticesOp::getFragmentProcessorAnalysisInputs( void GrDrawVerticesOp::getFragmentProcessorAnalysisInputs(
FragmentProcessorAnalysisInputs* input) const { GrPipelineAnalysisColor* color, GrPipelineAnalysisCoverage* coverage) const {
if (this->requiresPerVertexColors()) { if (this->requiresPerVertexColors()) {
input->colorInput()->setToUnknown(); color->setToUnknown();
} else { } else {
input->colorInput()->setToConstant(fMeshes[0].fColor); color->setToConstant(fMeshes[0].fColor);
} }
input->coverageInput()->setToSolidCoverage(); *coverage = GrPipelineAnalysisCoverage::kNone;
} }
void GrDrawVerticesOp::applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) { void GrDrawVerticesOp::applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) {

View File

@ -70,7 +70,8 @@ private:
GrRenderTargetContext::ColorArrayType, const SkMatrix& viewMatrix, GrRenderTargetContext::ColorArrayType, const SkMatrix& viewMatrix,
uint32_t flags = 0); uint32_t flags = 0);
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override; void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
GrPipelineAnalysisCoverage* coverage) const override;
void applyPipelineOptimizations(const GrPipelineOptimizations&) override; void applyPipelineOptimizations(const GrPipelineOptimizations&) override;
void onPrepareDraws(Target*) const override; void onPrepareDraws(Target*) const override;

View File

@ -61,9 +61,10 @@ public:
} }
private: private:
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToUnknown(); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToSolidCoverage(); color->setToUnknown();
*coverage = GrPipelineAnalysisCoverage::kNone;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& analysioptimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& analysioptimizations) override {

View File

@ -259,9 +259,10 @@ private:
this->setBounds(devBounds, HasAABloat::kNo, IsZeroArea::kNo); this->setBounds(devBounds, HasAABloat::kNo, IsZeroArea::kNo);
} }
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fPaths[0].fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToSolidCoverage(); color->setToConstant(fPaths[0].fColor);
*coverage = GrPipelineAnalysisCoverage::kNone;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -33,9 +33,10 @@ public:
const GrProcessorSet& processors, const GrProcessorSet& processors,
const GrAppliedClip* appliedClip, const GrAppliedClip* appliedClip,
const GrCaps& caps) const { const GrCaps& caps) const {
FragmentProcessorAnalysisInputs input; GrPipelineAnalysisColor inputColor;
this->getFragmentProcessorAnalysisInputs(&input); GrPipelineAnalysisCoverage inputCoverage;
analysis->init(*input.colorInput(), *input.coverageInput(), processors, appliedClip, caps); this->getFragmentProcessorAnalysisInputs(&inputColor, &inputCoverage);
analysis->init(inputColor, inputCoverage, processors, appliedClip, caps);
} }
void initPipeline(const GrPipeline::InitArgs& args) { void initPipeline(const GrPipeline::InitArgs& args) {
@ -98,27 +99,13 @@ protected:
return &fPipeline; return &fPipeline;
} }
/**
* This describes aspects of the GrPrimitiveProcessor produced by a GrDrawOp that are used in
* pipeline analysis.
*/
class FragmentProcessorAnalysisInputs {
public:
FragmentProcessorAnalysisInputs() = default;
GrPipelineInput* colorInput() { return &fColorInput; }
GrPipelineInput* coverageInput() { return &fCoverageInput; }
private:
GrPipelineInput fColorInput;
GrPipelineInput fCoverageInput;
};
private: private:
/** /**
* Provides information about the GrPrimitiveProccesor color and coverage outputs which become * Provides information about the GrPrimitiveProccesor color and coverage outputs which become
* inputs to the first color and coverage fragment processors. * inputs to the first color and coverage fragment processors.
*/ */
virtual void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs*) const = 0; virtual void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor*,
GrPipelineAnalysisCoverage*) const = 0;
/** /**
* After GrPipeline analysis is complete this is called so that the op can use the analysis * After GrPipeline analysis is complete this is called so that the op can use the analysis

View File

@ -110,9 +110,10 @@ public:
private: private:
NonAAFillRectOp() : INHERITED(ClassID()) {} NonAAFillRectOp() : INHERITED(ClassID()) {}
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fRects[0].fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToSolidCoverage(); color->setToConstant(fRects[0].fColor);
*coverage = GrPipelineAnalysisCoverage::kNone;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -130,9 +130,10 @@ public:
private: private:
NonAAFillRectPerspectiveOp() : INHERITED(ClassID()) {} NonAAFillRectPerspectiveOp() : INHERITED(ClassID()) {}
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fRects[0].fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToSolidCoverage(); color->setToConstant(fRects[0].fColor);
*coverage = GrPipelineAnalysisCoverage::kNone;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -102,9 +102,10 @@ public:
private: private:
NonAAStrokeRectOp() : INHERITED(ClassID()) {} NonAAStrokeRectOp() : INHERITED(ClassID()) {}
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToSolidCoverage(); color->setToConstant(fColor);
*coverage = GrPipelineAnalysisCoverage::kNone;
} }
void onPrepareDraws(Target* target) const override { void onPrepareDraws(Target* target) const override {

View File

@ -805,9 +805,10 @@ public:
private: private:
CircleOp() : INHERITED(ClassID()) {} CircleOp() : INHERITED(ClassID()) {}
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fGeoData[0].fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToConstant(fGeoData[0].fColor);
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
@ -1256,9 +1257,10 @@ public:
private: private:
EllipseOp() : INHERITED(ClassID()) {} EllipseOp() : INHERITED(ClassID()) {}
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fGeoData[0].fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToConstant(fGeoData[0].fColor);
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
@ -1470,9 +1472,10 @@ public:
private: private:
DIEllipseOp() : INHERITED(ClassID()) {} DIEllipseOp() : INHERITED(ClassID()) {}
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fGeoData[0].fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToConstant(fGeoData[0].fColor);
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
@ -1785,9 +1788,10 @@ public:
} }
private: private:
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fGeoData[0].fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToConstant(fGeoData[0].fColor);
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
@ -2148,9 +2152,10 @@ public:
private: private:
EllipticalRRectOp() : INHERITED(ClassID()) {} EllipticalRRectOp() : INHERITED(ClassID()) {}
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fGeoData[0].fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToConstant(fGeoData[0].fColor);
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -77,9 +77,10 @@ public:
} }
private: private:
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fRegions[0].fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToSolidCoverage(); color->setToConstant(fRegions[0].fColor);
*coverage = GrPipelineAnalysisCoverage::kNone;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -142,9 +142,10 @@ public:
private: private:
ShadowCircleOp() : INHERITED(ClassID()) {} ShadowCircleOp() : INHERITED(ClassID()) {}
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fCircles[0].fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToConstant(fCircles[0].fColor);
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
@ -562,9 +563,10 @@ public:
} }
private: private:
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fGeoData[0].fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToConstant(fGeoData[0].fColor);
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -199,9 +199,10 @@ private:
} }
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fShapes[0].fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToConstant(fShapes[0].fColor);
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -180,9 +180,10 @@ public:
} }
private: private:
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToConstant(fColor);
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -33,9 +33,10 @@ protected:
bool usesLocalCoords() const { return fUsesLocalCoords; } bool usesLocalCoords() const { return fUsesLocalCoords; }
private: private:
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(fColor); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToConstant(fColor);
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -93,13 +93,11 @@ public:
}; };
static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
GrPipelineInput lcdInput; GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineAnalysisColor(),
lcdInput.setToLCDCoverage(); GrPipelineAnalysisCoverage::kLCD, caps);
GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineInput(), lcdInput, caps);
SkASSERT(!analysis.isOutputColorOpaque()); SkASSERT(!analysis.isOutputColorOpaque());
SkASSERT(!analysis.hasKnownOutputColor()); SkASSERT(!analysis.hasKnownOutputColor());
SkASSERT(analysis.hasLCDCoverage()); SkASSERT(analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kLCD);
for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) { for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
SkBlendMode xfermode = static_cast<SkBlendMode>(m); SkBlendMode xfermode = static_cast<SkBlendMode>(m);
@ -263,12 +261,12 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
} }
} }
static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineInput(), GrPipelineInput(), caps); GrProcessorSet::FragmentProcessorAnalysis analysis(
GrPipelineAnalysisColor(), GrPipelineAnalysisCoverage::kSingleChannel, caps);
SkASSERT(!analysis.isOutputColorOpaque()); SkASSERT(!analysis.isOutputColorOpaque());
SkASSERT(!analysis.hasKnownOutputColor()); SkASSERT(!analysis.hasKnownOutputColor());
SkASSERT(!analysis.hasLCDCoverage()); SkASSERT(analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kSingleChannel);
SkASSERT(analysis.hasCoverage());
for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) { for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
SkBlendMode xfermode = static_cast<SkBlendMode>(m); SkBlendMode xfermode = static_cast<SkBlendMode>(m);
@ -434,7 +432,7 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
GrProcessorSet::FragmentProcessorAnalysis analysis(GrColorPackRGBA(229, 0, 154, 240), GrProcessorSet::FragmentProcessorAnalysis analysis(GrColorPackRGBA(229, 0, 154, 240),
GrColorPackA4(255), caps); GrPipelineAnalysisCoverage::kNone, caps);
SkASSERT(!analysis.isOutputColorOpaque()); SkASSERT(!analysis.isOutputColorOpaque());
SkASSERT(analysis.hasKnownOutputColor()); SkASSERT(analysis.hasKnownOutputColor());
@ -603,13 +601,13 @@ 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) { static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineInput::Opaque::kYes, GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineAnalysisColor::Opaque::kYes,
GrPipelineInput(), caps); GrPipelineAnalysisCoverage::kSingleChannel,
caps);
SkASSERT(analysis.isOutputColorOpaque()); SkASSERT(analysis.isOutputColorOpaque());
SkASSERT(!analysis.hasKnownOutputColor()); SkASSERT(!analysis.hasKnownOutputColor());
SkASSERT(analysis.hasCoverage()); SkASSERT(analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kSingleChannel);
SkASSERT(!analysis.hasLCDCoverage());
for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) { for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
SkBlendMode xfermode = static_cast<SkBlendMode>(m); SkBlendMode xfermode = static_cast<SkBlendMode>(m);
@ -775,8 +773,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) { static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineInput::Opaque::kYes, GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineAnalysisColor::Opaque::kYes,
GrColorPackA4(255), caps); GrPipelineAnalysisCoverage::kNone, caps);
SkASSERT(analysis.isOutputColorOpaque()); SkASSERT(analysis.isOutputColorOpaque());
SkASSERT(!analysis.hasKnownOutputColor()); SkASSERT(!analysis.hasKnownOutputColor());
@ -957,9 +955,10 @@ static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const
private: private:
void getFragmentProcessorAnalysisInputs( void getFragmentProcessorAnalysisInputs(
FragmentProcessorAnalysisInputs* input) const override { GrPipelineAnalysisColor* color,
input->colorInput()->setToConstant(GrColorPackRGBA(123, 45, 67, 221)); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToLCDCoverage(); color->setToConstant(GrColorPackRGBA(123, 45, 67, 221));
*coverage = GrPipelineAnalysisCoverage::kLCD;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations&) override {} void applyPipelineOptimizations(const GrPipelineOptimizations&) override {}
@ -973,7 +972,7 @@ static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const
testLCDCoverageOp.analyzeProcessors(&analysis, GrProcessorSet(GrPaint()), nullptr, caps); testLCDCoverageOp.analyzeProcessors(&analysis, GrProcessorSet(GrPaint()), nullptr, caps);
SkASSERT(analysis.hasKnownOutputColor()); SkASSERT(analysis.hasKnownOutputColor());
SkASSERT(analysis.hasLCDCoverage()); SkASSERT(analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kLCD);
const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(SkBlendMode::kSrcOver); const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(SkBlendMode::kSrcOver);
TEST_ASSERT(!GrXPFactory::WillNeedDstTexture(xpf, caps, analysis)); TEST_ASSERT(!GrXPFactory::WillNeedDstTexture(xpf, caps, analysis));
@ -1017,21 +1016,16 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, /*factory*/) {
fakeDstTexture.setTexture( fakeDstTexture.setTexture(
ctx->resourceProvider()->wrapBackendTexture(fakeDesc, kBorrow_GrWrapOwnership)); ctx->resourceProvider()->wrapBackendTexture(fakeDesc, kBorrow_GrWrapOwnership));
static const GrPipelineInput colorInputs[] = {GrPipelineInput(), static const GrPipelineAnalysisColor colorInputs[] = {
GrPipelineInput(GrPipelineInput::Opaque::kYes), GrPipelineAnalysisColor::Opaque::kNo, GrPipelineAnalysisColor::Opaque::kYes,
GrPipelineInput(GrColorPackRGBA(0, 82, 17, 100)), GrPipelineAnalysisColor(GrColorPackRGBA(0, 82, 17, 100)),
GrPipelineInput(GrColorPackRGBA(0, 82, 17, 255))}; GrPipelineAnalysisColor(GrColorPackRGBA(0, 82, 17, 255))};
for (const auto& colorInput : colorInputs) { for (const auto& colorInput : colorInputs) {
GrProcessorSet::FragmentProcessorAnalysis analysis; GrProcessorSet::FragmentProcessorAnalysis analysis;
for (bool fractionalCoverage : {true, false}) { for (GrPipelineAnalysisCoverage coverageType :
if (fractionalCoverage) { {GrPipelineAnalysisCoverage::kSingleChannel, GrPipelineAnalysisCoverage::kNone}) {
analysis = GrProcessorSet::FragmentProcessorAnalysis(colorInput, GrPipelineInput(), analysis = GrProcessorSet::FragmentProcessorAnalysis(colorInput, coverageType, caps);
caps);
} else {
analysis = GrProcessorSet::FragmentProcessorAnalysis(colorInput, GrColorPackA4(255),
caps);
}
for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) { for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
SkBlendMode xfermode = static_cast<SkBlendMode>(m); SkBlendMode xfermode = static_cast<SkBlendMode>(m);
const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(xfermode); const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(xfermode);

View File

@ -64,9 +64,10 @@ protected:
SkRect fRect; SkRect fRect;
private: private:
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToUnknown(); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToUnknown();
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override { void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {

View File

@ -40,9 +40,10 @@ private:
this->setBounds(SkRect::MakeWH(1.f, 1.f), HasAABloat::kNo, IsZeroArea::kNo); this->setBounds(SkRect::MakeWH(1.f, 1.f), HasAABloat::kNo, IsZeroArea::kNo);
} }
void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override { void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
input->colorInput()->setToUnknown(); GrPipelineAnalysisCoverage* coverage) const override {
input->coverageInput()->setToUnknown(); color->setToUnknown();
*coverage = GrPipelineAnalysisCoverage::kSingleChannel;
} }
void applyPipelineOptimizations(const GrPipelineOptimizations&) override {} void applyPipelineOptimizations(const GrPipelineOptimizations&) override {}