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

Unified Diff: src/gpu/GrBatchTarget.cpp

Issue 975303005: Creation of GrBatchAtlas and Distancefieldpathrenderer batch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more tidying Created 5 years, 10 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
Index: src/gpu/GrBatchTarget.cpp
diff --git a/src/gpu/GrBatchTarget.cpp b/src/gpu/GrBatchTarget.cpp
index 21658d2a01a19eb31ad7343c32649a29c86a8228..c7543ceed4b8e433849c3dc3a2f67b027e631679 100644
--- a/src/gpu/GrBatchTarget.cpp
+++ b/src/gpu/GrBatchTarget.cpp
@@ -7,42 +7,49 @@
#include "GrBatchTarget.h"
+#include "GrBatchAtlas.h"
#include "GrPipeline.h"
-/*
-void GrBatchTarget::flush() {
- FlushBuffer::Iter iter(fFlushBuffer);
- fVertexPool->unmap();
- fIndexPool->unmap();
+GrBatchTarget::GrBatchTarget(GrGpu* gpu,
+ GrVertexBufferAllocPool* vpool,
+ GrIndexBufferAllocPool* ipool)
+ : fGpu(gpu)
+ , fVertexPool(vpool)
+ , fIndexPool(ipool)
+ , fFlushBuffer(kFlushBufferInitialSizeInBytes)
+ , fIter(fFlushBuffer)
+ , fNumberOfDraws(0)
+ , fCurrentToken(0)
+ , fLastFlushedToken(0)
+ , fInlineUpdatesIndex(0) {
+}
- while (iter.next()) {
- GrProgramDesc desc;
- BufferedFlush* bf = iter.get();
- const GrPipeline* pipeline = bf->fPipeline;
- const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get();
- fGpu->buildProgramDesc(&desc, *primProc, *pipeline, bf->fBatchTracker);
-
- GrGpu::DrawArgs args(primProc, pipeline, &desc, &bf->fBatchTracker);
- for (int i = 0; i < bf->fDraws.count(); i++) {
- fGpu->draw(args, bf->fDraws[i]);
- }
- }
- fFlushBuffer.reset();
-}*/
-/*
-void GrBatchTarget::flushNext(int n) {
+void GrBatchTarget::flushNext(int n) {
for (; n > 0; n--) {
+ fLastFlushedToken++;
SkDEBUGCODE(bool verify =) fIter.next();
SkASSERT(verify);
- GrProgramDesc desc;
+
BufferedFlush* bf = fIter.get();
+
+ // Flush all texture uploads
+ int updateCount = fInlineUpdates.count();
+ while (fInlineUpdatesIndex < updateCount &&
+ fInlineUpdates[fInlineUpdatesIndex].lastUploadToken() <= fLastFlushedToken) {
+ fInlineUpdates[fInlineUpdatesIndex++].update();
+ }
+
+ GrProgramDesc desc;
const GrPipeline* pipeline = bf->fPipeline;
const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get();
fGpu->buildProgramDesc(&desc, *primProc, *pipeline, bf->fBatchTracker);
GrGpu::DrawArgs args(primProc, pipeline, &desc, &bf->fBatchTracker);
- for (int i = 0; i < bf->fDraws.count(); i++) {
- fGpu->draw(args, bf->fDraws[i]);
+
+ int drawCount = bf->fDraws.count();
+ const SkSTArray<1, DrawInfo, true>& draws = bf->fDraws;
+ for (int i = 0; i < drawCount; i++) {
+ fGpu->draw(args, draws[i]);
}
}
-}*/
+}

Powered by Google App Engine
This is Rietveld 408576698