Clean up programInfo creation in GrMeshDrawOp-derived Ops
This CL:
Renames the existing createProgramInfo method to onCreateProgramInfo and makes it a virtual on GrMeshDrawOp
Moves the non-virtual createProgramInfo (helper) calls to GrMeshDrawOp
Changes onCreateProgramInfo to not return a ProgramInfo*. This is setting up to handle ops that create >1 programInfo (e.g., AAHairlineOp)
This CL leaves the following 8 ops in need of an onCreateProgramInfo implementation:
AAHairlineOp
AAFlatteningConvexPathOp
GrAtlasTextOp
GrShadowRRectOp
SmallPathOp
GrTextureOp
PrimitiveProcessorTest::Op
VertexColorSpaceBench::Op
Bug: skia:9455
Change-Id: Id7e2b8a40cac86ede6bf3c0e544da5500ff47d8a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276403
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp
index bbd9e40..329513e 100644
--- a/src/gpu/ops/GrDefaultPathRenderer.cpp
+++ b/src/gpu/ops/GrDefaultPathRenderer.cpp
@@ -426,11 +426,11 @@
return GrPrimitiveType::kTriangles;
}
- GrProgramInfo* createProgramInfo(const GrCaps* caps,
- SkArenaAlloc* arena,
- const GrSurfaceProxyView* outputView,
- GrAppliedClip&& appliedClip,
- const GrXferProcessor::DstProxyView& dstProxyView) {
+ void onCreateProgramInfo(const GrCaps* caps,
+ SkArenaAlloc* arena,
+ const GrSurfaceProxyView* outputView,
+ GrAppliedClip&& appliedClip,
+ const GrXferProcessor::DstProxyView& dstProxyView) override {
GrGeometryProcessor* gp;
{
using namespace GrDefaultGeoProcFactory;
@@ -448,19 +448,12 @@
SkASSERT(gp->vertexStride() == sizeof(SkPoint));
- return fHelper.createProgramInfoWithStencil(caps, arena, outputView, std::move(appliedClip),
- dstProxyView, gp, this->primType());
+ fProgramInfo = fHelper.createProgramInfoWithStencil(caps, arena, outputView,
+ std::move(appliedClip),
+ dstProxyView, gp, this->primType());
}
- GrProgramInfo* createProgramInfo(Target* target) {
- return this->createProgramInfo(&target->caps(),
- target->allocator(),
- target->outputView(),
- target->detachAppliedClip(),
- target->dstProxyView());
- }
-
void onPrePrepareDraws(GrRecordingContext* context,
const GrSurfaceProxyView* outputView,
GrAppliedClip* clip,
@@ -470,8 +463,8 @@
// This is equivalent to a GrOpFlushState::detachAppliedClip
GrAppliedClip appliedClip = clip ? std::move(*clip) : GrAppliedClip();
- fProgramInfo = this->createProgramInfo(context->priv().caps(), arena, outputView,
- std::move(appliedClip), dstProxyView);
+ this->createProgramInfo(context->priv().caps(), arena, outputView,
+ std::move(appliedClip), dstProxyView);
context->priv().recordProgramInfo(fProgramInfo);
}
@@ -488,7 +481,7 @@
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
if (!fProgramInfo) {
- fProgramInfo = this->createProgramInfo(flushState);
+ this->createProgramInfo(flushState);
}
if (!fProgramInfo || !fMeshes.count()) {