aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ops
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/ops')
-rw-r--r--src/gpu/ops/GrAAConvexPathRenderer.cpp25
-rw-r--r--src/gpu/ops/GrAADistanceFieldPathRenderer.cpp25
-rw-r--r--src/gpu/ops/GrAAFillRectOp.cpp37
-rw-r--r--src/gpu/ops/GrAAHairLinePathRenderer.cpp22
-rw-r--r--src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp26
-rw-r--r--src/gpu/ops/GrAAStrokeRectOp.cpp25
-rw-r--r--src/gpu/ops/GrAnalyticRectOp.cpp18
-rw-r--r--src/gpu/ops/GrAtlasTextOp.cpp29
-rw-r--r--src/gpu/ops/GrAtlasTextOp.h8
-rw-r--r--src/gpu/ops/GrDashOp.cpp23
-rw-r--r--src/gpu/ops/GrDefaultPathRenderer.cpp22
-rw-r--r--src/gpu/ops/GrDrawAtlasOp.cpp11
-rw-r--r--src/gpu/ops/GrDrawAtlasOp.h21
-rw-r--r--src/gpu/ops/GrDrawOp.cpp20
-rw-r--r--src/gpu/ops/GrDrawOp.h22
-rw-r--r--src/gpu/ops/GrDrawPathOp.cpp8
-rw-r--r--src/gpu/ops/GrDrawPathOp.h25
-rw-r--r--src/gpu/ops/GrDrawVerticesOp.cpp19
-rw-r--r--src/gpu/ops/GrDrawVerticesOp.h9
-rw-r--r--src/gpu/ops/GrLatticeOp.cpp29
-rw-r--r--src/gpu/ops/GrMSAAPathRenderer.cpp20
-rw-r--r--src/gpu/ops/GrNonAAFillRectOp.cpp30
-rw-r--r--src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp30
-rw-r--r--src/gpu/ops/GrNonAAStrokeRectOp.cpp31
-rw-r--r--src/gpu/ops/GrOvalOpFactory.cpp99
-rw-r--r--src/gpu/ops/GrPLSPathRenderer.cpp35
-rw-r--r--src/gpu/ops/GrRegionOp.cpp21
-rwxr-xr-xsrc/gpu/ops/GrShadowRRectOp.cpp83
-rw-r--r--src/gpu/ops/GrTessellatingPathRenderer.cpp33
-rw-r--r--src/gpu/ops/GrTestMeshDrawOp.h29
30 files changed, 371 insertions, 464 deletions
diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp
index fd4083bf80..2d25ff5131 100644
--- a/src/gpu/ops/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp
@@ -749,13 +749,6 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- color->setKnownFourComponents(fColor);
- coverage->setUnknownSingleComponent();
- }
-
private:
AAConvexPathOp(GrColor color, const SkMatrix& viewMatrix, const SkPath& path)
: INHERITED(ClassID()), fColor(color) {
@@ -763,17 +756,21 @@ private:
this->setTransformedBounds(path.getBounds(), viewMatrix, HasAABloat::kYes, IsZeroArea::kNo);
}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- // Handle any color overrides
- if (!overrides.readsColor()) {
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fColor);
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
+ }
+
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ if (!optimizations.readsColor()) {
fColor = GrColor_ILLEGAL;
}
- overrides.getOverrideColorIfSet(&fColor);
+ optimizations.getOverrideColorIfSet(&fColor);
- fUsesLocalCoords = overrides.readsLocalCoords();
- fCoverageIgnored = !overrides.readsCoverage();
+ fUsesLocalCoords = optimizations.readsLocalCoords();
+ fCoverageIgnored = !optimizations.readsCoverage();
fLinesOnly = SkPath::kLine_SegmentMask == fPaths[0].fPath.getSegmentMasks();
- fCanTweakAlphaForCoverage = overrides.canTweakAlphaForCoverage();
+ fCanTweakAlphaForCoverage = optimizations.canTweakAlphaForCoverage();
}
void prepareLinesOnlyDraws(Target* target) const {
diff --git a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
index 00d3ed7b97..b97d35ee16 100644
--- a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
@@ -145,13 +145,6 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- color->setKnownFourComponents(fShapes[0].fColor);
- coverage->setUnknownSingleComponent();
- }
-
private:
AADistanceFieldPathOp(GrColor color, const GrShape& shape, const SkMatrix& viewMatrix,
GrDrawOpAtlas* atlas, ShapeCache* shapeCache, ShapeDataList* shapeList,
@@ -170,16 +163,20 @@ private:
this->setTransformedBounds(shape.bounds(), viewMatrix, HasAABloat::kYes, IsZeroArea::kNo);
}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- // Handle any color overrides
- if (!overrides.readsColor()) {
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fShapes[0].fColor);
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
+ }
+
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ if (!optimizations.readsColor()) {
fShapes[0].fColor = GrColor_ILLEGAL;
}
- overrides.getOverrideColorIfSet(&fShapes[0].fColor);
+ optimizations.getOverrideColorIfSet(&fShapes[0].fColor);
- fColorIgnored = !overrides.readsColor();
- fUsesLocalCoords = overrides.readsLocalCoords();
- fCoverageIgnored = !overrides.readsCoverage();
+ fColorIgnored = !optimizations.readsColor();
+ fUsesLocalCoords = optimizations.readsLocalCoords();
+ fCoverageIgnored = !optimizations.readsCoverage();
}
struct FlushInfo {
diff --git a/src/gpu/ops/GrAAFillRectOp.cpp b/src/gpu/ops/GrAAFillRectOp.cpp
index d45954ca72..e00ed5599f 100644
--- a/src/gpu/ops/GrAAFillRectOp.cpp
+++ b/src/gpu/ops/GrAAFillRectOp.cpp
@@ -52,7 +52,7 @@ static void generate_aa_fill_rect_geometry(intptr_t verts,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkRect& devRect,
- const GrXPOverridesForBatch& overrides,
+ const GrPipelineOptimizations& optimizations,
const SkMatrix* localMatrix) {
SkPoint* fan0Pos = reinterpret_cast<SkPoint*>(verts);
SkPoint* fan1Pos = reinterpret_cast<SkPoint*>(verts + 4 * vertexStride);
@@ -115,7 +115,7 @@ static void generate_aa_fill_rect_geometry(intptr_t verts,
localCoordMatrix.mapPointsWithStride(fan0Loc, fan0Pos, vertexStride, 8);
}
- bool tweakAlphaForCoverage = overrides.canTweakAlphaForCoverage();
+ bool tweakAlphaForCoverage = optimizations.canTweakAlphaForCoverage();
// Make verts point to vertex color and then set all the color and coverage vertex attrs
// values.
@@ -195,30 +195,27 @@ public:
return str;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- // When this is called there is only one rect
- color->setKnownFourComponents(this->first()->color());
- coverage->setUnknownSingleComponent();
- }
-
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
GrColor color;
- if (overrides.getOverrideColorIfSet(&color)) {
+ if (optimizations.getOverrideColorIfSet(&color)) {
this->first()->setColor(color);
}
- fOverrides = overrides;
+ fOptimizations = optimizations;
}
private:
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(this->first()->color());
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
+ }
+
void onPrepareDraws(Target* target) const override {
- bool needLocalCoords = fOverrides.readsLocalCoords();
+ bool needLocalCoords = fOptimizations.readsLocalCoords();
using namespace GrDefaultGeoProcFactory;
Color color(Color::kAttribute_Type);
Coverage::Type coverageType;
- if (fOverrides.canTweakAlphaForCoverage()) {
+ if (fOptimizations.canTweakAlphaForCoverage()) {
coverageType = Coverage::kSolid_Type;
} else {
coverageType = Coverage::kAttribute_Type;
@@ -258,7 +255,8 @@ private:
}
}
generate_aa_fill_rect_geometry(verts, vertexStride, info->color(), info->viewMatrix(),
- info->rect(), info->devRect(), fOverrides, localMatrix);
+ info->rect(), info->devRect(), fOptimizations,
+ localMatrix);
info = this->next(info);
}
helper.recordDraw(target, gp.get());
@@ -273,8 +271,9 @@ private:
// In the event of two ops, one who can tweak, one who cannot, we just fall back to not
// tweaking.
- if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakAlphaForCoverage()) {
- fOverrides = that->fOverrides;
+ if (fOptimizations.canTweakAlphaForCoverage() &&
+ !that->fOptimizations.canTweakAlphaForCoverage()) {
+ fOptimizations = that->fOptimizations;
}
fRectData.push_back_n(that->fRectData.count(), that->fRectData.begin());
@@ -335,7 +334,7 @@ private:
return reinterpret_cast<const RectInfo*>(next);
}
- GrXPOverridesForBatch fOverrides;
+ GrPipelineOptimizations fOptimizations;
SkSTArray<4 * sizeof(RectWithLocalMatrixInfo), uint8_t, true> fRectData;
int fRectCnt;
diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
index b5a797859e..9228318519 100644
--- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
@@ -704,13 +704,6 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- color->setKnownFourComponents(fColor);
- coverage->setUnknownSingleComponent();
- }
-
private:
AAHairlineOp(GrColor color,
uint8_t coverage,
@@ -724,14 +717,17 @@ private:
IsZeroArea::kYes);
}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- // Handle any color overrides
- if (!overrides.readsColor()) {
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fColor);
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
+ }
+
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ if (!optimizations.readsColor()) {
fColor = GrColor_ILLEGAL;
}
- overrides.getOverrideColorIfSet(&fColor);
-
- fUsesLocalCoords = overrides.readsLocalCoords();
+ optimizations.getOverrideColorIfSet(&fColor);
+ fUsesLocalCoords = optimizations.readsLocalCoords();
}
void onPrepareDraws(Target*) const override;
diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
index 8f2ab86a8b..40d6083b50 100644
--- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
@@ -152,14 +152,6 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- // When this is called there is only one path.
- color->setKnownFourComponents(fPaths[0].fColor);
- coverage->setUnknownSingleComponent();
- }
-
private:
AAFlatteningConvexPathOp(GrColor color,
const SkMatrix& viewMatrix,
@@ -186,18 +178,22 @@ private:
this->setTransformedBounds(bounds, viewMatrix, HasAABloat::kYes, IsZeroArea::kNo);
}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- // Handle any color overrides
- if (!overrides.readsColor()) {
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fPaths[0].fColor);
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
+ }
+
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ if (!optimizations.readsColor()) {
fPaths[0].fColor = GrColor_ILLEGAL;
}
- overrides.getOverrideColorIfSet(&fPaths[0].fColor);
+ optimizations.getOverrideColorIfSet(&fPaths[0].fColor);
// setup batch properties
fColor = fPaths[0].fColor;
- fUsesLocalCoords = overrides.readsLocalCoords();
- fCoverageIgnored = !overrides.readsCoverage();
- fCanTweakAlphaForCoverage = overrides.canTweakAlphaForCoverage();
+ fUsesLocalCoords = optimizations.readsLocalCoords();
+ fCoverageIgnored = !optimizations.readsCoverage();
+ fCanTweakAlphaForCoverage = optimizations.canTweakAlphaForCoverage();
}
void draw(GrMeshDrawOp::Target* target, const GrGeometryProcessor* gp, int vertexCount,
diff --git a/src/gpu/ops/GrAAStrokeRectOp.cpp b/src/gpu/ops/GrAAStrokeRectOp.cpp
index 56606795f2..711129fdcd 100644
--- a/src/gpu/ops/GrAAStrokeRectOp.cpp
+++ b/src/gpu/ops/GrAAStrokeRectOp.cpp
@@ -163,18 +163,15 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- color->setKnownFourComponents(fRects[0].fColor);
- coverage->setUnknownSingleComponent();
- }
-
private:
AAStrokeRectOp() : INHERITED(ClassID()) {}
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fRects[0].fColor);
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
+ }
+ void applyPipelineOptimizations(const GrPipelineOptimizations&) override;
void onPrepareDraws(Target*) const override;
- void initBatchTracker(const GrXPOverridesForBatch&) override;
static const int kMiterIndexCnt = 3 * 24;
static const int kMiterVertexCnt = 16;
@@ -224,15 +221,15 @@ private:
typedef GrMeshDrawOp INHERITED;
};
-void AAStrokeRectOp::initBatchTracker(const GrXPOverridesForBatch& overrides) {
- if (!overrides.readsColor()) {
+void AAStrokeRectOp::applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) {
+ if (!optimizations.readsColor()) {
fRects[0].fColor = GrColor_ILLEGAL;
}
- overrides.getOverrideColorIfSet(&fRects[0].fColor);
+ optimizations.getOverrideColorIfSet(&fRects[0].fColor);
- // setup batch properties
- fUsesLocalCoords = overrides.readsLocalCoords();
- fCanTweakAlphaForCoverage = overrides.canTweakAlphaForCoverage();
+ fUsesLocalCoords = optimizations.readsLocalCoords();
+ fCanTweakAlphaForCoverage = optimizations.canTweakAlphaForCoverage();
+ fCanTweakAlphaForCoverage = optimizations.canTweakAlphaForCoverage();
}
void AAStrokeRectOp::onPrepareDraws(Target* target) const {
diff --git a/src/gpu/ops/GrAnalyticRectOp.cpp b/src/gpu/ops/GrAnalyticRectOp.cpp
index 9c4e66cc84..cd4b6905bf 100644
--- a/src/gpu/ops/GrAnalyticRectOp.cpp
+++ b/src/gpu/ops/GrAnalyticRectOp.cpp
@@ -267,19 +267,15 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- // When this is called there is only one rect.
- color->setKnownFourComponents(fGeoData[0].fColor);
- coverage->setUnknownSingleComponent();
+private:
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fGeoData[0].fColor);
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
}
-private:
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- // Handle any overrides that affect our GP.
- overrides.getOverrideColorIfSet(&fGeoData[0].fColor);
- if (!overrides.readsLocalCoords()) {
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ optimizations.getOverrideColorIfSet(&fGeoData[0].fColor);
+ if (!optimizations.readsLocalCoords()) {
fViewMatrixIfUsingLocalCoords.reset();
}
}
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index 38fc5e0265..bd05d441d8 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -45,40 +45,37 @@ SkString GrAtlasTextOp::dumpInfo() const {
return str;
}
-void GrAtlasTextOp::computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const {
+void GrAtlasTextOp::getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const {
if (kColorBitmapMask_MaskType == fMaskType) {
- color->setUnknownFourComponents();
+ input->pipelineColorInput()->setUnknownFourComponents();
} else {
- color->setKnownFourComponents(fColor);
+ input->pipelineColorInput()->setKnownFourComponents(fColor);
}
switch (fMaskType) {
case kGrayscaleDistanceField_MaskType:
case kGrayscaleCoverageMask_MaskType:
- coverage->setUnknownSingleComponent();
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
break;
case kLCDCoverageMask_MaskType:
case kLCDDistanceField_MaskType:
- coverage->setUnknownOpaqueFourComponents();
- coverage->setUsingLCDCoverage();
+ input->pipelineCoverageInput()->setUnknownOpaqueFourComponents();
+ input->pipelineCoverageInput()->setUsingLCDCoverage();
break;
case kColorBitmapMask_MaskType:
- coverage->setKnownSingleComponent(0xff);
+ input->pipelineCoverageInput()->setKnownSingleComponent(0xff);
}
}
-void GrAtlasTextOp::initBatchTracker(const GrXPOverridesForBatch& overrides) {
- // Handle any color overrides
- if (!overrides.readsColor()) {
+void GrAtlasTextOp::applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) {
+ if (!optimizations.readsColor()) {
fGeoData[0].fColor = GrColor_ILLEGAL;
}
- overrides.getOverrideColorIfSet(&fGeoData[0].fColor);
+ optimizations.getOverrideColorIfSet(&fGeoData[0].fColor);
- fColorIgnored = !overrides.readsColor();
+ fColorIgnored = !optimizations.readsColor();
fColor = fGeoData[0].fColor;
- fUsesLocalCoords = overrides.readsLocalCoords();
- fCoverageIgnored = !overrides.readsCoverage();
+ fUsesLocalCoords = optimizations.readsLocalCoords();
+ fCoverageIgnored = !optimizations.readsCoverage();
}
void GrAtlasTextOp::onPrepareDraws(Target* target) const {
diff --git a/src/gpu/ops/GrAtlasTextOp.h b/src/gpu/ops/GrAtlasTextOp.h
index 9040ef3a58..961c4fb0e8 100644
--- a/src/gpu/ops/GrAtlasTextOp.h
+++ b/src/gpu/ops/GrAtlasTextOp.h
@@ -92,13 +92,9 @@ public:
SkString dumpInfo() const override;
-protected:
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override;
-
private:
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override;
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput*) const override;
+ void applyPipelineOptimizations(const GrPipelineOptimizations&) override;
struct FlushInfo {
sk_sp<const GrBuffer> fVertexBuffer;
diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp
index 8052795ead..8a9dfe88a7 100644
--- a/src/gpu/ops/GrDashOp.cpp
+++ b/src/gpu/ops/GrDashOp.cpp
@@ -276,13 +276,6 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- color->setKnownFourComponents(fColor);
- coverage->setUnknownSingleComponent();
- }
-
private:
DashOp(const LineData& geometry, GrColor color, SkPaint::Cap cap, AAMode aaMode, bool fullDash)
: INHERITED(ClassID()), fColor(color), fCap(cap), fAAMode(aaMode), fFullDash(fullDash) {
@@ -304,15 +297,19 @@ private:
this->setTransformedBounds(bounds, combinedMatrix, aaBloat, zeroArea);
}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- // Handle any color overrides
- if (!overrides.readsColor()) {
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fColor);
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
+ }
+
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ if (!optimizations.readsColor()) {
fColor = GrColor_ILLEGAL;
}
- overrides.getOverrideColorIfSet(&fColor);
+ optimizations.getOverrideColorIfSet(&fColor);
- fUsesLocalCoords = overrides.readsLocalCoords();
- fCoverageIgnored = !overrides.readsCoverage();
+ fUsesLocalCoords = optimizations.readsLocalCoords();
+ fCoverageIgnored = !optimizations.readsCoverage();
}
struct DashDraw {
diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp
index 4803c0da4e..e6c6f31651 100644
--- a/src/gpu/ops/GrDefaultPathRenderer.cpp
+++ b/src/gpu/ops/GrDefaultPathRenderer.cpp
@@ -118,13 +118,6 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- color->setKnownFourComponents(fColor);
- coverage->setKnownSingleComponent(this->coverage());
- }
-
private:
DefaultPathOp(GrColor color, const SkPath& path, SkScalar tolerance, uint8_t coverage,
const SkMatrix& viewMatrix, bool isHairline, const SkRect& devBounds)
@@ -139,13 +132,18 @@ private:
isHairline ? IsZeroArea::kYes : IsZeroArea::kNo);
}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- if (!overrides.readsColor()) {
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fColor);
+ input->pipelineCoverageInput()->setKnownSingleComponent(this->coverage());
+ }
+
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ if (!optimizations.readsColor()) {
fColor = GrColor_ILLEGAL;
}
- overrides.getOverrideColorIfSet(&fColor);
- fUsesLocalCoords = overrides.readsLocalCoords();
- fCoverageIgnored = !overrides.readsCoverage();
+ optimizations.getOverrideColorIfSet(&fColor);
+ fUsesLocalCoords = optimizations.readsLocalCoords();
+ fCoverageIgnored = !optimizations.readsCoverage();
}
void onPrepareDraws(Target* target) const override {
diff --git a/src/gpu/ops/GrDrawAtlasOp.cpp b/src/gpu/ops/GrDrawAtlasOp.cpp
index e01ad73671..3ce079b9d5 100644
--- a/src/gpu/ops/GrDrawAtlasOp.cpp
+++ b/src/gpu/ops/GrDrawAtlasOp.cpp
@@ -12,13 +12,12 @@
#include "SkRSXform.h"
#include "SkRandom.h"
-void GrDrawAtlasOp::initBatchTracker(const GrXPOverridesForBatch& overrides) {
+void GrDrawAtlasOp::applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) {
SkASSERT(fGeoData.count() == 1);
- // Handle any color overrides
- if (!overrides.readsColor()) {
+ if (!optimizations.readsColor()) {
fGeoData[0].fColor = GrColor_ILLEGAL;
}
- if (overrides.getOverrideColorIfSet(&fGeoData[0].fColor) && fHasColors) {
+ if (optimizations.getOverrideColorIfSet(&fGeoData[0].fColor) && fHasColors) {
size_t vertexStride =
sizeof(SkPoint) + sizeof(SkPoint) + (this->hasColors() ? sizeof(GrColor) : 0);
uint8_t* currVertex = fGeoData[0].fVerts.begin();
@@ -29,11 +28,11 @@ void GrDrawAtlasOp::initBatchTracker(const GrXPOverridesForBatch& overrides) {
}
// setup batch properties
- fColorIgnored = !overrides.readsColor();
+ fColorIgnored = !optimizations.readsColor();
fColor = fGeoData[0].fColor;
// We'd like to assert this, but we can't because of GLPrograms test
// SkASSERT(init.readsLocalCoords());
- fCoverageIgnored = !overrides.readsCoverage();
+ fCoverageIgnored = !optimizations.readsCoverage();
}
static sk_sp<GrGeometryProcessor> set_vertex_attributes(bool hasColors,
diff --git a/src/gpu/ops/GrDrawAtlasOp.h b/src/gpu/ops/GrDrawAtlasOp.h
index 9913ec2906..ec21162e26 100644
--- a/src/gpu/ops/GrDrawAtlasOp.h
+++ b/src/gpu/ops/GrDrawAtlasOp.h
@@ -35,25 +35,22 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- // When this is called there is only one atlas draw.
+private:
+ GrDrawAtlasOp(GrColor color, const SkMatrix& viewMatrix, int spriteCount,
+ const SkRSXform* xforms, const SkRect* rects, const SkColor* colors);
+
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
if (this->hasColors()) {
- color->setUnknownFourComponents();
+ input->pipelineColorInput()->setUnknownFourComponents();
} else {
- color->setKnownFourComponents(fGeoData[0].fColor);
+ input->pipelineColorInput()->setKnownFourComponents(fGeoData[0].fColor);
}
- coverage->setKnownSingleComponent(0xff);
+ input->pipelineCoverageInput()->setKnownSingleComponent(0xff);
}
-private:
- GrDrawAtlasOp(GrColor color, const SkMatrix& viewMatrix, int spriteCount,
- const SkRSXform* xforms, const SkRect* rects, const SkColor* colors);
-
void onPrepareDraws(Target*) const override;
- void initBatchTracker(const GrXPOverridesForBatch&) override;
+ void applyPipelineOptimizations(const GrPipelineOptimizations&) override;
GrColor color() const { return fColor; }
bool colorIgnored() const { return fColorIgnored; }
diff --git a/src/gpu/ops/GrDrawOp.cpp b/src/gpu/ops/GrDrawOp.cpp
index 3abf2ceba1..f778601aba 100644
--- a/src/gpu/ops/GrDrawOp.cpp
+++ b/src/gpu/ops/GrDrawOp.cpp
@@ -15,21 +15,23 @@ GrDrawOp::~GrDrawOp() {
}
}
-void GrDrawOp::getPipelineOptimizations(GrPipelineOptimizations* opt) const {
- GrInitInvariantOutput color;
- GrInitInvariantOutput coverage;
- this->computePipelineOptimizations(&color, &coverage, &opt->fOverrides);
- opt->fColorPOI.initUsingInvariantOutput(color);
- opt->fCoveragePOI.initUsingInvariantOutput(coverage);
+void GrDrawOp::initPipelineAnalysis(GrPipelineAnalysis* analysis) const {
+ GrPipelineInput color;
+ GrPipelineInput coverage;
+ GrPipelineAnalysisDrawOpInput input(&color, &coverage);
+ this->getPipelineAnalysisInput(&input);
+ analysis->fColorPOI.initFromPipelineInput(color);
+ analysis->fCoveragePOI.initFromPipelineInput(coverage);
+ analysis->fUsesPLSDstRead = input.usesPLSDstRead();
}
bool GrDrawOp::installPipeline(const GrPipeline::CreateArgs& args) {
- GrXPOverridesForBatch overrides;
+ GrPipelineOptimizations optimizations;
void* location = fPipelineStorage.get();
- if (!GrPipeline::CreateAt(location, args, &overrides)) {
+ if (!GrPipeline::CreateAt(location, args, &optimizations)) {
return false;
}
fPipelineInstalled = true;
- this->initBatchTracker(overrides);
+ this->applyPipelineOptimizations(optimizations);
return true;
}
diff --git a/src/gpu/ops/GrDrawOp.h b/src/gpu/ops/GrDrawOp.h
index 7606b0c27c..929513cc2f 100644
--- a/src/gpu/ops/GrDrawOp.h
+++ b/src/gpu/ops/GrDrawOp.h
@@ -12,8 +12,6 @@
#include "GrOp.h"
#include "GrPipeline.h"
-struct GrInitInvariantOutput;
-
/**
* GrDrawOps are flushed in two phases (preDraw, and draw). In preDraw uploads to GrGpuResources
* and draws are determined and scheduled. They are issued in the draw phase. GrDrawOpUploadToken is
@@ -60,9 +58,9 @@ public:
~GrDrawOp() override;
/**
- * Fills in a structure informing the XP of overrides to its normal behavior.
+ * Gets the inputs to pipeline analysis from the GrDrawOp.
*/
- void getPipelineOptimizations(GrPipelineOptimizations* override) const;
+ void initPipelineAnalysis(GrPipelineAnalysis*) const;
bool installPipeline(const GrPipeline::CreateArgs&);
@@ -112,16 +110,18 @@ protected:
return reinterpret_cast<const GrPipeline*>(fPipelineStorage.get());
}
- virtual void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const = 0;
-
private:
/**
- * initBatchTracker is a hook for the some additional overrides / optimization possibilities
- * from the GrXferProcessor.
+ * Provides information about the GrPrimitiveProccesor that will be used to issue draws by this
+ * op to GrPipeline analysis.
+ */
+ virtual void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput*) const = 0;
+
+ /**
+ * After GrPipeline analysis is complete this is called so that the op can use the analysis
+ * results when constructing its GrPrimitiveProcessor.
*/
- virtual void initBatchTracker(const GrXPOverridesForBatch&) = 0;
+ virtual void applyPipelineOptimizations(const GrPipelineOptimizations&) = 0;
protected:
struct QueuedUpload {
diff --git a/src/gpu/ops/GrDrawPathOp.cpp b/src/gpu/ops/GrDrawPathOp.cpp
index 43e1c38b88..8ca097e3e3 100644
--- a/src/gpu/ops/GrDrawPathOp.cpp
+++ b/src/gpu/ops/GrDrawPathOp.cpp
@@ -31,7 +31,7 @@ void GrDrawPathOp::onDraw(GrOpFlushState* state, const SkRect& bounds) {
GrProgramDesc desc;
sk_sp<GrPathProcessor> pathProc(
- GrPathProcessor::Create(this->color(), this->overrides(), this->viewMatrix()));
+ GrPathProcessor::Create(this->color(), this->optimizations(), this->viewMatrix()));
state->gpu()->pathRendering()->drawPath(*this->pipeline(), *pathProc,
this->stencilPassSettings(), fPath.get());
}
@@ -100,10 +100,10 @@ bool GrDrawPathRangeOp::onCombineIfPossible(GrOp* t, const GrCaps& caps) {
// combined. (Glyphs in the same font tend to wind the same direction so it works out OK.)
if (GrPathRendering::kWinding_FillType != this->fillType() ||
GrPathRendering::kWinding_FillType != that->fillType() ||
- this->overrides().willColorBlendWithDst()) {
+ this->optimizations().willColorBlendWithDst()) {
return false;
}
- SkASSERT(!that->overrides().willColorBlendWithDst());
+ SkASSERT(!that->optimizations().willColorBlendWithDst());
fTotalPathCount += that->fTotalPathCount;
while (Draw* head = that->fDraws.head()) {
Draw* draw = fDraws.addToTail();
@@ -128,7 +128,7 @@ void GrDrawPathRangeOp::onDraw(GrOpFlushState* state, const SkRect& bounds) {
localMatrix.preTranslate(head.fX, head.fY);
sk_sp<GrPathProcessor> pathProc(
- GrPathProcessor::Create(this->color(), this->overrides(), drawMatrix, localMatrix));
+ GrPathProcessor::Create(this->color(), this->optimizations(), drawMatrix, localMatrix));
if (fDraws.count() == 1) {
const InstanceData& instances = *head.fInstanceData;
diff --git a/src/gpu/ops/GrDrawPathOp.h b/src/gpu/ops/GrDrawPathOp.h
index f85e6fd13d..5d6c35d0e9 100644
--- a/src/gpu/ops/GrDrawPathOp.h
+++ b/src/gpu/ops/GrDrawPathOp.h
@@ -19,14 +19,6 @@
#include "SkTLList.h"
class GrDrawPathOpBase : public GrDrawOp {
-public:
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- color->setKnownFourComponents(fColor);
- coverage->setKnownSingleComponent(0xff);
- }
-
protected:
GrDrawPathOpBase(uint32_t classID, const SkMatrix& viewMatrix, GrColor initialColor,
GrPathRendering::FillType fill)
@@ -36,15 +28,22 @@ protected:
SkASSERT(!fStencilPassSettings.isDisabled()); // This shouldn't be called before onPrepare.
return fStencilPassSettings;
}
- const GrXPOverridesForBatch& overrides() const { return fOverrides; }
+
+protected:
+ const GrPipelineOptimizations& optimizations() const { return fOptimizations; }
const SkMatrix& viewMatrix() const { return fViewMatrix; }
GrColor color() const { return fColor; }
GrPathRendering::FillType fillType() const { return fFillType; }
private:
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- overrides.getOverrideColorIfSet(&fColor);
- fOverrides = overrides;
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fColor);
+ input->pipelineCoverageInput()->setKnownSingleComponent(0xFF);
+ }
+
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ optimizations.getOverrideColorIfSet(&fColor);
+ fOptimizations = optimizations;
}
void onPrepare(GrOpFlushState*) override; // Initializes fStencilPassSettings.
@@ -53,7 +52,7 @@ private:
GrColor fColor;
GrPathRendering::FillType fFillType;
GrStencilSettings fStencilPassSettings;
- GrXPOverridesForBatch fOverrides;
+ GrPipelineOptimizations fOptimizations;
typedef GrDrawOp INHERITED;
};
diff --git a/src/gpu/ops/GrDrawVerticesOp.cpp b/src/gpu/ops/GrDrawVerticesOp.cpp
index c6ae1c1efa..12c2a0bdbb 100644
--- a/src/gpu/ops/GrDrawVerticesOp.cpp
+++ b/src/gpu/ops/GrDrawVerticesOp.cpp
@@ -71,28 +71,25 @@ GrDrawVerticesOp::GrDrawVerticesOp(GrColor color, GrPrimitiveType primitiveType,
this->setBounds(bounds, HasAABloat::kNo, zeroArea);
}
-void GrDrawVerticesOp::computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const {
- // When this is called there is only one mesh.
+void GrDrawVerticesOp::getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const {
if (fVariableColor) {
- color->setUnknownFourComponents();
+ input->pipelineColorInput()->setUnknownFourComponents();
} else {
- color->setKnownFourComponents(fMeshes[0].fColor);
+ input->pipelineColorInput()->setKnownFourComponents(fMeshes[0].fColor);
}
- coverage->setKnownSingleComponent(0xff);
+ input->pipelineCoverageInput()->setKnownSingleComponent(0xff);
}
-void GrDrawVerticesOp::initBatchTracker(const GrXPOverridesForBatch& overrides) {
+void GrDrawVerticesOp::applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) {
SkASSERT(fMeshes.count() == 1);
GrColor overrideColor;
- if (overrides.getOverrideColorIfSet(&overrideColor)) {
+ if (optimizations.getOverrideColorIfSet(&overrideColor)) {
fMeshes[0].fColor = overrideColor;
fMeshes[0].fColors.reset();
fVariableColor = false;
}
- fCoverageIgnored = !overrides.readsCoverage();
- if (!overrides.readsLocalCoords()) {
+ fCoverageIgnored = !optimizations.readsCoverage();
+ if (!optimizations.readsLocalCoords()) {
fMeshes[0].fLocalCoords.reset();
}
}
diff --git a/src/gpu/ops/GrDrawVerticesOp.h b/src/gpu/ops/GrDrawVerticesOp.h
index 7cbf24f951..57215fca79 100644
--- a/src/gpu/ops/GrDrawVerticesOp.h
+++ b/src/gpu/ops/GrDrawVerticesOp.h
@@ -43,18 +43,15 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override;
-
private:
GrDrawVerticesOp(GrColor color, GrPrimitiveType primitiveType, const SkMatrix& viewMatrix,
const SkPoint* positions, int vertexCount, const uint16_t* indices,
int indexCount, const GrColor* colors, const SkPoint* localCoords,
const SkRect& bounds);
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override;
+ void applyPipelineOptimizations(const GrPipelineOptimizations&) override;
void onPrepareDraws(Target*) const override;
- void initBatchTracker(const GrXPOverridesForBatch&) override;
GrPrimitiveType primitiveType() const { return fPrimitiveType; }
bool batchablePrimitiveType() const {
@@ -78,7 +75,7 @@ private:
bool fVariableColor;
int fVertexCount;
int fIndexCount;
- bool fCoverageIgnored; // comes from initBatchTracker.
+ bool fCoverageIgnored; // comes from applyPipelineOptimizations.
SkSTArray<1, Mesh, true> fMeshes;
diff --git a/src/gpu/ops/GrLatticeOp.cpp b/src/gpu/ops/GrLatticeOp.cpp
index 119032209d..af83aa629d 100644
--- a/src/gpu/ops/GrLatticeOp.cpp
+++ b/src/gpu/ops/GrLatticeOp.cpp
@@ -62,16 +62,19 @@ public:
return str;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- color->setUnknownFourComponents();
- coverage->setKnownSingleComponent(0xff);
+private:
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setUnknownFourComponents();
+ input->pipelineCoverageInput()->setKnownSingleComponent(0xff);
+ }
+
+ void applyPipelineOptimizations(const GrPipelineOptimizations& analysioptimizations) override {
+ analysioptimizations.getOverrideColorIfSet(&fPatches[0].fColor);
+ fOptimizations = analysioptimizations;
}
-private:
void onPrepareDraws(Target* target) const override {
- sk_sp<GrGeometryProcessor> gp(create_gp(fOverrides.readsCoverage()));
+ sk_sp<GrGeometryProcessor> gp(create_gp(fOptimizations.readsCoverage()));
if (!gp) {
SkDebugf("Couldn't create GrGeometryProcessor\n");
return;
@@ -135,11 +138,6 @@ private:
helper.recordDraw(target, gp.get());
}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- overrides.getOverrideColorIfSet(&fPatches[0].fColor);
- fOverrides = overrides;
- }
-
bool onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
NonAALatticeOp* that = t->cast<NonAALatticeOp>();
if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
@@ -152,8 +150,9 @@ private:
// In the event of two ops, one who can tweak, one who cannot, we just fall back to not
// tweaking.
- if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakAlphaForCoverage()) {
- fOverrides = that->fOverrides;
+ if (fOptimizations.canTweakAlphaForCoverage() &&
+ !that->fOptimizations.canTweakAlphaForCoverage()) {
+ fOptimizations = that->fOptimizations;
}
fPatches.move_back_n(that->fPatches.count(), that->fPatches.begin());
@@ -168,7 +167,7 @@ private:
GrColor fColor;
};
- GrXPOverridesForBatch fOverrides;
+ GrPipelineOptimizations fOptimizations;
int fImageWidth;
int fImageHeight;
SkSTArray<1, Patch, true> fPatches;
diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp
index c77c8e7fa4..1a73ca20a7 100644
--- a/src/gpu/ops/GrMSAAPathRenderer.cpp
+++ b/src/gpu/ops/GrMSAAPathRenderer.cpp
@@ -246,14 +246,6 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- // When this is called there is only one path.
- color->setKnownFourComponents(fPaths[0].fColor);
- coverage->setKnownSingleComponent(0xff);
- }
-
private:
MSAAPathOp(GrColor color, const SkPath& path, const SkMatrix& viewMatrix,
const SkRect& devBounds, int maxLineVertices, int maxQuadVertices, bool isIndexed)
@@ -266,12 +258,16 @@ private:
this->setBounds(devBounds, HasAABloat::kNo, IsZeroArea::kNo);
}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- // Handle any color overrides
- if (!overrides.readsColor()) {
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fPaths[0].fColor);
+ input->pipelineCoverageInput()->setKnownSingleComponent(0xff);
+ }
+
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ if (!optimizations.readsColor()) {
fPaths[0].fColor = GrColor_ILLEGAL;
}
- overrides.getOverrideColorIfSet(&fPaths[0].fColor);
+ optimizations.getOverrideColorIfSet(&fPaths[0].fColor);
}
static void ComputeWorstCasePointCount(const SkPath& path, int* subpaths,
diff --git a/src/gpu/ops/GrNonAAFillRectOp.cpp b/src/gpu/ops/GrNonAAFillRectOp.cpp
index e672985507..3995790d6f 100644
--- a/src/gpu/ops/GrNonAAFillRectOp.cpp
+++ b/src/gpu/ops/GrNonAAFillRectOp.cpp
@@ -110,24 +110,21 @@ public:
return str;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- // When this is called there is only one rect.
- color->setKnownFourComponents(fRects[0].fColor);
- coverage->setKnownSingleComponent(0xff);
- }
+private:
+ NonAAFillRectOp() : INHERITED(ClassID()) {}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- overrides.getOverrideColorIfSet(&fRects[0].fColor);
- fOverrides = overrides;
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fRects[0].fColor);
+ input->pipelineCoverageInput()->setKnownSingleComponent(0xff);
}
-private:
- NonAAFillRectOp() : INHERITED(ClassID()) {}
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ optimizations.getOverrideColorIfSet(&fRects[0].fColor);
+ fOptimizations = optimizations;
+ }
void onPrepareDraws(Target* target) const override {
- sk_sp<GrGeometryProcessor> gp = make_gp(fOverrides.readsCoverage());
+ sk_sp<GrGeometryProcessor> gp = make_gp(fOptimizations.readsCoverage());
if (!gp) {
SkDebugf("Couldn't create GrGeometryProcessor\n");
return;
@@ -166,8 +163,9 @@ private:
// In the event of two ops, one who can tweak, one who cannot, we just fall back to not
// tweaking.
- if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakAlphaForCoverage()) {
- fOverrides = that->fOverrides;
+ if (fOptimizations.canTweakAlphaForCoverage() &&
+ !that->fOptimizations.canTweakAlphaForCoverage()) {
+ fOptimizations = that->fOptimizations;
}
fRects.push_back_n(that->fRects.count(), that->fRects.begin());
@@ -182,7 +180,7 @@ private:
GrQuad fLocalQuad;
};
- GrXPOverridesForBatch fOverrides;
+ GrPipelineOptimizations fOptimizations;
SkSTArray<1, RectInfo, true> fRects;
typedef GrMeshDrawOp INHERITED;
diff --git a/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp b/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp
index fde4328abf..d58e52cd6d 100644
--- a/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp
+++ b/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp
@@ -127,25 +127,22 @@ public:
return str;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- // When this is called on a batch, there is only one geometry bundle
- color->setKnownFourComponents(fRects[0].fColor);
- coverage->setKnownSingleComponent(0xff);
- }
+private:
+ NonAAFillRectPerspectiveOp() : INHERITED(ClassID()) {}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- overrides.getOverrideColorIfSet(&fRects[0].fColor);
- fOverrides = overrides;
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fRects[0].fColor);
+ input->pipelineCoverageInput()->setKnownSingleComponent(0xff);
}
-private:
- NonAAFillRectPerspectiveOp() : INHERITED(ClassID()) {}
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ optimizations.getOverrideColorIfSet(&fRects[0].fColor);
+ fOptimizations = optimizations;
+ }
void onPrepareDraws(Target* target) const override {
sk_sp<GrGeometryProcessor> gp = make_persp_gp(fViewMatrix,
- fOverrides.readsCoverage(),
+ fOptimizations.readsCoverage(),
fHasLocalRect,
fHasLocalMatrix ? &fLocalMatrix : nullptr);
if (!gp) {
@@ -205,8 +202,9 @@ private:
// In the event of two batches, one who can tweak, one who cannot, we just fall back to
// not tweaking
- if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakAlphaForCoverage()) {
- fOverrides = that->fOverrides;
+ if (fOptimizations.canTweakAlphaForCoverage() &&
+ !that->fOptimizations.canTweakAlphaForCoverage()) {
+ fOptimizations = that->fOptimizations;
}
fRects.push_back_n(that->fRects.count(), that->fRects.begin());
@@ -220,7 +218,7 @@ private:
SkRect fLocalRect;
};
- GrXPOverridesForBatch fOverrides;
+ GrPipelineOptimizations fOptimizations;
SkSTArray<1, RectInfo, true> fRects;
bool fHasLocalMatrix;
bool fHasLocalRect;
diff --git a/src/gpu/ops/GrNonAAStrokeRectOp.cpp b/src/gpu/ops/GrNonAAStrokeRectOp.cpp
index 065f08a9ee..09eb656f10 100644
--- a/src/gpu/ops/GrNonAAStrokeRectOp.cpp
+++ b/src/gpu/ops/GrNonAAStrokeRectOp.cpp
@@ -62,14 +62,6 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- // When this is called on a batch, there is only one geometry bundle
- color->setKnownFourComponents(fColor);
- coverage->setKnownSingleComponent(0xff);
- }
-
static sk_sp<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix, const SkRect& rect,
const SkStrokeRec& stroke, bool snapToPixelCenters) {
if (!allowed_stroke(stroke)) {
@@ -108,15 +100,21 @@ public:
private:
NonAAStrokeRectOp() : INHERITED(ClassID()) {}
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fColor);
+ input->pipelineCoverageInput()->setKnownSingleComponent(0xFF);
+ }
+
void onPrepareDraws(Target* target) const override {
sk_sp<GrGeometryProcessor> gp;
{
using namespace GrDefaultGeoProcFactory;
Color color(fColor);
- Coverage coverage(fOverrides.readsCoverage() ? Coverage::kSolid_Type
- : Coverage::kNone_Type);
- LocalCoords localCoords(fOverrides.readsLocalCoords() ? LocalCoords::kUsePosition_Type
- : LocalCoords::kUnused_Type);
+ Coverage coverage(fOptimizations.readsCoverage() ? Coverage::kSolid_Type
+ : Coverage::kNone_Type);
+ LocalCoords localCoords(fOptimizations.readsLocalCoords()
+ ? LocalCoords::kUsePosition_Type
+ : LocalCoords::kUnused_Type);
gp = GrDefaultGeoProcFactory::Make(color, coverage, localCoords, fViewMatrix);
}
@@ -161,9 +159,9 @@ private:
target->draw(gp.get(), mesh);
}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- overrides.getOverrideColorIfSet(&fColor);
- fOverrides = overrides;
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ optimizations.getOverrideColorIfSet(&fColor);
+ fOptimizations = optimizations;
}
bool onCombineIfPossible(GrOp* t, const GrCaps&) override {
@@ -176,8 +174,7 @@ private:
SkMatrix fViewMatrix;
SkRect fRect;
SkScalar fStrokeWidth;
-
- GrXPOverridesForBatch fOverrides;
+ GrPipelineOptimizations fOptimizations;
const static int kVertsPerHairlineRect = 5;
const static int kVertsPerStrokeRect = 10;
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index 10fc37572a..321d15dbcc 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -797,20 +797,17 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- // When this is called there is only one circle.
- color->setKnownFourComponents(fGeoData[0].fColor);
- coverage->setUnknownSingleComponent();
- }
-
private:
CircleOp() : INHERITED(ClassID()) {}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- // Handle any overrides that affect our GP.
- overrides.getOverrideColorIfSet(&fGeoData[0].fColor);
- if (!overrides.readsLocalCoords()) {
+
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fGeoData[0].fColor);
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
+ }
+
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ optimizations.getOverrideColorIfSet(&fGeoData[0].fColor);
+ if (!optimizations.readsLocalCoords()) {
fViewMatrixIfUsingLocalCoords.reset();
}
}
@@ -1245,23 +1242,19 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- // When this is called, there is only one ellipse.
- color->setKnownFourComponents(fGeoData[0].fColor);
- coverage->setUnknownSingleComponent();
- }
-
private:
EllipseOp() : INHERITED(ClassID()) {}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- // Handle any overrides that affect our GP.
- if (!overrides.readsCoverage()) {
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fGeoData[0].fColor);
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
+ }
+
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ if (!optimizations.readsCoverage()) {
fGeoData[0].fColor = GrColor_ILLEGAL;
}
- if (!overrides.readsLocalCoords()) {
+ if (!optimizations.readsLocalCoords()) {
fViewMatrixIfUsingLocalCoords.reset();
}
}
@@ -1466,21 +1459,17 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- // When this is called there is only one ellipse.
- color->setKnownFourComponents(fGeoData[0].fColor);
- coverage->setUnknownSingleComponent();
- }
-
private:
DIEllipseOp() : INHERITED(ClassID()) {}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- // Handle any overrides that affect our GP.
- overrides.getOverrideColorIfSet(&fGeoData[0].fColor);
- fUsesLocalCoords = overrides.readsLocalCoords();
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fGeoData[0].fColor);
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
+ }
+
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ optimizations.getOverrideColorIfSet(&fGeoData[0].fColor);
+ fUsesLocalCoords = optimizations.readsLocalCoords();
}
void onPrepareDraws(Target* target) const override {
@@ -1787,19 +1776,15 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- // When this is called there is only one rrect.
- color->setKnownFourComponents(fGeoData[0].fColor);
- coverage->setUnknownSingleComponent();
+private:
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fGeoData[0].fColor);
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
}
-private:
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- // Handle any overrides that affect our GP.
- overrides.getOverrideColorIfSet(&fGeoData[0].fColor);
- if (!overrides.readsLocalCoords()) {
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ optimizations.getOverrideColorIfSet(&fGeoData[0].fColor);
+ if (!optimizations.readsLocalCoords()) {
fViewMatrixIfUsingLocalCoords.reset();
}
}
@@ -2145,21 +2130,17 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- // When this is called there is only one rrect.
- color->setKnownFourComponents(fGeoData[0].fColor);
- coverage->setUnknownSingleComponent();
- }
-
private:
EllipticalRRectOp() : INHERITED(ClassID()) {}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- // Handle overrides that affect our GP.
- overrides.getOverrideColorIfSet(&fGeoData[0].fColor);
- if (!overrides.readsLocalCoords()) {
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fGeoData[0].fColor);
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
+ }
+
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ optimizations.getOverrideColorIfSet(&fGeoData[0].fColor);
+ if (!optimizations.readsLocalCoords()) {
fViewMatrixIfUsingLocalCoords.reset();
}
}
diff --git a/src/gpu/ops/GrPLSPathRenderer.cpp b/src/gpu/ops/GrPLSPathRenderer.cpp
index e4d11de3b1..47c54d721a 100644
--- a/src/gpu/ops/GrPLSPathRenderer.cpp
+++ b/src/gpu/ops/GrPLSPathRenderer.cpp
@@ -780,22 +780,27 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- color->setKnownFourComponents(fColor);
- coverage->setUnknownSingleComponent();
- overrides->fUsePLSDstRead = true;
+private:
+ PLSPathOp(GrColor color, const SkPath& path, const SkMatrix& viewMatrix)
+ : INHERITED(ClassID()), fColor(color), fPath(path), fViewMatrix(viewMatrix) {
+ // compute bounds
+ this->setTransformedBounds(path.getBounds(), fViewMatrix, HasAABloat::kYes,
+ IsZeroArea::kNo);
+ }
+
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fColor);
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
+ input->setUsesPLSDstRead();
}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- // Handle any color overrides
- if (!overrides.readsColor()) {
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ if (!optimizations.readsColor()) {
fColor = GrColor_ILLEGAL;
}
- overrides.getOverrideColorIfSet(&fColor);
+ optimizations.getOverrideColorIfSet(&fColor);
- fUsesLocalCoords = overrides.readsLocalCoords();
+ fUsesLocalCoords = optimizations.readsLocalCoords();
}
void onPrepareDraws(Target* target) const override {
@@ -906,14 +911,6 @@ public:
target->draw(finishProcessor.get(), mesh);
}
-private:
- PLSPathOp(GrColor color, const SkPath& path, const SkMatrix& viewMatrix)
- : INHERITED(ClassID()), fColor(color), fPath(path), fViewMatrix(viewMatrix) {
- // compute bounds
- this->setTransformedBounds(path.getBounds(), fViewMatrix, HasAABloat::kYes,
- IsZeroArea::kNo);
- }
-
bool onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
return false;
}
diff --git a/src/gpu/ops/GrRegionOp.cpp b/src/gpu/ops/GrRegionOp.cpp
index e98bbf0261..1128b927b2 100644
--- a/src/gpu/ops/GrRegionOp.cpp
+++ b/src/gpu/ops/GrRegionOp.cpp
@@ -79,22 +79,19 @@ public:
return str;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- // When this is called there is only one region.
- color->setKnownFourComponents(fRegions[0].fColor);
- coverage->setKnownSingleComponent(0xff);
+private:
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fRegions[0].fColor);
+ input->pipelineCoverageInput()->setKnownSingleComponent(0xff);
}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- overrides.getOverrideColorIfSet(&fRegions[0].fColor);
- fOverrides = overrides;
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ optimizations.getOverrideColorIfSet(&fRegions[0].fColor);
+ fOptimizations = optimizations;
}
-private:
void onPrepareDraws(Target* target) const override {
- sk_sp<GrGeometryProcessor> gp = make_gp(fOverrides.readsCoverage(), fViewMatrix);
+ sk_sp<GrGeometryProcessor> gp = make_gp(fOptimizations.readsCoverage(), fViewMatrix);
if (!gp) {
SkDebugf("Couldn't create GrGeometryProcessor\n");
return;
@@ -149,7 +146,7 @@ private:
};
SkMatrix fViewMatrix;
- GrXPOverridesForBatch fOverrides;
+ GrPipelineOptimizations fOptimizations;
SkSTArray<1, RegionInfo, true> fRegions;
typedef GrMeshDrawOp INHERITED;
diff --git a/src/gpu/ops/GrShadowRRectOp.cpp b/src/gpu/ops/GrShadowRRectOp.cpp
index 302f1741e3..5da8c29cac 100755
--- a/src/gpu/ops/GrShadowRRectOp.cpp
+++ b/src/gpu/ops/GrShadowRRectOp.cpp
@@ -114,8 +114,8 @@ public:
SkRect devBounds = SkRect::MakeLTRB(center.fX - outerRadius, center.fY - outerRadius,
center.fX + outerRadius, center.fY + outerRadius);
- op->fGeoData.emplace_back(
- Geometry{color, outerRadius, innerRadius, blurRadius, devBounds, stroked});
+ op->fCircles.emplace_back(
+ Circle{color, outerRadius, innerRadius, blurRadius, devBounds, stroked});
// Use the original radius and stroke radius for the bounds so that it does not include the
// AA bloat.
@@ -132,33 +132,30 @@ public:
SkString dumpInfo() const override {
SkString string;
- for (int i = 0; i < fGeoData.count(); ++i) {
+ for (int i = 0; i < fCircles.count(); ++i) {
string.appendf(
"Color: 0x%08x Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f], "
"OuterRad: %.2f, InnerRad: %.2f, BlurRad: %.2f\n",
- fGeoData[i].fColor, fGeoData[i].fDevBounds.fLeft, fGeoData[i].fDevBounds.fTop,
- fGeoData[i].fDevBounds.fRight, fGeoData[i].fDevBounds.fBottom,
- fGeoData[i].fOuterRadius, fGeoData[i].fInnerRadius, fGeoData[i].fBlurRadius);
+ fCircles[i].fColor, fCircles[i].fDevBounds.fLeft, fCircles[i].fDevBounds.fTop,
+ fCircles[i].fDevBounds.fRight, fCircles[i].fDevBounds.fBottom,
+ fCircles[i].fOuterRadius, fCircles[i].fInnerRadius, fCircles[i].fBlurRadius);
}
string.append(DumpPipelineInfo(*this->pipeline()));
string.append(INHERITED::dumpInfo());
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- // When this is called on a batch, there is only one geometry bundle
- color->setKnownFourComponents(fGeoData[0].fColor);
- coverage->setUnknownSingleComponent();
- }
-
private:
ShadowCircleOp() : INHERITED(ClassID()) {}
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- // Handle any overrides that affect our GP.
- overrides.getOverrideColorIfSet(&fGeoData[0].fColor);
- if (!overrides.readsLocalCoords()) {
+
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fCircles[0].fColor);
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
+ }
+
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ optimizations.getOverrideColorIfSet(&fCircles[0].fColor);
+ if (!optimizations.readsLocalCoords()) {
fViewMatrixIfUsingLocalCoords.reset();
}
}
@@ -180,7 +177,7 @@ private:
SkScalar fBlurRadius;
};
- int instanceCount = fGeoData.count();
+ int instanceCount = fCircles.count();
size_t vertexStride = gp->getVertexStride();
SkASSERT(vertexStride == sizeof(CircleVertex));
@@ -203,14 +200,14 @@ private:
int currStartVertex = 0;
for (int i = 0; i < instanceCount; i++) {
- const Geometry& geom = fGeoData[i];
+ const Circle& circle = fCircles[i];
- GrColor color = geom.fColor;
- SkScalar outerRadius = geom.fOuterRadius;
- SkScalar innerRadius = geom.fInnerRadius;
- SkScalar blurRadius = geom.fBlurRadius;
+ GrColor color = circle.fColor;
+ SkScalar outerRadius = circle.fOuterRadius;
+ SkScalar innerRadius = circle.fInnerRadius;
+ SkScalar blurRadius = circle.fBlurRadius;
- const SkRect& bounds = geom.fDevBounds;
+ const SkRect& bounds = circle.fDevBounds;
CircleVertex* ov0 = reinterpret_cast<CircleVertex*>(vertices + 0 * vertexStride);
CircleVertex* ov1 = reinterpret_cast<CircleVertex*>(vertices + 1 * vertexStride);
CircleVertex* ov2 = reinterpret_cast<CircleVertex*>(vertices + 2 * vertexStride);
@@ -275,7 +272,7 @@ private:
ov7->fOuterRadius = outerRadius;
ov7->fBlurRadius = blurRadius;
- if (geom.fStroked) {
+ if (circle.fStroked) {
// compute the inner ring
CircleVertex* iv0 = reinterpret_cast<CircleVertex*>(vertices + 8 * vertexStride);
CircleVertex* iv1 = reinterpret_cast<CircleVertex*>(vertices + 9 * vertexStride);
@@ -289,7 +286,7 @@ private:
// cosine and sine of pi/8
SkScalar c = 0.923579533f;
SkScalar s = 0.382683432f;
- SkScalar r = geom.fInnerRadius;
+ SkScalar r = circle.fInnerRadius;
iv0->fPos = center + SkPoint::Make(-s * r, -c * r);
iv0->fColor = color;
@@ -348,14 +345,14 @@ private:
iv->fBlurRadius = blurRadius;
}
- const uint16_t* primIndices = circle_type_to_indices(geom.fStroked);
- const int primIndexCount = circle_type_to_index_count(geom.fStroked);
+ const uint16_t* primIndices = circle_type_to_indices(circle.fStroked);
+ const int primIndexCount = circle_type_to_index_count(circle.fStroked);
for (int i = 0; i < primIndexCount; ++i) {
*indices++ = primIndices[i] + currStartVertex;
}
- currStartVertex += circle_type_to_vert_count(geom.fStroked);
- vertices += circle_type_to_vert_count(geom.fStroked) * vertexStride;
+ currStartVertex += circle_type_to_vert_count(circle.fStroked);
+ vertices += circle_type_to_vert_count(circle.fStroked) * vertexStride;
}
GrMesh mesh;
@@ -375,14 +372,14 @@ private:
return false;
}
- fGeoData.push_back_n(that->fGeoData.count(), that->fGeoData.begin());
+ fCircles.push_back_n(that->fCircles.count(), that->fCircles.begin());
this->joinBounds(*that);
fVertCount += that->fVertCount;
fIndexCount += that->fIndexCount;
return true;
}
- struct Geometry {
+ struct Circle {
GrColor fColor;
SkScalar fOuterRadius;
SkScalar fInnerRadius;
@@ -391,7 +388,7 @@ private:
bool fStroked;
};
- SkSTArray<1, Geometry, true> fGeoData;
+ SkSTArray<1, Circle, true> fCircles;
SkMatrix fViewMatrixIfUsingLocalCoords;
int fVertCount;
int fIndexCount;
@@ -584,19 +581,15 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- // When this is called on a batch, there is only one geometry bundle
- color->setKnownFourComponents(fGeoData[0].fColor);
- coverage->setUnknownSingleComponent();
+private:
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fGeoData[0].fColor);
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
}
-private:
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- // Handle any overrides that affect our GP.
- overrides.getOverrideColorIfSet(&fGeoData[0].fColor);
- if (!overrides.readsLocalCoords()) {
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ optimizations.getOverrideColorIfSet(&fGeoData[0].fColor);
+ if (!optimizations.readsLocalCoords()) {
fViewMatrixIfUsingLocalCoords.reset();
}
}
diff --git a/src/gpu/ops/GrTessellatingPathRenderer.cpp b/src/gpu/ops/GrTessellatingPathRenderer.cpp
index 1de24da1c1..7774798b1f 100644
--- a/src/gpu/ops/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/ops/GrTessellatingPathRenderer.cpp
@@ -179,21 +179,18 @@ public:
return string;
}
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- color->setKnownFourComponents(fColor);
- coverage->setUnknownSingleComponent();
+private:
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fColor);
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
}
-private:
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- // Handle any color overrides
- if (!overrides.readsColor()) {
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ if (!optimizations.readsColor()) {
fColor = GrColor_ILLEGAL;
}
- overrides.getOverrideColorIfSet(&fColor);
- fPipelineInfo = overrides;
+ optimizations.getOverrideColorIfSet(&fColor);
+ fOptimizations = optimizations;
}
SkPath getPath() const {
@@ -265,7 +262,7 @@ private:
SkScalar tol = GrPathUtils::kDefaultTolerance;
bool isLinear;
DynamicVertexAllocator allocator(gp->getVertexStride(), target);
- bool canTweakAlphaForCoverage = fPipelineInfo.canTweakAlphaForCoverage();
+ bool canTweakAlphaForCoverage = fOptimizations.canTweakAlphaForCoverage();
int count = GrTessellator::PathToTriangles(path, tol, clipBounds, &allocator,
true, fColor, canTweakAlphaForCoverage,
&isLinear);
@@ -281,18 +278,18 @@ private:
using namespace GrDefaultGeoProcFactory;
Color color(fColor);
- LocalCoords localCoords(fPipelineInfo.readsLocalCoords() ?
- LocalCoords::kUsePosition_Type :
- LocalCoords::kUnused_Type);
+ LocalCoords localCoords(fOptimizations.readsLocalCoords()
+ ? LocalCoords::kUsePosition_Type
+ : LocalCoords::kUnused_Type);
Coverage::Type coverageType;
if (fAntiAlias) {
color = Color(Color::kAttribute_Type);
- if (fPipelineInfo.canTweakAlphaForCoverage()) {
+ if (fOptimizations.canTweakAlphaForCoverage()) {
coverageType = Coverage::kSolid_Type;
} else {
coverageType = Coverage::kAttribute_Type;
}
- } else if (fPipelineInfo.readsCoverage()) {
+ } else if (fOptimizations.readsCoverage()) {
coverageType = Coverage::kSolid_Type;
} else {
coverageType = Coverage::kNone_Type;
@@ -349,7 +346,7 @@ private:
SkMatrix fViewMatrix;
SkIRect fDevClipBounds;
bool fAntiAlias;
- GrXPOverridesForBatch fPipelineInfo;
+ GrPipelineOptimizations fOptimizations;
typedef GrMeshDrawOp INHERITED;
};
diff --git a/src/gpu/ops/GrTestMeshDrawOp.h b/src/gpu/ops/GrTestMeshDrawOp.h
index 65ee727bc5..2878b6b103 100644
--- a/src/gpu/ops/GrTestMeshDrawOp.h
+++ b/src/gpu/ops/GrTestMeshDrawOp.h
@@ -21,22 +21,6 @@ class GrTestMeshDrawOp : public GrMeshDrawOp {
public:
virtual const char* name() const override = 0;
- void computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const override {
- // When this is called on a batch, there is only one geometry bundle
- color->setKnownFourComponents(fColor);
- coverage->setUnknownSingleComponent();
- }
-
- void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
- overrides.getOverrideColorIfSet(&fColor);
-
- fOptimizations.fColorIgnored = !overrides.readsColor();
- fOptimizations.fUsesLocalCoords = overrides.readsLocalCoords();
- fOptimizations.fCoverageIgnored = !overrides.readsCoverage();
- }
-
protected:
GrTestMeshDrawOp(uint32_t classID, const SkRect& bounds, GrColor color)
: INHERITED(classID), fColor(color) {
@@ -44,6 +28,19 @@ protected:
this->setBounds(bounds, HasAABloat::kYes, IsZeroArea::kYes);
}
+ void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
+ input->pipelineColorInput()->setKnownFourComponents(fColor);
+ input->pipelineCoverageInput()->setUnknownSingleComponent();
+ }
+
+ void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+ optimizations.getOverrideColorIfSet(&fColor);
+
+ fOptimizations.fColorIgnored = !optimizations.readsColor();
+ fOptimizations.fUsesLocalCoords = optimizations.readsLocalCoords();
+ fOptimizations.fCoverageIgnored = !optimizations.readsCoverage();
+ }
+
struct Optimizations {
bool fColorIgnored = false;
bool fUsesLocalCoords = false;