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

Unified Diff: src/gpu/batches/GrAADistanceFieldPathRenderer.cpp

Issue 1835283002: Simplify GrDrawBatch uploads and token uage. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 9 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/batches/GrAAConvexPathRenderer.cpp ('k') | src/gpu/batches/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
index f10d3b8bbeabd7753b359429bfe1b198460160b3..35d1f619773166d536ecd16355af5a859f729def 100644
--- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
@@ -176,8 +176,9 @@ private:
}
struct FlushInfo {
- SkAutoTUnref<const GrBuffer> fVertexBuffer;
- SkAutoTUnref<const GrBuffer> fIndexBuffer;
+ SkAutoTUnref<const GrBuffer> fVertexBuffer;
+ SkAutoTUnref<const GrBuffer> fIndexBuffer;
+ SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor;
int fVertexOffset;
int fInstancesToFlush;
};
@@ -198,9 +199,11 @@ private:
GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBilerp_FilterMode);
+ FlushInfo flushInfo;
+
// Setup GrGeometryProcessor
GrBatchAtlas* atlas = fAtlas;
- SkAutoTUnref<GrGeometryProcessor> dfProcessor(
+ flushInfo.fGeometryProcessor.reset(
GrDistanceFieldPathGeoProc::Create(this->color(),
this->viewMatrix(),
atlas->getTexture(),
@@ -208,12 +211,8 @@ private:
flags,
this->usesLocalCoords()));
- target->initDraw(dfProcessor);
-
- FlushInfo flushInfo;
-
// allocate vertices
- size_t vertexStride = dfProcessor->getVertexStride();
+ size_t vertexStride = flushInfo.fGeometryProcessor->getVertexStride();
SkASSERT(vertexStride == 2 * sizeof(SkPoint) + sizeof(GrColor));
const GrBuffer* vertexBuffer;
@@ -259,8 +258,6 @@ private:
SkScalar scale = desiredDimension/maxDim;
pathData = new PathData;
if (!this->addPathToAtlas(target,
- dfProcessor,
- this->pipeline(),
&flushInfo,
atlas,
pathData,
@@ -275,15 +272,13 @@ private:
}
}
- atlas->setLastUseToken(pathData->fID, target->currentToken());
+ atlas->setLastUseToken(pathData->fID, target->nextDrawToken());
// Now set vertices
intptr_t offset = reinterpret_cast<intptr_t>(vertices);
offset += i * kVerticesPerQuad * vertexStride;
this->writePathVertices(target,
atlas,
- this->pipeline(),
- dfProcessor,
offset,
args.fColor,
vertexStride,
@@ -316,8 +311,6 @@ private:
}
bool addPathToAtlas(GrVertexBatch::Target* target,
- const GrGeometryProcessor* dfProcessor,
- const GrPipeline* pipeline,
FlushInfo* flushInfo,
GrBatchAtlas* atlas,
PathData* pathData,
@@ -406,7 +399,6 @@ private:
&atlasLocation);
if (!success) {
this->flush(target, flushInfo);
- target->initDraw(dfProcessor);
SkDEBUGCODE(success =) atlas->addToAtlas(&id, target, width, height,
dfStorage.get(), &atlasLocation);
@@ -443,8 +435,6 @@ private:
void writePathVertices(GrDrawBatch::Target* target,
GrBatchAtlas* atlas,
- const GrPipeline* pipeline,
- const GrGeometryProcessor* gp,
intptr_t offset,
GrColor color,
size_t vertexStride,
@@ -496,7 +486,7 @@ private:
mesh.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuffer,
flushInfo->fIndexBuffer, flushInfo->fVertexOffset, kVerticesPerQuad,
kIndicesPerQuad, flushInfo->fInstancesToFlush, maxInstancesPerDraw);
- target->draw(mesh);
+ target->draw(flushInfo->fGeometryProcessor, mesh);
flushInfo->fVertexOffset += kVerticesPerQuad * flushInfo->fInstancesToFlush;
flushInfo->fInstancesToFlush = 0;
}
« no previous file with comments | « src/gpu/batches/GrAAConvexPathRenderer.cpp ('k') | src/gpu/batches/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698