blob: d5d8d8f28508a386f9e35e4df85fbea5e7a801a9 [file] [log] [blame]
joshualitt4d8da812015-01-28 12:53:54 -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();
egdaniel74a11752015-02-03 15:02:43 -080024 fGpu->buildProgramDesc(&desc, *primProc, *pipeline, bf->fBatchTracker);
joshualitt4d8da812015-01-28 12:53:54 -080025
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}*/
33
joshualitt46c77f72015-02-03 08:40:22 -080034void GrBatchTarget::flushNext() {
35 fIter.next();
36 GrProgramDesc desc;
37 BufferedFlush* bf = fIter.get();
38 const GrPipeline* pipeline = bf->fPipeline;
39 const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get();
egdaniel74a11752015-02-03 15:02:43 -080040 fGpu->buildProgramDesc(&desc, *primProc, *pipeline, bf->fBatchTracker);
joshualitt4d8da812015-01-28 12:53:54 -080041
joshualitt46c77f72015-02-03 08:40:22 -080042 GrGpu::DrawArgs args(primProc, pipeline, &desc, &bf->fBatchTracker);
43 for (int i = 0; i < bf->fDraws.count(); i++) {
44 fGpu->draw(args, bf->fDraws[i]);
joshualitt4d8da812015-01-28 12:53:54 -080045 }
46}