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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "GrBatchBuffer.h"
9 #include "GrOptDrawState.h"
10
11 void GrBatchBuffer::initDraw(const GrPrimitiveProcessor* primProc, const GrOptDr awState* optState) {
12 GrNEW_APPEND_TO_RECORDER(fFlushBuffer, BufferedFlush, (primProc, optState));
13 }
14
15 void GrBatchBuffer::draw(const GrDrawTarget::DrawInfo& draw) {
16 GrNEW_APPEND_TO_RECORDER(fFlushBuffer.back().fDraws, DrawInfo, (draw));
17 }
18
19 void GrBatchBuffer::flush() {
20 FlushBuffer::Iter iter(fFlushBuffer);
21
22 while (iter.next()) {
23 GrProgramDesc desc;
24 BufferedFlush* bf = iter.get();
25 const GrOptDrawState* optState = bf->fOptState;
26 const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get();
27 fGpu->buildProgramDesc(&desc, *primProc, *optState, optState->descInfo() ,
28 optState->drawType(), bf->fBatchTracker);
29
30 GrGpu::DrawArgs args(primProc, optState, &desc, &bf->fBatchTracker);
31 DrawRecorder::Iter drawIter(bf->fDraws);
32 while (drawIter.next()) {
33 fGpu->draw(args, *drawIter.get());
34 }
35 }
36 fFlushBuffer.reset();
37 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698