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

Unified Diff: src/gpu/GrBatchBuffer.cpp

Issue 845103005: GrBatchPrototype (Closed) Base URL: https://skia.googlesource.com/skia.git@lc2
Patch Set: update devrect Created 5 years, 11 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/GrBatchBuffer.cpp
diff --git a/src/gpu/GrBatchBuffer.cpp b/src/gpu/GrBatchBuffer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..0f462d2d0c92c341af191d97613181990169041a
--- /dev/null
+++ b/src/gpu/GrBatchBuffer.cpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrBatchBuffer.h"
+#include "GrOptDrawState.h"
+
+void GrBatchBuffer::initDraw(const GrPrimitiveProcessor* primProc, const GrOptDrawState* optState) {
+ GrNEW_APPEND_TO_RECORDER(fFlushBuffer, BufferedFlush, (primProc, optState));
+}
+
+void GrBatchBuffer::draw(const GrDrawTarget::DrawInfo& draw) {
+ GrNEW_APPEND_TO_RECORDER(fFlushBuffer.back().fDraws, DrawInfo, (draw));
+}
+
+void GrBatchBuffer::flush() {
+ FlushBuffer::Iter iter(fFlushBuffer);
+
+ while (iter.next()) {
+ GrProgramDesc desc;
+ BufferedFlush* bf = iter.get();
+ const GrOptDrawState* optState = bf->fOptState;
+ const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get();
+ fGpu->buildProgramDesc(&desc, *primProc, *optState, optState->descInfo(),
+ optState->drawType(), bf->fBatchTracker);
+
+ GrGpu::DrawArgs args(primProc, optState, &desc, &bf->fBatchTracker);
+ DrawRecorder::Iter drawIter(bf->fDraws);
+ while (drawIter.next()) {
+ fGpu->draw(args, *drawIter.get());
+ }
+ }
+ fFlushBuffer.reset();
+}

Powered by Google App Engine
This is Rietveld 408576698