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

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

Issue 1806983002: Update how we send draws to gpu backend to reduce state setting. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit 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/GrVertexBatch.h ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrVertexBatch.cpp
diff --git a/src/gpu/batches/GrVertexBatch.cpp b/src/gpu/batches/GrVertexBatch.cpp
index 5897fe95c47bcbfeb709b0fdd121e3ecade42380..17bcf8e3aff11f07c8d1dffb1038c714cbd53fae 100644
--- a/src/gpu/batches/GrVertexBatch.cpp
+++ b/src/gpu/batches/GrVertexBatch.cpp
@@ -36,15 +36,15 @@ void* GrVertexBatch::InstancedHelper::init(Target* target, GrPrimitiveType primT
size_t ibSize = indexBuffer->gpuMemorySize();
int maxInstancesPerDraw = static_cast<int>(ibSize / (sizeof(uint16_t) * indicesPerInstance));
- fVertices.initInstanced(primType, vertexBuffer, indexBuffer,
+ fMesh.initInstanced(primType, vertexBuffer, indexBuffer,
firstVertex, verticesPerInstance, indicesPerInstance, instancesToDraw,
maxInstancesPerDraw);
return vertices;
}
void GrVertexBatch::InstancedHelper::recordDraw(Target* target) {
- SkASSERT(fVertices.instanceCount());
- target->draw(fVertices);
+ SkASSERT(fMesh.instanceCount());
+ target->draw(fMesh);
}
void* GrVertexBatch::QuadHelper::init(Target* target, size_t vertexStride,
@@ -72,15 +72,10 @@ void GrVertexBatch::onDraw(GrBatchFlushState* state) {
fInlineUploads[currUpload++]->upload(state->uploader());
}
const GrVertexBatch::DrawArray& drawArray = *da.get();
- GrProgramDesc desc;
- const GrPipeline* pipeline = this->pipeline();
- const GrPrimitiveProcessor* primProc = drawArray.fPrimitiveProcessor.get();
- state->gpu()->buildProgramDesc(&desc, *primProc, *pipeline);
- GrGpu::DrawArgs args(primProc, pipeline, &desc);
- int drawCount = drawArray.fDraws.count();
- for (int i = 0; i < drawCount; i++) {
- state->gpu()->draw(args, drawArray.fDraws[i]);
- }
+ state->gpu()->draw(*this->pipeline(),
+ *drawArray.fPrimitiveProcessor.get(),
+ drawArray.fDraws.begin(),
+ drawArray.fDraws.count());
}
}
« no previous file with comments | « src/gpu/batches/GrVertexBatch.h ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698