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>
This commit is contained in:
Robert Phillips 2020-03-18 13:23:45 -04:00 committed by Skia Commit-Bot
parent 3a76975a7c
commit c655c3aa8b
20 changed files with 100 additions and 6 deletions

View File

@ -298,6 +298,11 @@ private:
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,

View File

@ -94,6 +94,10 @@ private:
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;

View File

@ -71,6 +71,11 @@ public:
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*,

View File

@ -45,7 +45,6 @@ public:
// 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 @@ protected:
}
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.

View File

@ -46,16 +46,20 @@ public:
// 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,

View File

@ -91,6 +91,11 @@ private:
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;

View File

@ -54,6 +54,11 @@ private:
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;

View File

@ -54,6 +54,11 @@ protected:
}
private:
void onPrePrepare(GrRecordingContext*,
const GrSurfaceProxyView* outputView,
GrAppliedClip*,
const GrXferProcessor::DstProxyView&) final {}
void onPrepare(GrOpFlushState*) final {}
SkMatrix fViewMatrix;

View File

@ -25,7 +25,7 @@ GrDrawableOp::GrDrawableOp(std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
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) {

View File

@ -41,6 +41,12 @@ private:
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;

View File

@ -299,7 +299,7 @@ private:
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.

View File

@ -56,6 +56,11 @@ private:
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;

View File

@ -140,6 +140,12 @@ GrOp::CombineResult GrDrawAtlasPathOp::onCombineIfPossible(
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(

View File

@ -40,6 +40,11 @@ public:
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);

View File

@ -23,6 +23,12 @@ GrTessellatePathOp::FixedFunctionFlags GrTessellatePathOp::fixedFunctionFlags()
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,

View File

@ -53,6 +53,10 @@ private:
}
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;

View File

@ -320,6 +320,11 @@ private:
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());

View File

@ -145,6 +145,10 @@ private:
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,

View File

@ -113,6 +113,11 @@ public:
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 @@ private:
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;

View File

@ -122,6 +122,11 @@ private:
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 {