Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: src/gpu/GrAAHairLinePathRenderer.cpp

Issue 1127273007: Iterate over instanced draws in GrGpu rather than above GrBatchTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove dead code Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrAADistanceFieldPathRenderer.cpp ('k') | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAAHairLinePathRenderer.cpp
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index 6101c9ba5be3b0e01888467838278dc87fe7b5b3..c5d8ae11269f66fdd3496e37650c38604f0b7b9b 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -869,30 +869,26 @@ void AAHairlineBatch::generateGeometry(GrBatchTarget* batchTarget, const GrPipel
size_t vertexStride = lineGP->getVertexStride();
int vertexCount = kLineSegNumVertices * lineCount;
- void *vertices = batchTarget->makeVertSpace(vertexStride, vertexCount,
- &vertexBuffer, &firstVertex);
+ LineVertex* verts = reinterpret_cast<LineVertex*>(
+ batchTarget->makeVertSpace(vertexStride, vertexCount, &vertexBuffer, &firstVertex));
- if (!vertices || !linesIndexBuffer) {
+ if (!verts|| !linesIndexBuffer) {
SkDebugf("Could not allocate vertices\n");
return;
}
SkASSERT(lineGP->getVertexStride() == sizeof(LineVertex));
- LineVertex* verts = reinterpret_cast<LineVertex*>(vertices);
for (int i = 0; i < lineCount; ++i) {
add_line(&lines[2*i], toSrc, this->coverage(), &verts);
}
{
- int linesLeft = lineCount;
- GrVertices info;
- info.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, linesIndexBuffer,
- firstVertex, kLineSegNumVertices, kIdxsPerLineSeg, &linesLeft,
- kLineSegsNumInIdxBuffer);
- do {
- batchTarget->draw(info);
- } while (info.nextInstances(&linesLeft, kLineSegsNumInIdxBuffer));
+ GrVertices vertices;
+ vertices.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, linesIndexBuffer,
+ firstVertex, kLineSegNumVertices, kIdxsPerLineSeg, lineCount,
+ kLineSegsNumInIdxBuffer);
+ batchTarget->draw(vertices);
}
}
@@ -939,15 +935,12 @@ void AAHairlineBatch::generateGeometry(GrBatchTarget* batchTarget, const GrPipel
quadGP->initBatchTracker(batchTarget->currentBatchTracker(), init);
{
- int quadsLeft = quadCount;
- GrVertices info;
- info.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, quadsIndexBuffer,
- firstVertex, kQuadNumVertices, kIdxsPerQuad, &quadsLeft,
- kQuadsNumInIdxBuffer);
- do {
- batchTarget->draw(info);
- } while (info.nextInstances(&quadsLeft, kQuadsNumInIdxBuffer));
- firstVertex += quadCount * kQuadNumVertices;
+ GrVertices verts;
+ verts.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, quadsIndexBuffer,
+ firstVertex, kQuadNumVertices, kIdxsPerQuad, quadCount,
+ kQuadsNumInIdxBuffer);
+ batchTarget->draw(verts);
+ firstVertex += quadCount * kQuadNumVertices;
}
}
@@ -963,14 +956,11 @@ void AAHairlineBatch::generateGeometry(GrBatchTarget* batchTarget, const GrPipel
conicGP->initBatchTracker(batchTarget->currentBatchTracker(), init);
{
- int conicsLeft = conicCount;
- GrVertices info;
- info.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, quadsIndexBuffer,
- firstVertex, kQuadNumVertices, kIdxsPerQuad, &conicsLeft,
- kQuadsNumInIdxBuffer);
- do {
- batchTarget->draw(info);
- } while (info.nextInstances(&conicsLeft, kQuadsNumInIdxBuffer));
+ GrVertices verts;
+ verts.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, quadsIndexBuffer,
+ firstVertex, kQuadNumVertices, kIdxsPerQuad, conicCount,
+ kQuadsNumInIdxBuffer);
+ batchTarget->draw(verts);
}
}
}
« no previous file with comments | « src/gpu/GrAADistanceFieldPathRenderer.cpp ('k') | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698