Make GrOp::onPrePrepare be pure virtual
This makes onPrePrepare match onPrepare & onExecute. Most of the new method bodies will-have-to/should be filled in anyway.
Change-Id: Ifc897feaeb2d8fe6eec3ac3a8e91f99393ad6758
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277542
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/gm/tessellation.cpp b/gm/tessellation.cpp
index 3e865d3..76d0c1c 100644
--- a/gm/tessellation.cpp
+++ b/gm/tessellation.cpp
@@ -298,6 +298,11 @@
return GrProcessorSet::EmptySetAnalysis();
}
+ void onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) override {}
+
void onPrepare(GrOpFlushState* flushState) override {
if (fTriPositions) {
if (void* vertexData = flushState->makeVertexSpace(sizeof(float) * 3, 3, &fVertexBuffer,
diff --git a/samplecode/SampleCCPRGeometry.cpp b/samplecode/SampleCCPRGeometry.cpp
index fb7f7a6..9b150e2 100644
--- a/samplecode/SampleCCPRGeometry.cpp
+++ b/samplecode/SampleCCPRGeometry.cpp
@@ -94,6 +94,10 @@
bool hasMixedSampledCoverage, GrClampType) override {
return GrProcessorSet::EmptySetAnalysis();
}
+ void onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) override {}
void onPrepare(GrOpFlushState*) override {}
void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
diff --git a/src/gpu/ccpr/GrCCDrawPathsOp.h b/src/gpu/ccpr/GrCCDrawPathsOp.h
index f5e41fd..644f09c 100644
--- a/src/gpu/ccpr/GrCCDrawPathsOp.h
+++ b/src/gpu/ccpr/GrCCDrawPathsOp.h
@@ -71,6 +71,11 @@
void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
private:
+ void onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) override {}
+
friend class GrOpMemoryPool;
static std::unique_ptr<GrCCDrawPathsOp> InternalMake(GrRecordingContext*,
diff --git a/src/gpu/ccpr/GrCCPerFlushResources.cpp b/src/gpu/ccpr/GrCCPerFlushResources.cpp
index c0a3fdc..54fbceb 100644
--- a/src/gpu/ccpr/GrCCPerFlushResources.cpp
+++ b/src/gpu/ccpr/GrCCPerFlushResources.cpp
@@ -45,7 +45,6 @@
// TODO: make use of texture chaining.
return CombineResult::kCannotCombine;
}
- void onPrepare(GrOpFlushState*) override {}
protected:
AtlasOp(uint32_t classID, sk_sp<const GrCCPerFlushResources> resources,
@@ -57,6 +56,13 @@
}
const sk_sp<const GrCCPerFlushResources> fResources;
+
+private:
+ void onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) final {}
+ void onPrepare(GrOpFlushState*) final {}
};
// Copies paths from a cached coverage count or msaa atlas into an 8-bit literal-coverage atlas.
diff --git a/src/gpu/ccpr/GrStencilAtlasOp.h b/src/gpu/ccpr/GrStencilAtlasOp.h
index ef27932..89f1813 100644
--- a/src/gpu/ccpr/GrStencilAtlasOp.h
+++ b/src/gpu/ccpr/GrStencilAtlasOp.h
@@ -46,16 +46,20 @@
// TODO: make use of texture chaining.
return CombineResult::kCannotCombine;
}
- void onPrepare(GrOpFlushState*) override {}
static std::unique_ptr<GrDrawOp> Make(
GrRecordingContext*, sk_sp<const GrCCPerFlushResources>, FillBatchID, StrokeBatchID,
int baseStencilResolveInstance, int endStencilResolveInstance,
const SkISize& drawBounds);
- void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override;
-
private:
+ void onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) override {}
+ void onPrepare(GrOpFlushState*) override {}
+ void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
+
friend class ::GrOpMemoryPool; // for ctor
GrStencilAtlasOp(sk_sp<const GrCCPerFlushResources> resources, FillBatchID fillBatchID,
diff --git a/src/gpu/ops/GrClearOp.h b/src/gpu/ops/GrClearOp.h
index 5353d47..ea22a6a 100644
--- a/src/gpu/ops/GrClearOp.h
+++ b/src/gpu/ops/GrClearOp.h
@@ -91,6 +91,11 @@
fClip.scissorRect().contains(that->fClip.scissorRect()));
}
+ void onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) override {}
+
void onPrepare(GrOpFlushState*) override {}
void onExecute(GrOpFlushState* state, const SkRect& chainBounds) override;
diff --git a/src/gpu/ops/GrClearStencilClipOp.h b/src/gpu/ops/GrClearStencilClipOp.h
index a233153..b5810d0 100644
--- a/src/gpu/ops/GrClearStencilClipOp.h
+++ b/src/gpu/ops/GrClearStencilClipOp.h
@@ -54,6 +54,11 @@
this->setBounds(bounds, HasAABloat::kNo, IsHairline::kNo);
}
+ void onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) override {}
+
void onPrepare(GrOpFlushState*) override {}
void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
diff --git a/src/gpu/ops/GrDrawPathOp.h b/src/gpu/ops/GrDrawPathOp.h
index c11be49..b56dab3 100644
--- a/src/gpu/ops/GrDrawPathOp.h
+++ b/src/gpu/ops/GrDrawPathOp.h
@@ -54,6 +54,11 @@
}
private:
+ void onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) final {}
+
void onPrepare(GrOpFlushState*) final {}
SkMatrix fViewMatrix;
diff --git a/src/gpu/ops/GrDrawableOp.cpp b/src/gpu/ops/GrDrawableOp.cpp
index d50c26b..19291b8 100644
--- a/src/gpu/ops/GrDrawableOp.cpp
+++ b/src/gpu/ops/GrDrawableOp.cpp
@@ -25,7 +25,7 @@
const SkRect& bounds)
: INHERITED(ClassID())
, fDrawable(std::move(drawable)) {
- this->setBounds(bounds, HasAABloat::kNo, IsHairline::kNo);
+ this->setBounds(bounds, HasAABloat::kNo, IsHairline::kNo);
}
void GrDrawableOp::onExecute(GrOpFlushState* state, const SkRect& chainBounds) {
diff --git a/src/gpu/ops/GrDrawableOp.h b/src/gpu/ops/GrDrawableOp.h
index 063886f..828404e 100644
--- a/src/gpu/ops/GrDrawableOp.h
+++ b/src/gpu/ops/GrDrawableOp.h
@@ -41,6 +41,12 @@
const GrCaps& caps) override {
return CombineResult::kCannotCombine;
}
+
+ void onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) override {}
+
void onPrepare(GrOpFlushState*) override {}
void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
diff --git a/src/gpu/ops/GrOp.h b/src/gpu/ops/GrOp.h
index 1fcd193..95c692c 100644
--- a/src/gpu/ops/GrOp.h
+++ b/src/gpu/ops/GrOp.h
@@ -299,7 +299,7 @@
virtual void onPrePrepare(GrRecordingContext*,
const GrSurfaceProxyView* outputView,
GrAppliedClip*,
- const GrXferProcessor::DstProxyView&) {}
+ const GrXferProcessor::DstProxyView&) = 0;
virtual void onPrepare(GrOpFlushState*) = 0;
// If this op is chained then chainBounds is the union of the bounds of all ops in the chain.
// Otherwise, this op's bounds.
diff --git a/src/gpu/ops/GrStencilPathOp.h b/src/gpu/ops/GrStencilPathOp.h
index 2d4f37f..05fd585 100644
--- a/src/gpu/ops/GrStencilPathOp.h
+++ b/src/gpu/ops/GrStencilPathOp.h
@@ -56,6 +56,11 @@
this->setBounds(fPath->getBounds(), HasAABloat::kNo, IsHairline::kNo);
}
+ void onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) override {}
+
void onPrepare(GrOpFlushState*) override {}
void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
diff --git a/src/gpu/tessellate/GrDrawAtlasPathOp.cpp b/src/gpu/tessellate/GrDrawAtlasPathOp.cpp
index b66e60c..f629678 100644
--- a/src/gpu/tessellate/GrDrawAtlasPathOp.cpp
+++ b/src/gpu/tessellate/GrDrawAtlasPathOp.cpp
@@ -140,6 +140,12 @@
return CombineResult::kMerged;
}
+void GrDrawAtlasPathOp::onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) {
+}
+
void GrDrawAtlasPathOp::onPrepare(GrOpFlushState* state) {
size_t instanceStride = Instance::Stride(fUsesLocalCoords);
if (char* instanceData = (char*)state->makeVertexSpace(
diff --git a/src/gpu/tessellate/GrDrawAtlasPathOp.h b/src/gpu/tessellate/GrDrawAtlasPathOp.h
index bb37cf7..ad15727 100644
--- a/src/gpu/tessellate/GrDrawAtlasPathOp.h
+++ b/src/gpu/tessellate/GrDrawAtlasPathOp.h
@@ -40,6 +40,11 @@
void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
private:
+ void onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) override;
+
struct Instance {
constexpr static size_t Stride(bool usesLocalCoords) {
size_t stride = sizeof(Instance);
diff --git a/src/gpu/tessellate/GrTessellatePathOp.cpp b/src/gpu/tessellate/GrTessellatePathOp.cpp
index 7e48408..d42ee6b 100644
--- a/src/gpu/tessellate/GrTessellatePathOp.cpp
+++ b/src/gpu/tessellate/GrTessellatePathOp.cpp
@@ -23,6 +23,12 @@
return flags;
}
+void GrTessellatePathOp::onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) {
+}
+
void GrTessellatePathOp::onPrepare(GrOpFlushState* state) {
GrEagerDynamicVertexAllocator pathVertexAllocator(state, &fPathVertexBuffer, &fBasePathVertex);
GrEagerDynamicVertexAllocator cubicInstanceAllocator(state, &fCubicInstanceBuffer,
diff --git a/src/gpu/tessellate/GrTessellatePathOp.h b/src/gpu/tessellate/GrTessellatePathOp.h
index 5f767fa..dafa7ab 100644
--- a/src/gpu/tessellate/GrTessellatePathOp.h
+++ b/src/gpu/tessellate/GrTessellatePathOp.h
@@ -53,6 +53,10 @@
}
FixedFunctionFlags fixedFunctionFlags() const override;
+ void onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) override;
void onPrepare(GrOpFlushState* state) override;
void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
diff --git a/tests/GrMeshTest.cpp b/tests/GrMeshTest.cpp
index 6d2169e..05a3e2f 100644
--- a/tests/GrMeshTest.cpp
+++ b/tests/GrMeshTest.cpp
@@ -320,6 +320,11 @@
bool hasMixedSampledCoverage, GrClampType) override {
return GrProcessorSet::EmptySetAnalysis();
}
+
+ void onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) override {}
void onPrepare(GrOpFlushState* state) override {
fHelper.reset(new DrawMeshHelper(state));
fPrepareFn(fHelper.get());
diff --git a/tests/GrPipelineDynamicStateTest.cpp b/tests/GrPipelineDynamicStateTest.cpp
index 0328091..7caba5a 100644
--- a/tests/GrPipelineDynamicStateTest.cpp
+++ b/tests/GrPipelineDynamicStateTest.cpp
@@ -145,6 +145,10 @@
bool hasMixedSampledCoverage, GrClampType) override {
return GrProcessorSet::EmptySetAnalysis();
}
+ void onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) override {}
void onPrepare(GrOpFlushState*) override {}
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
GrPipeline pipeline(fScissorTest, SkBlendMode::kSrc,
diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp
index 23cae0e..fdffb54 100644
--- a/tests/LazyProxyTest.cpp
+++ b/tests/LazyProxyTest.cpp
@@ -113,6 +113,11 @@
bool hasMixedSampledCoverage, GrClampType) override {
return GrProcessorSet::EmptySetAnalysis();
}
+ void onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) override {}
+
void onPrepare(GrOpFlushState*) override {}
LazyProxyTest* const fTest;
@@ -363,6 +368,10 @@
bool hasMixedSampledCoverage, GrClampType) override {
return GrProcessorSet::EmptySetAnalysis();
}
+ void onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) override {}
void onPrepare(GrOpFlushState*) override {}
void onExecute(GrOpFlushState* state, const SkRect& chainBounds) override {
*fTestExecuteValue = 2;
diff --git a/tests/OpChainTest.cpp b/tests/OpChainTest.cpp
index 366894b..08d776b 100644
--- a/tests/OpChainTest.cpp
+++ b/tests/OpChainTest.cpp
@@ -122,6 +122,11 @@
HasAABloat::kNo, IsHairline::kNo);
}
+ void onPrePrepare(GrRecordingContext*,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip*,
+ const GrXferProcessor::DstProxyView&) override {}
+
void onPrepare(GrOpFlushState*) override {}
void onExecute(GrOpFlushState*, const SkRect& chainBounds) override {