aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-03-27 13:09:36 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-27 17:45:29 +0000
commitc0b642ca48d58416409e555549434066f09692b7 (patch)
tree42de3fb562c64c5bd22f9f7622ba8ae699ad3e08
parent88f9c1eff96a12cfa42db5c238ed42623762d90c (diff)
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>
-rw-r--r--gn/gpu.gni5
-rw-r--r--src/gpu/GrFragmentProcessor.cpp8
-rw-r--r--src/gpu/GrPaint.cpp1
-rw-r--r--src/gpu/GrPipeline.cpp1
-rw-r--r--src/gpu/GrPipeline.h1
-rw-r--r--src/gpu/GrPipelineAnalysis.cpp (renamed from src/gpu/GrProcOptInfo.cpp)9
-rw-r--r--src/gpu/GrPipelineAnalysis.h (renamed from src/gpu/GrProcOptInfo.h)80
-rw-r--r--src/gpu/GrPipelineInput.h76
-rw-r--r--src/gpu/GrProcessorSet.cpp56
-rw-r--r--src/gpu/GrProcessorSet.h30
-rw-r--r--src/gpu/GrXferProcessor.cpp1
-rw-r--r--src/gpu/GrXferProcessor.h1
-rw-r--r--src/gpu/effects/GrCoverageSetOpXP.cpp3
-rw-r--r--src/gpu/effects/GrCoverageSetOpXP.h2
-rw-r--r--src/gpu/effects/GrCustomXfermode.cpp8
-rw-r--r--src/gpu/effects/GrDisableColorXP.h2
-rw-r--r--src/gpu/effects/GrPorterDuffXferProcessor.cpp11
-rw-r--r--src/gpu/effects/GrPorterDuffXferProcessor.h2
-rw-r--r--src/gpu/instanced/InstancedRendering.cpp16
-rw-r--r--src/gpu/ops/GrAAConvexPathRenderer.cpp7
-rw-r--r--src/gpu/ops/GrAAFillRectOp.cpp7
-rw-r--r--src/gpu/ops/GrAAHairLinePathRenderer.cpp7
-rw-r--r--src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp7
-rw-r--r--src/gpu/ops/GrAAStrokeRectOp.cpp7
-rw-r--r--src/gpu/ops/GrAnalyticRectOp.cpp7
-rw-r--r--src/gpu/ops/GrAtlasTextOp.cpp15
-rw-r--r--src/gpu/ops/GrAtlasTextOp.h3
-rw-r--r--src/gpu/ops/GrDashOp.cpp7
-rw-r--r--src/gpu/ops/GrDefaultPathRenderer.cpp8
-rw-r--r--src/gpu/ops/GrDrawAtlasOp.h9
-rw-r--r--src/gpu/ops/GrDrawPathOp.h4
-rw-r--r--src/gpu/ops/GrDrawVerticesOp.cpp8
-rw-r--r--src/gpu/ops/GrDrawVerticesOp.h3
-rw-r--r--src/gpu/ops/GrLatticeOp.cpp7
-rw-r--r--src/gpu/ops/GrMSAAPathRenderer.cpp7
-rw-r--r--src/gpu/ops/GrMeshDrawOp.h25
-rw-r--r--src/gpu/ops/GrNonAAFillRectOp.cpp7
-rw-r--r--src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp7
-rw-r--r--src/gpu/ops/GrNonAAStrokeRectOp.cpp7
-rw-r--r--src/gpu/ops/GrOvalOpFactory.cpp35
-rw-r--r--src/gpu/ops/GrRegionOp.cpp7
-rw-r--r--src/gpu/ops/GrShadowRRectOp.cpp14
-rw-r--r--src/gpu/ops/GrSmallPathRenderer.cpp7
-rw-r--r--src/gpu/ops/GrTessellatingPathRenderer.cpp7
-rw-r--r--src/gpu/ops/GrTestMeshDrawOp.h7
-rw-r--r--tests/GrPorterDuffTest.cpp56
-rw-r--r--tests/PreFlushCallbackTest.cpp7
-rw-r--r--tests/PrimitiveProcessorTest.cpp7
48 files changed, 296 insertions, 323 deletions
diff --git a/gn/gpu.gni b/gn/gpu.gni
index e4bdacfd80..a481cfd4ef 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -134,8 +134,9 @@ skia_gpu_sources = [
"$_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",
@@ -144,8 +145,6 @@ skia_gpu_sources = [
"$_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",
diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp
index 0d1bfadcc5..fdec93ba9a 100644
--- a/src/gpu/GrFragmentProcessor.cpp
+++ b/src/gpu/GrFragmentProcessor.cpp
@@ -8,13 +8,13 @@
#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
@@ -466,7 +466,7 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::RunInSeries(sk_sp<GrFragmentProc
return series[0];
}
// Run the through the series, do the invariant output processing, and look for eliminations.
- GrProcOptInfo info;
+ GrColorFragmentProcessorAnalysis info;
info.analyzeProcessors(sk_sp_address_as_pointer_address(series), cnt);
SkTArray<sk_sp<GrFragmentProcessor>> replacementSeries;
GrColor4f knownColor;
diff --git a/src/gpu/GrPaint.cpp b/src/gpu/GrPaint.cpp
index 5dc998eb27..6c5a041c94 100644
--- a/src/gpu/GrPaint.cpp
+++ b/src/gpu/GrPaint.cpp
@@ -6,7 +6,6 @@
*/
#include "GrPaint.h"
-#include "GrProcOptInfo.h"
#include "GrXferProcessor.h"
#include "effects/GrCoverageSetOpXP.h"
#include "effects/GrPorterDuffXferProcessor.h"
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 00dc9848a0..adcdd0fe02 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -11,7 +11,6 @@
#include "GrCaps.h"
#include "GrGpu.h"
#include "GrPipelineBuilder.h"
-#include "GrProcOptInfo.h"
#include "GrRenderTargetContext.h"
#include "GrRenderTargetOpList.h"
#include "GrRenderTargetPriv.h"
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index 7f2ac79b4f..21693426f1 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -13,7 +13,6 @@
#include "GrNonAtomicRef.h"
#include "GrPendingProgramElement.h"
#include "GrPrimitiveProcessor.h"
-#include "GrProcOptInfo.h"
#include "GrProcessorSet.h"
#include "GrProgramDesc.h"
#include "GrScissorState.h"
diff --git a/src/gpu/GrProcOptInfo.cpp b/src/gpu/GrPipelineAnalysis.cpp
index 902a7c77e4..3512c940b0 100644
--- a/src/gpu/GrProcOptInfo.cpp
+++ b/src/gpu/GrPipelineAnalysis.cpp
@@ -5,11 +5,12 @@
* 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 &&
@@ -18,8 +19,8 @@ void GrProcOptInfo::analyzeProcessors(const GrFragmentProcessor* const* processo
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
diff --git a/src/gpu/GrProcOptInfo.h b/src/gpu/GrPipelineAnalysis.h
index 549fb7a60b..4f553b0ce5 100644
--- a/src/gpu/GrProcOptInfo.h
+++ b/src/gpu/GrPipelineAnalysis.h
@@ -5,27 +5,73 @@
* 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)) {
@@ -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
@@ -80,14 +128,12 @@ public:
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:
diff --git a/src/gpu/GrPipelineInput.h b/src/gpu/GrPipelineInput.h
deleted file mode 100644
index 7079f36c63..0000000000
--- a/src/gpu/GrPipelineInput.h
+++ /dev/null
@@ -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
diff --git a/src/gpu/GrProcessorSet.cpp b/src/gpu/GrProcessorSet.cpp
index a8423b6894..4a508921b1 100644
--- a/src/gpu/GrProcessorSet.cpp
+++ b/src/gpu/GrProcessorSet.cpp
@@ -8,7 +8,7 @@
#include "GrProcessorSet.h"
#include "GrAppliedClip.h"
#include "GrCaps.h"
-#include "GrProcOptInfo.h"
+#include "GrPipelineAnalysis.h"
GrProcessorSet::GrProcessorSet(GrPaint&& paint) {
fXPFactory = paint.fXPFactory;
@@ -80,13 +80,14 @@ bool GrProcessorSet::operator==(const GrProcessorSet& that) const {
//////////////////////////////////////////////////////////////////////////////
-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 =
@@ -115,27 +116,27 @@ void GrProcessorSet::FragmentProcessorAnalysis::internalInit(const GrPipelineInp
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) {
@@ -146,16 +147,19 @@ void GrProcessorSet::FragmentProcessorAnalysis::init(const GrPipelineInput& colo
}
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) {
diff --git a/src/gpu/GrProcessorSet.h b/src/gpu/GrProcessorSet.h
index 71ab2d0f9f..bfad769a18 100644
--- a/src/gpu/GrProcessorSet.h
+++ b/src/gpu/GrProcessorSet.h
@@ -10,7 +10,7 @@
#include "GrFragmentProcessor.h"
#include "GrPaint.h"
-#include "GrPipelineInput.h"
+#include "GrPipelineAnalysis.h"
#include "SkTemplates.h"
class GrAppliedClip;
@@ -79,16 +79,16 @@ public:
: 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; }
@@ -132,19 +132,19 @@ public:
}
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.
@@ -166,8 +166,8 @@ public:
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:
diff --git a/src/gpu/GrXferProcessor.cpp b/src/gpu/GrXferProcessor.cpp
index 32ab45c65e..bd63a0a40b 100644
--- a/src/gpu/GrXferProcessor.cpp
+++ b/src/gpu/GrXferProcessor.cpp
@@ -7,7 +7,6 @@
#include "GrXferProcessor.h"
#include "GrPipeline.h"
-#include "GrProcOptInfo.h"
#include "gl/GrGLCaps.h"
GrXferProcessor::GrXferProcessor()
diff --git a/src/gpu/GrXferProcessor.h b/src/gpu/GrXferProcessor.h
index 35ce5fa4a2..bdf6f7d50c 100644
--- a/src/gpu/GrXferProcessor.h
+++ b/src/gpu/GrXferProcessor.h
@@ -17,7 +17,6 @@
class GrShaderCaps;
class GrGLSLXferProcessor;
-class GrProcOptInfo;
/**
* Barriers for blending. When a shader reads the dst directly, an Xfer barrier is sometimes
diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp
index 52ebaad309..1013706842 100644
--- a/src/gpu/effects/GrCoverageSetOpXP.cpp
+++ b/src/gpu/effects/GrCoverageSetOpXP.cpp
@@ -8,10 +8,9 @@
#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"
diff --git a/src/gpu/effects/GrCoverageSetOpXP.h b/src/gpu/effects/GrCoverageSetOpXP.h
index 184ef4e56c..a0cb0c518c 100644
--- a/src/gpu/effects/GrCoverageSetOpXP.h
+++ b/src/gpu/effects/GrCoverageSetOpXP.h
@@ -12,8 +12,6 @@
#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
diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp
index 37e4c16765..1f2771cb52 100644
--- a/src/gpu/effects/GrCustomXfermode.cpp
+++ b/src/gpu/effects/GrCustomXfermode.cpp
@@ -52,12 +52,12 @@ static constexpr GrBlendEquation hw_blend_equation(SkBlendMode mode) {
#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)) {
@@ -347,7 +347,7 @@ GrXferProcessor* CustomXPFactory::onCreateXferProcessor(const GrCaps& caps,
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);
}
@@ -356,7 +356,7 @@ GrXferProcessor* CustomXPFactory::onCreateXferProcessor(const GrCaps& caps,
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);
diff --git a/src/gpu/effects/GrDisableColorXP.h b/src/gpu/effects/GrDisableColorXP.h
index 78442f4125..821ad2768e 100644
--- a/src/gpu/effects/GrDisableColorXP.h
+++ b/src/gpu/effects/GrDisableColorXP.h
@@ -12,8 +12,6 @@
#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
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
index 3dc5325fd9..aa416e0d1b 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
@@ -10,8 +10,8 @@
#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"
@@ -19,7 +19,6 @@
#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.
@@ -736,7 +735,7 @@ GrXferProcessor* GrPorterDuffXPFactory::onCreateXferProcessor(
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()) {
@@ -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
// 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;
@@ -838,7 +837,7 @@ GrXferProcessor* GrPorterDuffXPFactory::CreateSrcOverXferProcessor(
// 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
@@ -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
// 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;
}
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.h b/src/gpu/effects/GrPorterDuffXferProcessor.h
index 719bd18527..23f1e9c5c5 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.h
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.h
@@ -12,8 +12,6 @@
#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
diff --git a/src/gpu/instanced/InstancedRendering.cpp b/src/gpu/instanced/InstancedRendering.cpp
index f97c342ebe..e67a8be977 100644
--- a/src/gpu/instanced/InstancedRendering.cpp
+++ b/src/gpu/instanced/InstancedRendering.cpp
@@ -334,12 +334,12 @@ void InstancedRendering::Op::appendParamsTexel(SkScalar x, SkScalar y, SkScalar
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);
@@ -470,18 +470,18 @@ void InstancedRendering::Op::onExecute(GrOpFlushState* state) {
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());
diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp
index e316fecc5f..79259b4aea 100644
--- a/src/gpu/ops/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp
@@ -747,9 +747,10 @@ private:
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 {
diff --git a/src/gpu/ops/GrAAFillRectOp.cpp b/src/gpu/ops/GrAAFillRectOp.cpp
index 850a3c9739..c6aadb92ed 100644
--- a/src/gpu/ops/GrAAFillRectOp.cpp
+++ b/src/gpu/ops/GrAAFillRectOp.cpp
@@ -203,9 +203,10 @@ public:
}
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 {
diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
index ec2610400f..494138d7b0 100644
--- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
@@ -710,9 +710,10 @@ private:
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 {
diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
index bdec758eaf..c9add9d3e9 100644
--- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
@@ -172,9 +172,10 @@ private:
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 {
diff --git a/src/gpu/ops/GrAAStrokeRectOp.cpp b/src/gpu/ops/GrAAStrokeRectOp.cpp
index b684782f23..89739e6116 100644
--- a/src/gpu/ops/GrAAStrokeRectOp.cpp
+++ b/src/gpu/ops/GrAAStrokeRectOp.cpp
@@ -174,9 +174,10 @@ public:
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;
diff --git a/src/gpu/ops/GrAnalyticRectOp.cpp b/src/gpu/ops/GrAnalyticRectOp.cpp
index 45e20f0dbc..87922cc60c 100644
--- a/src/gpu/ops/GrAnalyticRectOp.cpp
+++ b/src/gpu/ops/GrAnalyticRectOp.cpp
@@ -269,9 +269,10 @@ public:
}
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 {
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index e723bd01f3..f8c5443854 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -46,24 +46,25 @@ SkString GrAtlasTextOp::dumpInfo() const {
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;
}
}
diff --git a/src/gpu/ops/GrAtlasTextOp.h b/src/gpu/ops/GrAtlasTextOp.h
index 699503a8cb..8c08544f7b 100644
--- a/src/gpu/ops/GrAtlasTextOp.h
+++ b/src/gpu/ops/GrAtlasTextOp.h
@@ -99,7 +99,8 @@ public:
SkString dumpInfo() const override;
private:
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs*) const override;
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor*,
+ GrPipelineAnalysisCoverage*) const override;
void applyPipelineOptimizations(const GrPipelineOptimizations&) override;
struct FlushInfo {
diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp
index 1372a8b466..9dfacded7f 100644
--- a/src/gpu/ops/GrDashOp.cpp
+++ b/src/gpu/ops/GrDashOp.cpp
@@ -296,9 +296,10 @@ private:
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 {
diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp
index 300090d40c..62c9d45439 100644
--- a/src/gpu/ops/GrDefaultPathRenderer.cpp
+++ b/src/gpu/ops/GrDefaultPathRenderer.cpp
@@ -132,9 +132,11 @@ private:
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 {
diff --git a/src/gpu/ops/GrDrawAtlasOp.h b/src/gpu/ops/GrDrawAtlasOp.h
index cde345ed8e..a39a7a92f2 100644
--- a/src/gpu/ops/GrDrawAtlasOp.h
+++ b/src/gpu/ops/GrDrawAtlasOp.h
@@ -39,13 +39,14 @@ private:
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;
diff --git a/src/gpu/ops/GrDrawPathOp.h b/src/gpu/ops/GrDrawPathOp.h
index 70a543f3e5..b1ce2dfe5a 100644
--- a/src/gpu/ops/GrDrawPathOp.h
+++ b/src/gpu/ops/GrDrawPathOp.h
@@ -43,8 +43,8 @@ protected:
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 {
diff --git a/src/gpu/ops/GrDrawVerticesOp.cpp b/src/gpu/ops/GrDrawVerticesOp.cpp
index 7c59d61e74..d8f91fe946 100644
--- a/src/gpu/ops/GrDrawVerticesOp.cpp
+++ b/src/gpu/ops/GrDrawVerticesOp.cpp
@@ -75,13 +75,13 @@ GrDrawVerticesOp::GrDrawVerticesOp(sk_sp<SkVertices> vertices, GrPrimitiveType p
}
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) {
diff --git a/src/gpu/ops/GrDrawVerticesOp.h b/src/gpu/ops/GrDrawVerticesOp.h
index f881d61440..176b552e09 100644
--- a/src/gpu/ops/GrDrawVerticesOp.h
+++ b/src/gpu/ops/GrDrawVerticesOp.h
@@ -70,7 +70,8 @@ private:
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;
diff --git a/src/gpu/ops/GrLatticeOp.cpp b/src/gpu/ops/GrLatticeOp.cpp
index a1b758409a..598a83907d 100644
--- a/src/gpu/ops/GrLatticeOp.cpp
+++ b/src/gpu/ops/GrLatticeOp.cpp
@@ -61,9 +61,10 @@ public:
}
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 {
diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp
index ccbd0e2452..4e7f0361bf 100644
--- a/src/gpu/ops/GrMSAAPathRenderer.cpp
+++ b/src/gpu/ops/GrMSAAPathRenderer.cpp
@@ -259,9 +259,10 @@ private:
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 {
diff --git a/src/gpu/ops/GrMeshDrawOp.h b/src/gpu/ops/GrMeshDrawOp.h
index 4cf7c52672..cbf1f62eb7 100644
--- a/src/gpu/ops/GrMeshDrawOp.h
+++ b/src/gpu/ops/GrMeshDrawOp.h
@@ -33,9 +33,10 @@ public:
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) {
@@ -98,27 +99,13 @@ protected:
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
diff --git a/src/gpu/ops/GrNonAAFillRectOp.cpp b/src/gpu/ops/GrNonAAFillRectOp.cpp
index a83da15006..ce4b21fada 100644
--- a/src/gpu/ops/GrNonAAFillRectOp.cpp
+++ b/src/gpu/ops/GrNonAAFillRectOp.cpp
@@ -110,9 +110,10 @@ public:
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 {
diff --git a/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp b/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp
index 26a646952f..324ea43ccf 100644
--- a/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp
+++ b/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp
@@ -130,9 +130,10 @@ public:
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 {
diff --git a/src/gpu/ops/GrNonAAStrokeRectOp.cpp b/src/gpu/ops/GrNonAAStrokeRectOp.cpp
index a4de594a69..2f63d96327 100644
--- a/src/gpu/ops/GrNonAAStrokeRectOp.cpp
+++ b/src/gpu/ops/GrNonAAStrokeRectOp.cpp
@@ -102,9 +102,10 @@ public:
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 {
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index dbab985a6c..83e783ff2f 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -805,9 +805,10 @@ public:
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 {
@@ -1256,9 +1257,10 @@ public:
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 {
@@ -1470,9 +1472,10 @@ public:
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 {
@@ -1785,9 +1788,10 @@ public:
}
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 {
@@ -2148,9 +2152,10 @@ public:
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 {
diff --git a/src/gpu/ops/GrRegionOp.cpp b/src/gpu/ops/GrRegionOp.cpp
index 32cb8e4555..0ebec98e8f 100644
--- a/src/gpu/ops/GrRegionOp.cpp
+++ b/src/gpu/ops/GrRegionOp.cpp
@@ -77,9 +77,10 @@ public:
}
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 {
diff --git a/src/gpu/ops/GrShadowRRectOp.cpp b/src/gpu/ops/GrShadowRRectOp.cpp
index 1381bc93b7..bc1a4cca0a 100644
--- a/src/gpu/ops/GrShadowRRectOp.cpp
+++ b/src/gpu/ops/GrShadowRRectOp.cpp
@@ -142,9 +142,10 @@ public:
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 {
@@ -562,9 +563,10 @@ public:
}
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 {
diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp
index 94364a643b..8d3f7b73ef 100644
--- a/src/gpu/ops/GrSmallPathRenderer.cpp
+++ b/src/gpu/ops/GrSmallPathRenderer.cpp
@@ -199,9 +199,10 @@ private:
}
- 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 {
diff --git a/src/gpu/ops/GrTessellatingPathRenderer.cpp b/src/gpu/ops/GrTessellatingPathRenderer.cpp
index d1fd28adf3..914998878c 100644
--- a/src/gpu/ops/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/ops/GrTessellatingPathRenderer.cpp
@@ -180,9 +180,10 @@ public:
}
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 {
diff --git a/src/gpu/ops/GrTestMeshDrawOp.h b/src/gpu/ops/GrTestMeshDrawOp.h
index 039f88d672..a4bf066a34 100644
--- a/src/gpu/ops/GrTestMeshDrawOp.h
+++ b/src/gpu/ops/GrTestMeshDrawOp.h
@@ -33,9 +33,10 @@ protected:
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 {
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index de1843813a..ef217010ae 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -93,13 +93,11 @@ public:
};
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);
@@ -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) {
- 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);
@@ -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) {
GrProcessorSet::FragmentProcessorAnalysis analysis(GrColorPackRGBA(229, 0, 154, 240),
- GrColorPackA4(255), caps);
+ GrPipelineAnalysisCoverage::kNone, caps);
SkASSERT(!analysis.isOutputColorOpaque());
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) {
- 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);
@@ -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) {
- GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineInput::Opaque::kYes,
- GrColorPackA4(255), caps);
+ GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineAnalysisColor::Opaque::kYes,
+ GrPipelineAnalysisCoverage::kNone, caps);
SkASSERT(analysis.isOutputColorOpaque());
SkASSERT(!analysis.hasKnownOutputColor());
@@ -957,9 +955,10 @@ static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const
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 {}
@@ -973,7 +972,7 @@ static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const
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));
@@ -1017,21 +1016,16 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, /*factory*/) {
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);
diff --git a/tests/PreFlushCallbackTest.cpp b/tests/PreFlushCallbackTest.cpp
index 773cfde347..e008009efd 100644
--- a/tests/PreFlushCallbackTest.cpp
+++ b/tests/PreFlushCallbackTest.cpp
@@ -64,9 +64,10 @@ protected:
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 {
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index 30bfed9ff0..0a9d0021f0 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -40,9 +40,10 @@ private:
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 {}