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>
"$_src/gpu/GrPreFlushResourceProvider.h",
"$_src/gpu/GrPipeline.cpp",
"$_src/gpu/GrPipeline.h",
+ "$_src/gpu/GrPipelineAnalysis.cpp",
+ "$_src/gpu/GrPipelineAnalysis.h",
"$_src/gpu/GrPipelineBuilder.h",
- "$_src/gpu/GrPipelineInput.h",
"$_src/gpu/GrPrimitiveProcessor.cpp",
"$_src/gpu/GrPrimitiveProcessor.h",
"$_src/gpu/GrProcessorSet.cpp",
"$_src/gpu/GrProgramDesc.h",
"$_src/gpu/GrProcessor.cpp",
"$_src/gpu/GrProcessorUnitTest.cpp",
- "$_src/gpu/GrProcOptInfo.cpp",
- "$_src/gpu/GrProcOptInfo.h",
"$_src/gpu/GrGpuResourceRef.cpp",
"$_src/gpu/GrQuad.h",
"$_src/gpu/GrRect.h",
#include "GrFragmentProcessor.h"
#include "GrCoordTransform.h"
#include "GrPipeline.h"
-#include "GrProcOptInfo.h"
+#include "GrPipelineAnalysis.h"
+#include "effects/GrConstColorProcessor.h"
+#include "effects/GrXfermodeFragmentProcessor.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLUniformHandler.h"
-#include "effects/GrConstColorProcessor.h"
-#include "effects/GrXfermodeFragmentProcessor.h"
GrFragmentProcessor::~GrFragmentProcessor() {
// If we got here then our ref count must have reached zero, so we will have converted refs
return series[0];
}
// 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);
SkTArray<sk_sp<GrFragmentProcessor>> replacementSeries;
GrColor4f knownColor;
*/
#include "GrPaint.h"
-#include "GrProcOptInfo.h"
#include "GrXferProcessor.h"
#include "effects/GrCoverageSetOpXP.h"
#include "effects/GrPorterDuffXferProcessor.h"
#include "GrCaps.h"
#include "GrGpu.h"
#include "GrPipelineBuilder.h"
-#include "GrProcOptInfo.h"
#include "GrRenderTargetContext.h"
#include "GrRenderTargetOpList.h"
#include "GrRenderTargetPriv.h"
#include "GrNonAtomicRef.h"
#include "GrPendingProgramElement.h"
#include "GrPrimitiveProcessor.h"
-#include "GrProcOptInfo.h"
#include "GrProcessorSet.h"
#include "GrProgramDesc.h"
#include "GrScissorState.h"
* found in the LICENSE file.
*/
-#include "GrProcOptInfo.h"
+#include "GrPipelineAnalysis.h"
#include "GrGeometryProcessor.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) {
bool knowCurrentOutput = fProcessorsVisitedWithKnownOutput == fTotalProcessorsVisited;
if (fUsesLocalCoords && !knowCurrentOutput &&
return;
}
const GrFragmentProcessor* fp = processors[i];
- if (knowCurrentOutput && fp->hasConstantOutputForConstantInput(fLastKnownOutputColor,
- &fLastKnownOutputColor)) {
+ if (knowCurrentOutput &&
+ fp->hasConstantOutputForConstantInput(fLastKnownOutputColor, &fLastKnownOutputColor)) {
++fProcessorsVisitedWithKnownOutput;
fIsOpaque = fLastKnownOutputColor.isOpaque();
// We reset these since the caller is expected to not use the earlier fragment
* found in the LICENSE file.
*/
-#ifndef GrProcOptInfo_DEFINED
-#define GrProcOptInfo_DEFINED
+#ifndef GrPipelineAnalysis_DEFINED
+#define GrPipelineAnalysis_DEFINED
#include "GrColor.h"
-#include "GrPipelineInput.h"
class GrDrawOp;
class GrFragmentProcessor;
class GrPrimitiveProcessor;
+class GrPipelineAnalysisColor {
+public:
+ enum class Opaque {
+ kNo,
+ kYes,
+ };
+
+ GrPipelineAnalysisColor(Opaque opaque = Opaque::kNo)
+ : 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 };
+
/**
- * 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.
+ * 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 GrProcOptInfo {
+class GrColorFragmentProcessorAnalysis {
public:
- GrProcOptInfo() = default;
+ GrColorFragmentProcessorAnalysis() = default;
- GrProcOptInfo(const GrPipelineInput& input) : GrProcOptInfo() {
- fAllProcessorsCompatibleWithCoverageAsAlpha = !input.isLCDCoverage();
+ GrColorFragmentProcessorAnalysis(const GrPipelineAnalysisColor& input)
+ : GrColorFragmentProcessorAnalysis() {
+ fAllProcessorsCompatibleWithCoverageAsAlpha = true;
fIsOpaque = input.isOpaque();
GrColor color;
if (input.isConstant(&color)) {
}
}
- 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
return SkTMax(0, fProcessorsVisitedWithKnownOutput);
}
- bool hasKnownOutputColor(GrColor* knownOutputColor = nullptr) const {
+ GrPipelineAnalysisColor outputColor() const {
if (fProcessorsVisitedWithKnownOutput != fTotalProcessorsVisited) {
- return false;
- }
- if (knownOutputColor) {
- *knownOutputColor = fLastKnownOutputColor.toGrColor();
+ return GrPipelineAnalysisColor(fIsOpaque ? GrPipelineAnalysisColor::Opaque::kYes
+ : GrPipelineAnalysisColor::Opaque::kNo);
}
- return true;
+ return GrPipelineAnalysisColor(fLastKnownOutputColor.toGrColor());
}
private:
+++ /dev/null
-/*
- * 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
#include "GrProcessorSet.h"
#include "GrAppliedClip.h"
#include "GrCaps.h"
-#include "GrProcOptInfo.h"
+#include "GrPipelineAnalysis.h"
GrProcessorSet::GrProcessorSet(GrPaint&& paint) {
fXPFactory = paint.fXPFactory;
//////////////////////////////////////////////////////////////////////////////
-void GrProcessorSet::FragmentProcessorAnalysis::internalInit(const GrPipelineInput& colorInput,
- const GrPipelineInput coverageInput,
- const GrProcessorSet& processors,
- const GrFragmentProcessor* clipFP,
- const GrCaps& caps) {
- GrProcOptInfo colorInfo(colorInput);
- fCompatibleWithCoverageAsAlpha = !coverageInput.isLCDCoverage();
+void GrProcessorSet::FragmentProcessorAnalysis::internalInit(
+ const GrPipelineAnalysisColor& colorInput,
+ const GrPipelineAnalysisCoverage coverageInput,
+ const GrProcessorSet& processors,
+ const GrFragmentProcessor* clipFP,
+ const GrCaps& caps) {
+ GrColorFragmentProcessorAnalysis colorInfo(colorInput);
+ fCompatibleWithCoverageAsAlpha = GrPipelineAnalysisCoverage::kLCD != coverageInput;
fValidInputColor = colorInput.isConstant(&fInputColor);
const GrFragmentProcessor* const* fps =
fInitialColorProcessorsToEliminate = colorInfo.initialProcessorsToEliminate(&fInputColor);
fValidInputColor |= SkToBool(fInitialColorProcessorsToEliminate);
- bool opaque = colorInfo.isOpaque();
- if (colorInfo.hasKnownOutputColor(&fKnownOutputColor)) {
- fOutputColorType = static_cast<unsigned>(opaque ? ColorType::kOpaqueConstant
- : ColorType::kConstant);
- } else if (opaque) {
+ GrPipelineAnalysisColor outputColor = colorInfo.outputColor();
+ if (outputColor.isConstant(&fKnownOutputColor)) {
+ fOutputColorType = static_cast<unsigned>(outputColor.isOpaque() ? ColorType::kOpaqueConstant
+ : ColorType::kConstant);
+ } else if (outputColor.isOpaque()) {
fOutputColorType = static_cast<unsigned>(ColorType::kOpaque);
} else {
fOutputColorType = static_cast<unsigned>(ColorType::kUnknown);
}
- if (coverageInput.isLCDCoverage()) {
- fOutputCoverageType = static_cast<unsigned>(CoverageType::kLCD);
+ if (GrPipelineAnalysisCoverage::kLCD == coverageInput) {
+ fOutputCoverageType = static_cast<unsigned>(GrPipelineAnalysisCoverage::kLCD);
+ } else if (hasCoverageFP || GrPipelineAnalysisCoverage::kSingleChannel == coverageInput) {
+ fOutputCoverageType = static_cast<unsigned>(GrPipelineAnalysisCoverage::kSingleChannel);
} else {
- fOutputCoverageType = hasCoverageFP || !coverageInput.isSolidWhite()
- ? static_cast<unsigned>(CoverageType::kSingleChannel)
- : static_cast<unsigned>(CoverageType::kNone);
+ fOutputCoverageType = static_cast<unsigned>(GrPipelineAnalysisCoverage::kNone);
}
}
-void GrProcessorSet::FragmentProcessorAnalysis::init(const GrPipelineInput& colorInput,
- const GrPipelineInput coverageInput,
+void GrProcessorSet::FragmentProcessorAnalysis::init(const GrPipelineAnalysisColor& colorInput,
+ const GrPipelineAnalysisCoverage coverageInput,
const GrProcessorSet& processors,
const GrAppliedClip* appliedClip,
const GrCaps& caps) {
}
GrProcessorSet::FragmentProcessorAnalysis::FragmentProcessorAnalysis(
- const GrPipelineInput& colorInput, const GrPipelineInput coverageInput, const GrCaps& caps)
+ const GrPipelineAnalysisColor& colorInput,
+ const GrPipelineAnalysisCoverage coverageInput,
+ const GrCaps& caps)
: FragmentProcessorAnalysis() {
this->internalInit(colorInput, coverageInput, GrProcessorSet(GrPaint()), nullptr, caps);
}
-void GrProcessorSet::analyzeAndEliminateFragmentProcessors(FragmentProcessorAnalysis* analysis,
- const GrPipelineInput& colorInput,
- const GrPipelineInput coverageInput,
- const GrAppliedClip* clip,
- const GrCaps& caps) {
+void GrProcessorSet::analyzeAndEliminateFragmentProcessors(
+ FragmentProcessorAnalysis* analysis,
+ const GrPipelineAnalysisColor& colorInput,
+ const GrPipelineAnalysisCoverage coverageInput,
+ const GrAppliedClip* clip,
+ const GrCaps& caps) {
analysis->init(colorInput, coverageInput, *this, clip, caps);
if (analysis->fInitialColorProcessorsToEliminate > 0) {
for (unsigned i = 0; i < analysis->fInitialColorProcessorsToEliminate; ++i) {
#include "GrFragmentProcessor.h"
#include "GrPaint.h"
-#include "GrPipelineInput.h"
+#include "GrPipelineAnalysis.h"
#include "SkTemplates.h"
class GrAppliedClip;
: fIsInitializedWithProcessorSet(false)
, fCompatibleWithCoverageAsAlpha(true)
, fValidInputColor(false)
- , fOutputCoverageType(static_cast<unsigned>(CoverageType::kNone))
+ , fOutputCoverageType(static_cast<unsigned>(GrPipelineAnalysisCoverage::kNone))
, fOutputColorType(static_cast<unsigned>(ColorType::kUnknown))
, fInitialColorProcessorsToEliminate(0) {}
// This version is used by a unit test that assumes no clip, no processors, and no PLS.
- FragmentProcessorAnalysis(const GrPipelineInput& colorInput,
- const GrPipelineInput coverageInput, const GrCaps&);
+ FragmentProcessorAnalysis(const GrPipelineAnalysisColor&, GrPipelineAnalysisCoverage,
+ const GrCaps&);
- void init(const GrPipelineInput& colorInput, const GrPipelineInput coverageInput,
- const GrProcessorSet&, const GrAppliedClip*, const GrCaps&);
+ void init(const GrPipelineAnalysisColor&, GrPipelineAnalysisCoverage, const GrProcessorSet&,
+ const GrAppliedClip*, const GrCaps&);
bool isInitializedWithProcessorSet() const { return fIsInitializedWithProcessorSet; }
}
return constant;
}
- bool hasCoverage() const { return CoverageType::kNone != this->outputCoverageType(); }
- bool hasLCDCoverage() const { return CoverageType::kLCD == this->outputCoverageType(); }
+ GrPipelineAnalysisCoverage outputCoverageType() const {
+ return static_cast<GrPipelineAnalysisCoverage>(fOutputCoverageType);
+ }
+ bool hasCoverage() const {
+ return this->outputCoverageType() != GrPipelineAnalysisCoverage::kNone;
+ }
private:
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); }
- void internalInit(const GrPipelineInput& colorInput, const GrPipelineInput coverageInput,
+ void internalInit(const GrPipelineAnalysisColor&, const GrPipelineAnalysisCoverage,
const GrProcessorSet&, const GrFragmentProcessor* clipFP, const GrCaps&);
// MSVS 2015 won't pack a bool with an unsigned.
GR_STATIC_ASSERT(sizeof(FragmentProcessorAnalysis) == 2 * sizeof(GrColor) + sizeof(uint32_t));
void analyzeAndEliminateFragmentProcessors(FragmentProcessorAnalysis*,
- const GrPipelineInput& colorInput,
- const GrPipelineInput coverageInput,
+ const GrPipelineAnalysisColor& colorInput,
+ const GrPipelineAnalysisCoverage coverageInput,
const GrAppliedClip*, const GrCaps&);
private:
#include "GrXferProcessor.h"
#include "GrPipeline.h"
-#include "GrProcOptInfo.h"
#include "gl/GrGLCaps.h"
GrXferProcessor::GrXferProcessor()
class GrShaderCaps;
class GrGLSLXferProcessor;
-class GrProcOptInfo;
/**
* Barriers for blending. When a shader reads the dst directly, an Xfer barrier is sometimes
#include "effects/GrCoverageSetOpXP.h"
#include "GrCaps.h"
#include "GrColor.h"
-#include "GrRenderTargetContext.h"
#include "GrPipeline.h"
#include "GrProcessor.h"
-#include "GrProcOptInfo.h"
+#include "GrRenderTargetContext.h"
#include "glsl/GrGLSLBlend.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLUniformHandler.h"
#include "GrXferProcessor.h"
#include "SkRegion.h"
-class GrProcOptInfo;
-
// See the comment above GrXPFactory's definition about this warning suppression.
#if defined(__GNUC__) || defined(__clang)
#pragma GCC diagnostic push
#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) {
if (!caps.advancedBlendEquationSupport()) {
return false;
}
- if (isLCDCoverage) {
+ if (GrPipelineAnalysisCoverage::kLCD == coverage) {
return false; // LCD coverage must be applied after the blend equation.
}
if (caps.canUseAdvancedBlendEquation(equation)) {
bool hasMixedSamples,
const DstTexture* dstTexture) const {
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());
return new CustomXP(fMode, fHWBlendEquation);
}
bool CustomXPFactory::willReadDstInShader(const GrCaps& caps,
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);
#include "GrXferProcessor.h"
#include "SkRefCnt.h"
-class GrProcOptInfo;
-
// See the comment above GrXPFactory's definition about this warning suppression.
#if defined(__GNUC__) || defined(__clang)
#pragma GCC diagnostic push
#include "GrBlend.h"
#include "GrCaps.h"
#include "GrPipeline.h"
+#include "GrPipelineAnalysis.h"
#include "GrProcessor.h"
-#include "GrProcOptInfo.h"
#include "GrTypes.h"
#include "GrXferProcessor.h"
#include "glsl/GrGLSLBlend.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLUniformHandler.h"
#include "glsl/GrGLSLXferProcessor.h"
-#include <utility>
/**
* Wraps the shader outputs and HW blend state that comprise a Porter Duff blend mode with coverage.
bool hasMixedSamples,
const DstTexture* dstTexture) const {
BlendFormula blendFormula;
- if (analysis.hasLCDCoverage()) {
+ if (analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kLCD) {
if (SkBlendMode::kSrcOver == fBlendMode && analysis.hasKnownOutputColor() &&
!caps.shaderCaps()->dualSourceBlendingSupport() &&
!caps.shaderCaps()->dstReadInShaderSupport()) {
// 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
// the XP.
- if (analysis.hasLCDCoverage()) {
+ if (analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kLCD) {
if (SkBlendMode::kSrcOver == fBlendMode && analysis.hasKnownOutputColor() &&
!caps.shaderCaps()->dstReadInShaderSupport()) {
return false;
// 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
// 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 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
// 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 the XP.
- if (analysis.hasLCDCoverage()) {
+ if (analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kLCD) {
if (analysis.hasKnownOutputColor() && !caps.shaderCaps()->dstReadInShaderSupport()) {
return false;
}
#include "GrXferProcessor.h"
#include "SkBlendMode.h"
-class GrProcOptInfo;
-
// See the comment above GrXPFactory's definition about this warning suppression.
#if defined(__GNUC__) || defined(__clang)
#pragma GCC diagnostic push
bool InstancedRendering::Op::xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip) {
GrProcessorSet::FragmentProcessorAnalysis analysis;
- GrPipelineInput coverageInput;
+ GrPipelineAnalysisCoverage coverageInput;
if (GrAAType::kCoverage == fInfo.aaType() ||
(GrAAType::kNone == fInfo.aaType() && !fInfo.isSimpleRects() && fInfo.fCannotDiscard)) {
- coverageInput = GrPipelineInput();
+ coverageInput = GrPipelineAnalysisCoverage::kSingleChannel;
} else {
- coverageInput = GrColor_WHITE;
+ coverageInput = GrPipelineAnalysisCoverage::kNone;
}
fProcessors.analyzeAndEliminateFragmentProcessors(&analysis, this->getSingleInstance().fColor,
coverageInput, clip, caps);
state->gpu()->handleDirtyContext();
GrProcessorSet::FragmentProcessorAnalysis analysis;
- GrPipelineInput coverageInput;
+ GrPipelineAnalysisCoverage coverageInput;
if (GrAAType::kCoverage == fInfo.aaType() ||
(GrAAType::kNone == fInfo.aaType() && !fInfo.isSimpleRects() && fInfo.fCannotDiscard)) {
- coverageInput = GrPipelineInput();
+ coverageInput = GrPipelineAnalysisCoverage::kSingleChannel;
} else {
- coverageInput = GrColor_WHITE;
+ coverageInput = GrPipelineAnalysisCoverage::kNone;
}
- GrPipelineInput colorInput;
+ GrPipelineAnalysisColor colorInput;
if (fDrawColorsAreSame) {
colorInput = fHeadDraw->fInstance.fColor;
} else if (fDrawColorsAreOpaque) {
- colorInput = GrPipelineInput::Opaque::kYes;
+ colorInput = GrPipelineAnalysisColor::Opaque::kYes;
}
const GrAppliedClip* clip = state->drawOpArgs().fAppliedClip;
analysis.init(colorInput, coverageInput, fProcessors, clip, state->caps());
this->setTransformedBounds(path.getBounds(), viewMatrix, HasAABloat::kYes, IsZeroArea::kNo);
}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fColor);
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fColor);
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
}
private:
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(this->first()->color());
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(this->first()->color());
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void onPrepareDraws(Target* target) const override {
IsZeroArea::kYes);
}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fColor);
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fColor);
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
this->setTransformedBounds(bounds, viewMatrix, HasAABloat::kYes, IsZeroArea::kNo);
}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fPaths[0].fColor);
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fPaths[0].fColor);
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
private:
AAStrokeRectOp() : INHERITED(ClassID()) {}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fRects[0].fColor);
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fRects[0].fColor);
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations&) override;
void onPrepareDraws(Target*) const override;
}
private:
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fGeoData[0].fColor);
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fGeoData[0].fColor);
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
return str;
}
-void GrAtlasTextOp::getFragmentProcessorAnalysisInputs(
- FragmentProcessorAnalysisInputs* input) const {
+void GrAtlasTextOp::getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const {
if (kColorBitmapMask_MaskType == fMaskType) {
- input->colorInput()->setToUnknown();
+ color->setToUnknown();
} else {
- input->colorInput()->setToConstant(fColor);
+ color->setToConstant(fColor);
}
switch (fMaskType) {
case kGrayscaleDistanceField_MaskType:
case kGrayscaleCoverageMask_MaskType:
- input->coverageInput()->setToUnknown();
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
break;
case kLCDCoverageMask_MaskType:
case kLCDDistanceField_MaskType:
- input->coverageInput()->setToLCDCoverage();
+ *coverage = GrPipelineAnalysisCoverage::kLCD;
break;
case kColorBitmapMask_MaskType:
- input->coverageInput()->setToSolidCoverage();
+ *coverage = GrPipelineAnalysisCoverage::kNone;
+ break;
}
}
SkString dumpInfo() const override;
private:
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs*) const override;
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor*,
+ GrPipelineAnalysisCoverage*) const override;
void applyPipelineOptimizations(const GrPipelineOptimizations&) override;
struct FlushInfo {
this->setTransformedBounds(bounds, combinedMatrix, aaBloat, zeroArea);
}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fColor);
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fColor);
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
isHairline ? IsZeroArea::kYes : IsZeroArea::kNo);
}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fColor);
- input->coverageInput()->setToScalar(this->coverage());
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fColor);
+ *coverage = this->coverage() == 0xff ? GrPipelineAnalysisCoverage::kNone
+ : GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
GrDrawAtlasOp(GrColor color, const SkMatrix& viewMatrix, int spriteCount,
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()) {
- input->colorInput()->setToUnknown();
+ color->setToUnknown();
} else {
- input->colorInput()->setToConstant(fGeoData[0].fColor);
+ color->setToConstant(fGeoData[0].fColor);
}
- input->coverageInput()->setToSolidCoverage();
+ *coverage = GrPipelineAnalysisCoverage::kNone;
}
void onPrepareDraws(Target*) const override;
GrPipelineOptimizations initPipeline(const GrOpFlushState&, GrPipeline*);
const GrProcessorSet::FragmentProcessorAnalysis& doFragmentProcessorAnalysis(
const GrCaps& caps, const GrAppliedClip* clip) {
- fProcessorSet.analyzeAndEliminateFragmentProcessors(&fAnalysis, fAnalysis.inputColor(),
- GrColor_WHITE, clip, caps);
+ fProcessorSet.analyzeAndEliminateFragmentProcessors(
+ &fAnalysis, fAnalysis.inputColor(), GrPipelineAnalysisCoverage::kNone, clip, caps);
return fAnalysis;
}
const GrProcessorSet::FragmentProcessorAnalysis& fragmentProcessorAnalysis() const {
}
void GrDrawVerticesOp::getFragmentProcessorAnalysisInputs(
- FragmentProcessorAnalysisInputs* input) const {
+ GrPipelineAnalysisColor* color, GrPipelineAnalysisCoverage* coverage) const {
if (this->requiresPerVertexColors()) {
- input->colorInput()->setToUnknown();
+ color->setToUnknown();
} else {
- input->colorInput()->setToConstant(fMeshes[0].fColor);
+ color->setToConstant(fMeshes[0].fColor);
}
- input->coverageInput()->setToSolidCoverage();
+ *coverage = GrPipelineAnalysisCoverage::kNone;
}
void GrDrawVerticesOp::applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) {
GrRenderTargetContext::ColorArrayType, const SkMatrix& viewMatrix,
uint32_t flags = 0);
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override;
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override;
void applyPipelineOptimizations(const GrPipelineOptimizations&) override;
void onPrepareDraws(Target*) const override;
}
private:
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToUnknown();
- input->coverageInput()->setToSolidCoverage();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToUnknown();
+ *coverage = GrPipelineAnalysisCoverage::kNone;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& analysioptimizations) override {
this->setBounds(devBounds, HasAABloat::kNo, IsZeroArea::kNo);
}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fPaths[0].fColor);
- input->coverageInput()->setToSolidCoverage();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fPaths[0].fColor);
+ *coverage = GrPipelineAnalysisCoverage::kNone;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
const GrProcessorSet& processors,
const GrAppliedClip* appliedClip,
const GrCaps& caps) const {
- FragmentProcessorAnalysisInputs input;
- this->getFragmentProcessorAnalysisInputs(&input);
- analysis->init(*input.colorInput(), *input.coverageInput(), processors, appliedClip, caps);
+ GrPipelineAnalysisColor inputColor;
+ GrPipelineAnalysisCoverage inputCoverage;
+ this->getFragmentProcessorAnalysisInputs(&inputColor, &inputCoverage);
+ analysis->init(inputColor, inputCoverage, processors, appliedClip, caps);
}
void initPipeline(const GrPipeline::InitArgs& args) {
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:
/**
* Provides information about the GrPrimitiveProccesor color and coverage outputs which become
* 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
private:
NonAAFillRectOp() : INHERITED(ClassID()) {}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fRects[0].fColor);
- input->coverageInput()->setToSolidCoverage();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fRects[0].fColor);
+ *coverage = GrPipelineAnalysisCoverage::kNone;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
private:
NonAAFillRectPerspectiveOp() : INHERITED(ClassID()) {}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fRects[0].fColor);
- input->coverageInput()->setToSolidCoverage();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fRects[0].fColor);
+ *coverage = GrPipelineAnalysisCoverage::kNone;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
private:
NonAAStrokeRectOp() : INHERITED(ClassID()) {}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fColor);
- input->coverageInput()->setToSolidCoverage();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fColor);
+ *coverage = GrPipelineAnalysisCoverage::kNone;
}
void onPrepareDraws(Target* target) const override {
private:
CircleOp() : INHERITED(ClassID()) {}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fGeoData[0].fColor);
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fGeoData[0].fColor);
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
private:
EllipseOp() : INHERITED(ClassID()) {}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fGeoData[0].fColor);
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fGeoData[0].fColor);
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
private:
DIEllipseOp() : INHERITED(ClassID()) {}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fGeoData[0].fColor);
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fGeoData[0].fColor);
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
}
private:
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fGeoData[0].fColor);
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fGeoData[0].fColor);
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
private:
EllipticalRRectOp() : INHERITED(ClassID()) {}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fGeoData[0].fColor);
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fGeoData[0].fColor);
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
}
private:
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fRegions[0].fColor);
- input->coverageInput()->setToSolidCoverage();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fRegions[0].fColor);
+ *coverage = GrPipelineAnalysisCoverage::kNone;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
private:
ShadowCircleOp() : INHERITED(ClassID()) {}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fCircles[0].fColor);
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fCircles[0].fColor);
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
}
private:
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fGeoData[0].fColor);
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fGeoData[0].fColor);
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fShapes[0].fColor);
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fShapes[0].fColor);
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
}
private:
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fColor);
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fColor);
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
bool usesLocalCoords() const { return fUsesLocalCoords; }
private:
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(fColor);
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(fColor);
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
};
static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
- GrPipelineInput lcdInput;
- lcdInput.setToLCDCoverage();
- GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineInput(), lcdInput, caps);
-
+ GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineAnalysisColor(),
+ GrPipelineAnalysisCoverage::kLCD, caps);
SkASSERT(!analysis.isOutputColorOpaque());
SkASSERT(!analysis.hasKnownOutputColor());
- SkASSERT(analysis.hasLCDCoverage());
+ SkASSERT(analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kLCD);
for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
SkBlendMode xfermode = static_cast<SkBlendMode>(m);
}
}
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.hasKnownOutputColor());
- SkASSERT(!analysis.hasLCDCoverage());
- SkASSERT(analysis.hasCoverage());
+ SkASSERT(analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kSingleChannel);
for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
SkBlendMode xfermode = static_cast<SkBlendMode>(m);
static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
GrProcessorSet::FragmentProcessorAnalysis analysis(GrColorPackRGBA(229, 0, 154, 240),
- GrColorPackA4(255), caps);
+ GrPipelineAnalysisCoverage::kNone, caps);
SkASSERT(!analysis.isOutputColorOpaque());
SkASSERT(analysis.hasKnownOutputColor());
}
static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
- GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineInput::Opaque::kYes,
- GrPipelineInput(), caps);
+ GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineAnalysisColor::Opaque::kYes,
+ GrPipelineAnalysisCoverage::kSingleChannel,
+ caps);
SkASSERT(analysis.isOutputColorOpaque());
SkASSERT(!analysis.hasKnownOutputColor());
- SkASSERT(analysis.hasCoverage());
- SkASSERT(!analysis.hasLCDCoverage());
+ SkASSERT(analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kSingleChannel);
for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
SkBlendMode xfermode = static_cast<SkBlendMode>(m);
}
static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
- GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineInput::Opaque::kYes,
- GrColorPackA4(255), caps);
+ GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineAnalysisColor::Opaque::kYes,
+ GrPipelineAnalysisCoverage::kNone, caps);
SkASSERT(analysis.isOutputColorOpaque());
SkASSERT(!analysis.hasKnownOutputColor());
private:
void getFragmentProcessorAnalysisInputs(
- FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(GrColorPackRGBA(123, 45, 67, 221));
- input->coverageInput()->setToLCDCoverage();
+ GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(GrColorPackRGBA(123, 45, 67, 221));
+ *coverage = GrPipelineAnalysisCoverage::kLCD;
}
void applyPipelineOptimizations(const GrPipelineOptimizations&) override {}
testLCDCoverageOp.analyzeProcessors(&analysis, GrProcessorSet(GrPaint()), nullptr, caps);
SkASSERT(analysis.hasKnownOutputColor());
- SkASSERT(analysis.hasLCDCoverage());
+ SkASSERT(analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kLCD);
const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(SkBlendMode::kSrcOver);
TEST_ASSERT(!GrXPFactory::WillNeedDstTexture(xpf, caps, analysis));
fakeDstTexture.setTexture(
ctx->resourceProvider()->wrapBackendTexture(fakeDesc, kBorrow_GrWrapOwnership));
- static const GrPipelineInput colorInputs[] = {GrPipelineInput(),
- GrPipelineInput(GrPipelineInput::Opaque::kYes),
- GrPipelineInput(GrColorPackRGBA(0, 82, 17, 100)),
- GrPipelineInput(GrColorPackRGBA(0, 82, 17, 255))};
+ static const GrPipelineAnalysisColor colorInputs[] = {
+ GrPipelineAnalysisColor::Opaque::kNo, GrPipelineAnalysisColor::Opaque::kYes,
+ GrPipelineAnalysisColor(GrColorPackRGBA(0, 82, 17, 100)),
+ GrPipelineAnalysisColor(GrColorPackRGBA(0, 82, 17, 255))};
for (const auto& colorInput : colorInputs) {
GrProcessorSet::FragmentProcessorAnalysis analysis;
- for (bool fractionalCoverage : {true, false}) {
- if (fractionalCoverage) {
- analysis = GrProcessorSet::FragmentProcessorAnalysis(colorInput, GrPipelineInput(),
- caps);
- } else {
- analysis = GrProcessorSet::FragmentProcessorAnalysis(colorInput, GrColorPackA4(255),
- caps);
- }
+ for (GrPipelineAnalysisCoverage coverageType :
+ {GrPipelineAnalysisCoverage::kSingleChannel, GrPipelineAnalysisCoverage::kNone}) {
+ analysis = GrProcessorSet::FragmentProcessorAnalysis(colorInput, coverageType, caps);
for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
SkBlendMode xfermode = static_cast<SkBlendMode>(m);
const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(xfermode);
SkRect fRect;
private:
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToUnknown();
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToUnknown();
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
this->setBounds(SkRect::MakeWH(1.f, 1.f), HasAABloat::kNo, IsZeroArea::kNo);
}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToUnknown();
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToUnknown();
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations&) override {}