blob: 1ae8b638e52c8b64fef531fde2d07438e273c395 [file] [log] [blame]
joshualittd15e4e42015-01-26 13:30:10 -08001/*
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 "GrBatchTarget.h"
9
10#include "GrBufferAllocPool.h"
11#include "GrPipeline.h"
12
13void GrBatchTarget::flush() {
14 FlushBuffer::Iter iter(fFlushBuffer);
15 fVertexPool->unmap();
16 fIndexPool->unmap();
17
18 while (iter.next()) {
19 GrProgramDesc desc;
20 BufferedFlush* bf = iter.get();
21 const GrPipeline* pipeline = bf->fPipeline;
22 const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get();
23 fGpu->buildProgramDesc(&desc, *primProc, *pipeline, pipeline->descInfo(),
24 bf->fBatchTracker);
25
26 GrGpu::DrawArgs args(primProc, pipeline, &desc, &bf->fBatchTracker);
27 for (int i = 0; i < bf->fDraws.count(); i++) {
28 fGpu->draw(args, bf->fDraws[i]);
29 }
30 }
31 fFlushBuffer.reset();
32}