From 7539856c1b9cbb1886a6a498cc534b77fc83ddb2 Mon Sep 17 00:00:00 2001 From: bsalomon Date: Mon, 17 Aug 2015 12:55:38 -0700 Subject: Make GrVertexBatch objects hold their own draws during GrDrawTarget flush NO_MERGE_BUILDS Review URL: https://codereview.chromium.org/1286043004 --- src/gpu/GrOvalRenderer.cpp | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'src/gpu/GrOvalRenderer.cpp') diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp index fc6ecfab42..bd5042c027 100644 --- a/src/gpu/GrOvalRenderer.cpp +++ b/src/gpu/GrOvalRenderer.cpp @@ -7,7 +7,7 @@ #include "GrOvalRenderer.h" -#include "GrBatchTarget.h" +#include "GrBatchFlushState.h" #include "GrBatchTest.h" #include "GrDrawTarget.h" #include "GrGeometryProcessor.h" @@ -666,7 +666,7 @@ public: fBatch.fCoverageIgnored = !opt.readsCoverage(); } - void generateGeometry(GrBatchTarget* batchTarget) override { + void onPrepareDraws(Target* target) override { SkMatrix invert; if (!this->viewMatrix().invert(&invert)) { return; @@ -678,13 +678,13 @@ public: invert, this->usesLocalCoords())); - batchTarget->initDraw(gp, this->pipeline()); + target->initDraw(gp, this->pipeline()); int instanceCount = fGeoData.count(); size_t vertexStride = gp->getVertexStride(); SkASSERT(vertexStride == sizeof(CircleVertex)); QuadHelper helper; - CircleVertex* verts = reinterpret_cast(helper.init(batchTarget, vertexStride, + CircleVertex* verts = reinterpret_cast(helper.init(target, vertexStride, instanceCount)); if (!verts) { return; @@ -722,7 +722,7 @@ public: verts += kVerticesPerQuad; } - helper.issueDraw(batchTarget); + helper.recordDraw(target); } SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } @@ -884,7 +884,7 @@ public: fBatch.fCoverageIgnored = !opt.readsCoverage(); } - void generateGeometry(GrBatchTarget* batchTarget) override { + void onPrepareDraws(Target* target) override { SkMatrix invert; if (!this->viewMatrix().invert(&invert)) { return; @@ -896,14 +896,14 @@ public: invert, this->usesLocalCoords())); - batchTarget->initDraw(gp, this->pipeline()); + target->initDraw(gp, this->pipeline()); int instanceCount = fGeoData.count(); QuadHelper helper; size_t vertexStride = gp->getVertexStride(); SkASSERT(vertexStride == sizeof(EllipseVertex)); EllipseVertex* verts = reinterpret_cast( - helper.init(batchTarget, vertexStride, instanceCount)); + helper.init(target, vertexStride, instanceCount)); if (!verts) { return; } @@ -945,7 +945,7 @@ public: verts += kVerticesPerQuad; } - helper.issueDraw(batchTarget); + helper.recordDraw(target); } SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } @@ -1152,21 +1152,21 @@ public: fBatch.fCoverageIgnored = !opt.readsCoverage(); } - void generateGeometry(GrBatchTarget* batchTarget) override { + void onPrepareDraws(Target* target) override { // Setup geometry processor SkAutoTUnref gp(DIEllipseEdgeEffect::Create(this->color(), this->viewMatrix(), this->mode(), this->usesLocalCoords())); - batchTarget->initDraw(gp, this->pipeline()); + target->initDraw(gp, this->pipeline()); int instanceCount = fGeoData.count(); size_t vertexStride = gp->getVertexStride(); SkASSERT(vertexStride == sizeof(DIEllipseVertex)); QuadHelper helper; DIEllipseVertex* verts = reinterpret_cast( - helper.init(batchTarget, vertexStride, instanceCount)); + helper.init(target, vertexStride, instanceCount)); if (!verts) { return; } @@ -1204,7 +1204,7 @@ public: verts += kVerticesPerQuad; } - helper.issueDraw(batchTarget); + helper.recordDraw(target); } SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } @@ -1503,7 +1503,7 @@ public: fBatch.fCoverageIgnored = !opt.readsCoverage(); } - void generateGeometry(GrBatchTarget* batchTarget) override { + void onPrepareDraws(Target* target) override { // reset to device coordinates SkMatrix invert; if (!this->viewMatrix().invert(&invert)) { @@ -1517,7 +1517,7 @@ public: invert, this->usesLocalCoords())); - batchTarget->initDraw(gp, this->pipeline()); + target->initDraw(gp, this->pipeline()); int instanceCount = fGeoData.count(); size_t vertexStride = gp->getVertexStride(); @@ -1526,10 +1526,10 @@ public: // drop out the middle quad if we're stroked int indicesPerInstance = this->stroke() ? kIndicesPerStrokeRRect : kIndicesPerRRect; SkAutoTUnref indexBuffer( - ref_rrect_index_buffer(this->stroke(), batchTarget->resourceProvider())); + ref_rrect_index_buffer(this->stroke(), target->resourceProvider())); InstancedHelper helper; - CircleVertex* verts = reinterpret_cast(helper.init(batchTarget, + CircleVertex* verts = reinterpret_cast(helper.init(target, kTriangles_GrPrimitiveType, vertexStride, indexBuffer, kVertsPerRRect, indicesPerInstance, instanceCount)); if (!verts || !indexBuffer) { @@ -1581,7 +1581,7 @@ public: } } - helper.issueDraw(batchTarget); + helper.recordDraw(target); } SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } @@ -1679,7 +1679,7 @@ public: fBatch.fCoverageIgnored = !opt.readsCoverage(); } - void generateGeometry(GrBatchTarget* batchTarget) override { + void onPrepareDraws(Target* target) override { // reset to device coordinates SkMatrix invert; if (!this->viewMatrix().invert(&invert)) { @@ -1693,7 +1693,7 @@ public: invert, this->usesLocalCoords())); - batchTarget->initDraw(gp, this->pipeline()); + target->initDraw(gp, this->pipeline()); int instanceCount = fGeoData.count(); size_t vertexStride = gp->getVertexStride(); @@ -1702,11 +1702,11 @@ public: // drop out the middle quad if we're stroked int indicesPerInstance = this->stroke() ? kIndicesPerStrokeRRect : kIndicesPerRRect; SkAutoTUnref indexBuffer( - ref_rrect_index_buffer(this->stroke(), batchTarget->resourceProvider())); + ref_rrect_index_buffer(this->stroke(), target->resourceProvider())); InstancedHelper helper; EllipseVertex* verts = reinterpret_cast( - helper.init(batchTarget, kTriangles_GrPrimitiveType, vertexStride, indexBuffer, + helper.init(target, kTriangles_GrPrimitiveType, vertexStride, indexBuffer, kVertsPerRRect, indicesPerInstance, instanceCount)); if (!verts || !indexBuffer) { SkDebugf("Could not allocate vertices\n"); @@ -1767,7 +1767,7 @@ public: verts++; } } - helper.issueDraw(batchTarget); + helper.recordDraw(target); } SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } -- cgit v1.2.3