aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrBatchTarget.cpp
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-03-13 11:47:42 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-13 11:47:42 -0700
commit5bf99f1ca8f30287803b594d06c60a7b6796ad45 (patch)
tree84fc1202da6ce911d29e4ca8f618136e690b38b5 /src/gpu/GrBatchTarget.cpp
parent2a679ae8f5b80a337f67783dbc0a447a9f4312c7 (diff)
Creation of GrBatchAtlas and Distancefieldpathrenderer batch
Diffstat (limited to 'src/gpu/GrBatchTarget.cpp')
-rw-r--r--src/gpu/GrBatchTarget.cpp57
1 files changed, 32 insertions, 25 deletions
diff --git a/src/gpu/GrBatchTarget.cpp b/src/gpu/GrBatchTarget.cpp
index 21658d2a01..4c24a80c95 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 uploadCount = fInlineUploads.count();
+ while (fInlineUpdatesIndex < uploadCount &&
+ fInlineUploads[fInlineUpdatesIndex]->lastUploadToken() <= fLastFlushedToken) {
+ fInlineUploads[fInlineUpdatesIndex++]->upload(TextureUploader(fGpu));
+ }
+
+ 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]);
}
}
-}*/
+}