Move pipeline handling out of GrMeshDrawOp.
The monolithic GrPipeline is moved to a subclass GrLegacyDrawMeshOp.
The pipeline used to record a GrMesh draw in a GrMeshDrawOp must now be passed rather than implicitly using the op's pipeline.
Change-Id: I50d77e4dcc8d91a523fa7566ce43a9a291174706
Reviewed-on: https://skia-review.googlesource.com/11002
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp
index ced9b4e..ef70bc5 100644
--- a/src/gpu/ops/GrSmallPathRenderer.cpp
+++ b/src/gpu/ops/GrSmallPathRenderer.cpp
@@ -133,7 +133,7 @@
// padding around path bounds to allow for antialiased pixels
static const SkScalar kAntiAliasPad = 1.0f;
-class SmallPathOp final : public GrMeshDrawOp {
+class SmallPathOp final : public GrLegacyMeshDrawOp {
public:
DEFINE_OP_CLASS_ID
@@ -141,12 +141,12 @@
using ShapeCache = SkTDynamicHash<ShapeData, ShapeData::Key>;
using ShapeDataList = GrSmallPathRenderer::ShapeDataList;
- static std::unique_ptr<GrMeshDrawOp> Make(GrColor color, const GrShape& shape,
- const SkMatrix& viewMatrix, GrDrawOpAtlas* atlas,
- ShapeCache* shapeCache, ShapeDataList* shapeList,
- bool gammaCorrect) {
- return std::unique_ptr<GrMeshDrawOp>(new SmallPathOp(color, shape, viewMatrix, atlas,
- shapeCache, shapeList, gammaCorrect));
+ static std::unique_ptr<GrLegacyMeshDrawOp> Make(GrColor color, const GrShape& shape,
+ const SkMatrix& viewMatrix,
+ GrDrawOpAtlas* atlas, ShapeCache* shapeCache,
+ ShapeDataList* shapeList, bool gammaCorrect) {
+ return std::unique_ptr<GrLegacyMeshDrawOp>(new SmallPathOp(
+ color, shape, viewMatrix, atlas, shapeCache, shapeList, gammaCorrect));
}
const char* name() const override { return "SmallPathOp"; }
@@ -388,9 +388,9 @@
this->flush(target, &flushInfo);
}
- bool addDFPathToAtlas(GrMeshDrawOp::Target* target, FlushInfo* flushInfo, GrDrawOpAtlas* atlas,
- ShapeData* shapeData, const GrShape& shape, uint32_t dimension,
- SkScalar scale) const {
+ bool addDFPathToAtlas(GrLegacyMeshDrawOp::Target* target, FlushInfo* flushInfo,
+ GrDrawOpAtlas* atlas, ShapeData* shapeData, const GrShape& shape,
+ uint32_t dimension, SkScalar scale) const {
const SkRect& bounds = shape.bounds();
// generate bounding rect for bitmap draw
@@ -505,9 +505,9 @@
return true;
}
- bool addBMPathToAtlas(GrMeshDrawOp::Target* target, FlushInfo* flushInfo,
- GrDrawOpAtlas* atlas, ShapeData* shapeData,
- const GrShape& shape, const SkMatrix& ctm) const {
+ bool addBMPathToAtlas(GrLegacyMeshDrawOp::Target* target, FlushInfo* flushInfo,
+ GrDrawOpAtlas* atlas, ShapeData* shapeData, const GrShape& shape,
+ const SkMatrix& ctm) const {
const SkRect& bounds = shape.bounds();
if (bounds.isEmpty()) {
return false;
@@ -677,7 +677,7 @@
textureCoords[1] = t;
}
- void flush(GrMeshDrawOp::Target* target, FlushInfo* flushInfo) const {
+ void flush(GrLegacyMeshDrawOp::Target* target, FlushInfo* flushInfo) const {
if (flushInfo->fInstancesToFlush) {
GrMesh mesh;
int maxInstancesPerDraw =
@@ -685,7 +685,7 @@
mesh.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuffer.get(),
flushInfo->fIndexBuffer.get(), flushInfo->fVertexOffset, kVerticesPerQuad,
kIndicesPerQuad, flushInfo->fInstancesToFlush, maxInstancesPerDraw);
- target->draw(flushInfo->fGeometryProcessor.get(), mesh);
+ target->draw(flushInfo->fGeometryProcessor.get(), this->pipeline(), mesh);
flushInfo->fVertexOffset += kVerticesPerQuad * flushInfo->fInstancesToFlush;
flushInfo->fInstancesToFlush = 0;
}
@@ -738,7 +738,7 @@
ShapeDataList* fShapeList;
bool fGammaCorrect;
- typedef GrMeshDrawOp INHERITED;
+ typedef GrLegacyMeshDrawOp INHERITED;
};
bool GrSmallPathRenderer::onDrawPath(const DrawPathArgs& args) {
@@ -760,13 +760,13 @@
}
}
- std::unique_ptr<GrMeshDrawOp> op = SmallPathOp::Make(
- args.fPaint.getColor(), *args.fShape, *args.fViewMatrix, fAtlas.get(), &fShapeCache,
- &fShapeList, args.fGammaCorrect);
+ std::unique_ptr<GrLegacyMeshDrawOp> op =
+ SmallPathOp::Make(args.fPaint.getColor(), *args.fShape, *args.fViewMatrix, fAtlas.get(),
+ &fShapeCache, &fShapeList, args.fGammaCorrect);
GrPipelineBuilder pipelineBuilder(std::move(args.fPaint), args.fAAType);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
- args.fRenderTargetContext->addMeshDrawOp(pipelineBuilder, *args.fClip, std::move(op));
+ args.fRenderTargetContext->addLegacyMeshDrawOp(pipelineBuilder, *args.fClip, std::move(op));
return true;
}