aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/gpu/GrRenderTargetContext.cpp2
-rw-r--r--src/gpu/instanced/InstancedOp.cpp4
-rw-r--r--src/gpu/instanced/InstancedOp.h2
-rw-r--r--src/gpu/ops/GrAAConvexPathRenderer.cpp2
-rw-r--r--src/gpu/ops/GrAAFillRectOp.cpp4
-rw-r--r--src/gpu/ops/GrAAStrokeRectOp.cpp2
-rw-r--r--src/gpu/ops/GrDrawOp.h11
-rw-r--r--src/gpu/ops/GrDrawPathOp.h5
-rw-r--r--src/gpu/ops/GrMeshDrawOp.h4
-rw-r--r--src/gpu/ops/GrNonAAFillRectOp.cpp4
-rw-r--r--src/gpu/ops/GrNonAAStrokeRectOp.cpp7
-rw-r--r--src/gpu/ops/GrOvalOpFactory.cpp10
-rw-r--r--src/gpu/ops/GrSimpleMeshDrawOpHelper.h8
-rw-r--r--tests/GrMeshTest.cpp4
-rw-r--r--tests/GrPipelineDynamicStateTest.cpp4
15 files changed, 40 insertions, 33 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 17a7db8c81..a6dcdf600a 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -1790,7 +1790,7 @@ uint32_t GrRenderTargetContext::addDrawOp(const GrClip& clip, std::unique_ptr<Gr
}
GrXferProcessor::DstProxy dstProxy;
- if (op->xpRequiresDstTexture(*this->caps(), &appliedClip)) {
+ if (op->finalize(*this->caps(), &appliedClip) == GrDrawOp::RequiresDstTexture::kYes) {
if (!this->setupDstProxy(this->asRenderTargetProxy(), clip, op->bounds(), &dstProxy)) {
return SK_InvalidUniqueID;
}
diff --git a/src/gpu/instanced/InstancedOp.cpp b/src/gpu/instanced/InstancedOp.cpp
index 40e3c5e272..9b80540fb2 100644
--- a/src/gpu/instanced/InstancedOp.cpp
+++ b/src/gpu/instanced/InstancedOp.cpp
@@ -120,7 +120,7 @@ void InstancedOp::appendParamsTexel(SkScalar x, SkScalar y, SkScalar z) {
fInfo.fHasParams = true;
}
-bool InstancedOp::xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip) {
+GrDrawOp::RequiresDstTexture InstancedOp::finalize(const GrCaps& caps, const GrAppliedClip* clip) {
GrProcessorAnalysisCoverage coverageInput;
bool isMixedSamples = false;
if (GrAAType::kCoverage == fInfo.aaType() ||
@@ -151,7 +151,7 @@ bool InstancedOp::xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip*
fInfo.fUsesLocalCoords = analysis.usesLocalCoords();
fRequiresBarrierOnOverlap = analysis.requiresBarrierBetweenOverlappingDraws();
- return analysis.requiresDstTexture();
+ return analysis.requiresDstTexture() ? RequiresDstTexture::kYes : RequiresDstTexture::kNo;
}
void InstancedOp::wasRecorded(GrRenderTargetOpList* opList) {
diff --git a/src/gpu/instanced/InstancedOp.h b/src/gpu/instanced/InstancedOp.h
index 7848eff9cc..204a9448af 100644
--- a/src/gpu/instanced/InstancedOp.h
+++ b/src/gpu/instanced/InstancedOp.h
@@ -64,7 +64,7 @@ public:
return GrAATypeIsHW(fInfo.aaType()) ? FixedFunctionFlags::kUsesHWAA
: FixedFunctionFlags::kNone;
}
- bool xpRequiresDstTexture(const GrCaps&, const GrAppliedClip*) override;
+ RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override;
// Registers the op with the InstancedRendering list of tracked ops.
void wasRecorded(GrRenderTargetOpList*) override;
diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp
index f0207f4649..261f0c40b0 100644
--- a/src/gpu/ops/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp
@@ -757,7 +757,7 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
- bool xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip) override {
+ RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
&fPaths.back().fColor);
}
diff --git a/src/gpu/ops/GrAAFillRectOp.cpp b/src/gpu/ops/GrAAFillRectOp.cpp
index db856b2d0e..30023f3e99 100644
--- a/src/gpu/ops/GrAAFillRectOp.cpp
+++ b/src/gpu/ops/GrAAFillRectOp.cpp
@@ -219,9 +219,9 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
- bool xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip) override {
+ RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrColor color = this->first()->color();
- bool result = fHelper.xpRequiresDstTexture(
+ auto result = fHelper.xpRequiresDstTexture(
caps, clip, GrProcessorAnalysisCoverage::kSingleChannel, &color);
this->first()->setColor(color);
return result;
diff --git a/src/gpu/ops/GrAAStrokeRectOp.cpp b/src/gpu/ops/GrAAStrokeRectOp.cpp
index e42358318a..662ce669fd 100644
--- a/src/gpu/ops/GrAAStrokeRectOp.cpp
+++ b/src/gpu/ops/GrAAStrokeRectOp.cpp
@@ -191,7 +191,7 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
- bool xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip) override {
+ RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
&fRects.back().fColor);
}
diff --git a/src/gpu/ops/GrDrawOp.h b/src/gpu/ops/GrDrawOp.h
index d7887b689a..36f4da4fc6 100644
--- a/src/gpu/ops/GrDrawOp.h
+++ b/src/gpu/ops/GrDrawOp.h
@@ -72,14 +72,15 @@ public:
GR_DECL_BITFIELD_CLASS_OPS_FRIENDS(FixedFunctionFlags);
virtual FixedFunctionFlags fixedFunctionFlags() const = 0;
+ enum class RequiresDstTexture : bool { kNo = false, kYes = true };
/**
* This is called after the GrAppliedClip has been computed and just prior to recording the op
- * or combining it with a previously recorded op. It is used to determine whether a copy of the
- * destination (or destination texture itself) needs to be provided to the xp when this op
- * executes. This is guaranteed to be called before an op is recorded. However, this is also
- * called on ops that are not recorded because they combine with a previously recorded op.
+ * or combining it with a previously recorded op. The op should convert any proxies or resources
+ * it owns to "pending io" status so that resource allocation can be more optimal. Additionally,
+ * at this time the op must report whether a copy of the destination (or destination texture
+ * itself) needs to be provided to the GrXferProcessor when this op executes.
*/
- virtual bool xpRequiresDstTexture(const GrCaps&, const GrAppliedClip*) = 0;
+ virtual RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) = 0;
protected:
static SkString DumpPipelineInfo(const GrPipeline& pipeline);
diff --git a/src/gpu/ops/GrDrawPathOp.h b/src/gpu/ops/GrDrawPathOp.h
index 8df85b430b..ce9e6e048d 100644
--- a/src/gpu/ops/GrDrawPathOp.h
+++ b/src/gpu/ops/GrDrawPathOp.h
@@ -30,8 +30,9 @@ protected:
}
return FixedFunctionFlags::kUsesStencil;
}
- bool xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip) override {
- return this->doProcessorAnalysis(caps, clip).requiresDstTexture();
+ RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
+ return this->doProcessorAnalysis(caps, clip).requiresDstTexture() ? RequiresDstTexture::kYes
+ : RequiresDstTexture::kNo;
}
protected:
diff --git a/src/gpu/ops/GrMeshDrawOp.h b/src/gpu/ops/GrMeshDrawOp.h
index 349e8b6bda..bf467e0d54 100644
--- a/src/gpu/ops/GrMeshDrawOp.h
+++ b/src/gpu/ops/GrMeshDrawOp.h
@@ -131,9 +131,9 @@ public:
SkFAIL("This should never be called for legacy mesh draw ops.");
return FixedFunctionFlags::kNone;
}
- bool xpRequiresDstTexture(const GrCaps&, const GrAppliedClip*) override {
+ RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
SkFAIL("Should never be called for legacy mesh draw ops.");
- return false;
+ return RequiresDstTexture::kNo;
}
protected:
diff --git a/src/gpu/ops/GrNonAAFillRectOp.cpp b/src/gpu/ops/GrNonAAFillRectOp.cpp
index 2fd44f82c7..c971e2f78b 100644
--- a/src/gpu/ops/GrNonAAFillRectOp.cpp
+++ b/src/gpu/ops/GrNonAAFillRectOp.cpp
@@ -154,7 +154,7 @@ public:
return str;
}
- bool xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip) override {
+ RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrColor* color = &fRects.front().fColor;
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone, color);
}
@@ -272,7 +272,7 @@ public:
return str;
}
- bool xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip) override {
+ RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrColor* color = &fRects.front().fColor;
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone, color);
}
diff --git a/src/gpu/ops/GrNonAAStrokeRectOp.cpp b/src/gpu/ops/GrNonAAStrokeRectOp.cpp
index 016c637fb2..2c3d822705 100644
--- a/src/gpu/ops/GrNonAAStrokeRectOp.cpp
+++ b/src/gpu/ops/GrNonAAStrokeRectOp.cpp
@@ -119,10 +119,9 @@ public:
FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
- bool xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip) override {
- bool result = fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone,
- &fColor);
- return result;
+ RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
+ return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone,
+ &fColor);
}
private:
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index 0eedc425e8..45b290b980 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -800,7 +800,7 @@ public:
return string;
}
- bool xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip) override {
+ RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrColor* color = &fCircles.front().fColor;
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
color);
@@ -1263,7 +1263,7 @@ public:
return string;
}
- bool xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip) override {
+ RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrColor* color = &fEllipses.front().fColor;
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
color);
@@ -1489,7 +1489,7 @@ public:
return string;
}
- bool xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip) override {
+ RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrColor* color = &fEllipses.front().fColor;
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
color);
@@ -1802,7 +1802,7 @@ public:
return string;
}
- bool xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip) override {
+ RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrColor* color = &fRRects.front().fColor;
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
color);
@@ -2156,7 +2156,7 @@ public:
return string;
}
- bool xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip) override {
+ RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override {
GrColor* color = &fRRects.front().fColor;
return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel,
color);
diff --git a/src/gpu/ops/GrSimpleMeshDrawOpHelper.h b/src/gpu/ops/GrSimpleMeshDrawOpHelper.h
index 543f97713c..9bdafc8b0b 100644
--- a/src/gpu/ops/GrSimpleMeshDrawOpHelper.h
+++ b/src/gpu/ops/GrSimpleMeshDrawOpHelper.h
@@ -94,8 +94,9 @@ public:
return result;
}
- bool xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip,
- GrProcessorAnalysisCoverage geometryCoverage, GrColor* color) {
+ GrDrawOp::RequiresDstTexture xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip,
+ GrProcessorAnalysisCoverage geometryCoverage,
+ GrColor* color) {
SkDEBUGCODE(fDidAnalysis = true);
GrProcessorSet::Analysis analysis;
if (fProcessors) {
@@ -113,7 +114,8 @@ public:
fRequiresDstTexture = analysis.requiresDstTexture();
fUsesLocalCoords = analysis.usesLocalCoords();
fCompatibleWithAlphaAsCoveage = analysis.isCompatibleWithCoverageAsAlpha();
- return analysis.requiresDstTexture();
+ return analysis.requiresDstTexture() ? GrDrawOp::RequiresDstTexture::kYes
+ : GrDrawOp::RequiresDstTexture::kNo;
}
bool usesLocalCoords() const {
diff --git a/tests/GrMeshTest.cpp b/tests/GrMeshTest.cpp
index e4663e1af0..0e67acfcfc 100644
--- a/tests/GrMeshTest.cpp
+++ b/tests/GrMeshTest.cpp
@@ -262,7 +262,9 @@ public:
private:
const char* name() const override { return "GrMeshTestOp"; }
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
- bool xpRequiresDstTexture(const GrCaps&, const GrAppliedClip*) override { return false; }
+ RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
+ return RequiresDstTexture::kNo;
+ }
bool onCombineIfPossible(GrOp* other, const GrCaps& caps) override { return false; }
void onPrepare(GrOpFlushState*) override {}
void onExecute(GrOpFlushState* state) override {
diff --git a/tests/GrPipelineDynamicStateTest.cpp b/tests/GrPipelineDynamicStateTest.cpp
index 6c014000c7..007702a2cc 100644
--- a/tests/GrPipelineDynamicStateTest.cpp
+++ b/tests/GrPipelineDynamicStateTest.cpp
@@ -119,7 +119,9 @@ public:
private:
const char* name() const override { return "GrPipelineDynamicStateTestOp"; }
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
- bool xpRequiresDstTexture(const GrCaps&, const GrAppliedClip*) override { return false; }
+ RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
+ return RequiresDstTexture::kNo;
+ }
bool onCombineIfPossible(GrOp* other, const GrCaps& caps) override { return false; }
void onPrepare(GrOpFlushState*) override {}
void onExecute(GrOpFlushState* state) override {