blob: 6a3135310a7c611f1742f44497bfba71fbc8ca60 [file] [log] [blame]
joshualittd5a7db42015-01-27 15:39:06 -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
13/*
14void GrBatchTarget::flush() {
15 FlushBuffer::Iter iter(fFlushBuffer);
16 fVertexPool->unmap();
17 fIndexPool->unmap();
18
19 while (iter.next()) {
20 GrProgramDesc desc;
21 BufferedFlush* bf = iter.get();
22 const GrPipeline* pipeline = bf->fPipeline;
23 const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get();
24 fGpu->buildProgramDesc(&desc, *primProc, *pipeline, pipeline->descInfo(),
25 bf->fBatchTracker);
26
27 GrGpu::DrawArgs args(primProc, pipeline, &desc, &bf->fBatchTracker);
28 for (int i = 0; i < bf->fDraws.count(); i++) {
29 fGpu->draw(args, bf->fDraws[i]);
30 }
31 }
32 fFlushBuffer.reset();
33}*/
34
35void GrBatchTarget::flushNext() {
36 fIter.next();
37 GrProgramDesc desc;
38 BufferedFlush* bf = fIter.get();
39 const GrPipeline* pipeline = bf->fPipeline;
40 const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get();
41 fGpu->buildProgramDesc(&desc, *primProc, *pipeline, pipeline->descInfo(),
42 bf->fBatchTracker);
43
44 GrGpu::DrawArgs args(primProc, pipeline, &desc, &bf->fBatchTracker);
45 for (int i = 0; i < bf->fDraws.count(); i++) {
46 fGpu->draw(args, bf->fDraws[i]);
47 }
48}