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

Unified Diff: src/gpu/GrInOrderDrawBuffer.cpp

Issue 761563002: First step to moving vertex attributes to the geometryProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more cleanup Created 6 years, 1 month 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
Index: src/gpu/GrInOrderDrawBuffer.cpp
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 45dd16d9a62974996b49df4e0efba3b07d9802cd..c04c43fcc3801b644c9b2b4e19673a30acdf39f9 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -88,8 +88,7 @@ static void set_vertex_attributes(GrDrawState* drawState, bool hasLocalCoords, G
uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType |
GrDefaultGeoProcFactory::kColor_GPType;
flags |= hasLocalCoords ? GrDefaultGeoProcFactory::kLocalCoord_GPType : 0;
- drawState->setGeometryProcessor(GrDefaultGeoProcFactory::CreateAndSetAttribs(drawState,
- flags))->unref();
+ drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(flags))->unref();
if (0xFF == GrColorUnpackA(color)) {
drawState->setHint(GrDrawState::kVertexColorsAreOpaque_Hint, true);
}
@@ -141,7 +140,8 @@ void GrInOrderDrawBuffer::onDrawRect(GrDrawState* ds,
GrColor color = ds->getColor();
set_vertex_attributes(ds, SkToBool(localRect), color);
- AutoReleaseGeometry geo(this, 4, ds->getVertexStride(), 0);
+ size_t vstride = ds->getGeometryProcessor()->getVertexStride();
+ AutoReleaseGeometry geo(this, 4, vstride, 0);
if (!geo.succeeded()) {
SkDebugf("Failed to get space for vertices!\n");
return;
@@ -158,8 +158,6 @@ void GrInOrderDrawBuffer::onDrawRect(GrDrawState* ds,
return;
}
- size_t vstride = ds->getVertexStride();
-
geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vstride);
matrix.mapPointsWithStride(geo.positions(), vstride, 4);
@@ -235,7 +233,8 @@ int GrInOrderDrawBuffer::concatInstancedDraw(const GrDrawState& ds, const DrawIn
instancesToConcat = SkTMin(instancesToConcat, info.instanceCount());
// update the amount of reserved vertex data actually referenced in draws
- size_t vertexBytes = instancesToConcat * info.verticesPerInstance() * ds.getVertexStride();
+ size_t vertexBytes = instancesToConcat * info.verticesPerInstance() *
+ ds.getGeometryProcessor()->getVertexStride();
poolState.fUsedPoolVertexBytes = SkTMax(poolState.fUsedPoolVertexBytes, vertexBytes);
draw->fInfo.adjustInstanceCount(instancesToConcat);
@@ -283,7 +282,8 @@ void GrInOrderDrawBuffer::onDraw(const GrDrawState& ds,
// Adjust the starting vertex and index when we are using reserved or array sources to
// compensate for the fact that the data was inserted into a larger vb/ib owned by the pool.
if (kBuffer_GeometrySrcType != this->getGeomSrc().fVertexSrc) {
- size_t bytes = (info.vertexCount() + info.startVertex()) * ds.getVertexStride();
+ size_t bytes = (info.vertexCount() + info.startVertex()) *
+ ds.getGeometryProcessor()->getVertexStride();
poolState.fUsedPoolVertexBytes = SkTMax(poolState.fUsedPoolVertexBytes, bytes);
draw->fInfo.adjustStartVertex(poolState.fPoolStartVertex);
}

Powered by Google App Engine
This is Rietveld 408576698