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

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

Issue 1278643006: Make GrBatch carry its own GrPipeline (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more Created 5 years, 4 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/GrBatch.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrBatch.cpp
diff --git a/src/gpu/batches/GrBatch.cpp b/src/gpu/batches/GrBatch.cpp
index 7fee5f25c3d6646b6c505a0a2e6e507afe22d2b5..3840b4c83bb90e51f0cac66e32538c599ef2ebd5 100644
--- a/src/gpu/batches/GrBatch.cpp
+++ b/src/gpu/batches/GrBatch.cpp
@@ -48,6 +48,23 @@ void GrBatch::operator delete(void* target) {
return MemoryPoolAccessor().pool()->release(target);
}
+GrBatch::GrBatch()
+ : fClassID(kIllegalBatchID)
+ , fNumberOfDraws(0)
+ , fPipelineInstalled(false)
+#if GR_BATCH_SPEW
+ , fUniqueID(GenID(&gCurrBatchUniqueID))
+#endif
+{
+ SkDEBUGCODE(fUsed = false;)
+}
+
+GrBatch::~GrBatch() {
+ if (fPipelineInstalled) {
+ this->pipeline()->~GrPipeline();
+ }
+}
+
void* GrBatch::InstancedHelper::init(GrBatchTarget* batchTarget, GrPrimitiveType primType,
size_t vertexStride, const GrIndexBuffer* indexBuffer,
int verticesPerInstance, int indicesPerInstance,
@@ -85,3 +102,14 @@ void* GrBatch::QuadHelper::init(GrBatchTarget* batchTarget, size_t vertexStride,
return this->INHERITED::init(batchTarget, kTriangles_GrPrimitiveType, vertexStride,
quadIndexBuffer, kVerticesPerQuad, kIndicesPerQuad, quadsToDraw);
}
+
+bool GrBatch::installPipeline(const GrPipeline::CreateArgs& args) {
+ GrPipelineOptimizations opts;
+ void* location = fPipelineStorage.get();
+ if (!GrPipeline::CreateAt(location, args, &opts)) {
+ return false;
+ }
+ this->initBatchTracker(opts);
+ fPipelineInstalled = true;
+ return true;
+}
« no previous file with comments | « src/gpu/batches/GrBatch.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698