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/GrRegionOp.cpp b/src/gpu/ops/GrRegionOp.cpp
index 72b4d1d..172d219 100644
--- a/src/gpu/ops/GrRegionOp.cpp
+++ b/src/gpu/ops/GrRegionOp.cpp
@@ -99,29 +99,20 @@
}
private:
- 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 = make_gp(arena, caps->shaderCaps(), fViewMatrix, fWideColor);
if (!gp) {
SkDebugf("Couldn't create GrGeometryProcessor\n");
- return nullptr;
+ return;
}
- return fHelper.createProgramInfoWithStencil(caps, arena, outputView,
- std::move(appliedClip), dstProxyView,
- gp, GrPrimitiveType::kTriangles);
- }
-
- GrProgramInfo* createProgramInfo(Target* target) {
- return this->createProgramInfo(&target->caps(),
- target->allocator(),
- target->outputView(),
- target->detachAppliedClip(),
- target->dstProxyView());
+ fProgramInfo = fHelper.createProgramInfoWithStencil(caps, arena, outputView,
+ std::move(appliedClip), dstProxyView,
+ gp, GrPrimitiveType::kTriangles);
}
void onPrePrepareDraws(GrRecordingContext* context,
@@ -133,15 +124,15 @@
// 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);
}
void onPrepareDraws(Target* target) override {
if (!fProgramInfo) {
- fProgramInfo = this->createProgramInfo(target);
+ this->createProgramInfo(target);
if (!fProgramInfo) {
return;
}