Skip to content

Commit 641ac7d

Browse files
bsalomonSkia Commit-Bot
authored andcommitted
Make result of GrOp::combineIfPossible be an enum.
This is to prepare for a third value that requests that ops be linked together so that the first op may do the work for multiple linked ops without actually merging the GrOp objects. Change-Id: Ib6e012a89be5edd054aee69d8475bea612331852 Reviewed-on: https://skia-review.googlesource.com/145522 Commit-Queue: Brian Salomon <[email protected]> Reviewed-by: Brian Osman <[email protected]> Auto-Submit: Brian Salomon <[email protected]>
1 parent 986f64c commit 641ac7d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+166
-189
lines changed

bench/VertexColorSpaceBench.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ class Op : public GrMeshDrawOp {
152152
private:
153153
friend class ::GrOpMemoryPool;
154154

155-
bool onCombineIfPossible(GrOp*, const GrCaps&) override { return false; }
156-
157155
void onPrepareDraws(Target* target) override {
158156
sk_sp<GrGeometryProcessor> gp(new GP(fMode, fColorSpaceXform));
159157

gm/beziereffects.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ class BezierTestOp : public GrMeshDrawOp {
6060
GrColor color() const { return fColor; }
6161

6262
private:
63-
bool onCombineIfPossible(GrOp* op, const GrCaps& caps) override { return false; }
64-
6563
SkRect fRect;
6664
GrColor fColor;
6765
sk_sp<const GrGeometryProcessor> fGeometryProcessor;

gm/clockwise.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ class ClockwiseTestOp : public GrDrawOp {
108108
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
109109
return RequiresDstTexture::kNo;
110110
}
111-
bool onCombineIfPossible(GrOp* other, const GrCaps& caps) override { return false; }
112111
void onPrepare(GrOpFlushState*) override {}
113112
void onExecute(GrOpFlushState* flushState) override {
114113
SkPoint vertices[4] = {

gm/convexpolyeffect.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ class PolyBoundsOp : public GrMeshDrawOp {
9999
helper.recordDraw(target, std::move(gp), pipe.fPipeline, pipe.fFixedDynamicState);
100100
}
101101

102-
bool onCombineIfPossible(GrOp* op, const GrCaps& caps) override { return false; }
103-
104102
GrColor fColor;
105103
GrProcessorSet fProcessors;
106104
SkRect fRect;

samplecode/SampleCCPRGeometry.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ class CCPRGeometryView::DrawCoverageCountOp : public GrDrawOp {
8989
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
9090
return RequiresDstTexture::kNo;
9191
}
92-
bool onCombineIfPossible(GrOp* other, const GrCaps& caps) override { return false; }
9392
void onPrepare(GrOpFlushState*) override {}
9493
void onExecute(GrOpFlushState*) override;
9594

src/atlastext/SkAtlasTextTarget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ void SkInternalAtlasTextTarget::addDrawOp(const GrClip& clip, std::unique_ptr<Gr
181181
int n = SkTMin(kMaxBatchLookBack, fOps.count());
182182
for (int i = 0; i < n; ++i) {
183183
GrAtlasTextOp* other = fOps.fromBack(i).get();
184-
if (other->combineIfPossible(op.get(), caps)) {
184+
if (other->combineIfPossible(op.get(), caps) == GrOp::CombineResult::kMerged) {
185185
fOpMemoryPool->release(std::move(op));
186186
return;
187187
}

src/gpu/GrRenderTargetOpList.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ bool GrRenderTargetOpList::combineIfPossible(const RecordedOp& a, GrOp* b,
339339
} else if (a.fDstProxy.proxy()) {
340340
return false;
341341
}
342-
return a.fOp->combineIfPossible(b, caps);
342+
return a.fOp->combineIfPossible(b, caps) == GrOp::CombineResult::kMerged;
343343
}
344344

345345
uint32_t GrRenderTargetOpList::recordOp(std::unique_ptr<GrOp> op,

src/gpu/ccpr/GrCCDrawPathsOp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ GrDrawOp::RequiresDstTexture GrCCDrawPathsOp::finalize(const GrCaps& caps,
117117
return RequiresDstTexture(analysis.requiresDstTexture());
118118
}
119119

120-
bool GrCCDrawPathsOp::onCombineIfPossible(GrOp* op, const GrCaps&) {
120+
GrOp::CombineResult GrCCDrawPathsOp::onCombineIfPossible(GrOp* op, const GrCaps&) {
121121
GrCCDrawPathsOp* that = op->cast<GrCCDrawPathsOp>();
122122
SkASSERT(fOwningPerOpListPaths);
123123
SkASSERT(fNumDraws);
@@ -126,15 +126,15 @@ bool GrCCDrawPathsOp::onCombineIfPossible(GrOp* op, const GrCaps&) {
126126

127127
if (fProcessors != that->fProcessors ||
128128
fViewMatrixIfUsingLocalCoords != that->fViewMatrixIfUsingLocalCoords) {
129-
return false;
129+
return CombineResult::kCannotCombine;
130130
}
131131

132132
fDraws.append(std::move(that->fDraws), &fOwningPerOpListPaths->fAllocator);
133133
this->joinBounds(*that);
134134

135135
SkDEBUGCODE(fNumDraws += that->fNumDraws);
136136
SkDEBUGCODE(that->fNumDraws = 0);
137-
return true;
137+
return CombineResult::kMerged;
138138
}
139139

140140
void GrCCDrawPathsOp::wasRecorded(GrCCPerOpListPaths* owningPerOpListPaths) {

src/gpu/ccpr/GrCCDrawPathsOp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class GrCCDrawPathsOp : public GrDrawOp {
3737
const char* name() const override { return "GrCCDrawPathsOp"; }
3838
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
3939
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override;
40-
bool onCombineIfPossible(GrOp*, const GrCaps&) override;
40+
CombineResult onCombineIfPossible(GrOp*, const GrCaps&) override;
4141
void visitProxies(const VisitProxyFunc& fn) const override { fProcessors.visitProxies(fn); }
4242
void onPrepare(GrOpFlushState*) override {}
4343

src/gpu/ccpr/GrCCPerFlushResources.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class AtlasOp : public GrDrawOp {
2727
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
2828
return RequiresDstTexture::kNo;
2929
}
30-
bool onCombineIfPossible(GrOp* other, const GrCaps&) override {
30+
CombineResult onCombineIfPossible(GrOp* other, const GrCaps&) override {
3131
SK_ABORT("Only expected one Op per CCPR atlas.");
32-
return true;
32+
return CombineResult::kMerged;
3333
}
3434
void onPrepare(GrOpFlushState*) override {}
3535

0 commit comments

Comments
 (0)