blob: 1b68923472e97ccc09b01f9e83c9c135933d640d [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();
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
joshualitt658d55c2015-02-03 06:56:44 -080035void GrBatchTarget::flushNext(int n) {
36 for (; n > 0; n--) {
37 SkDEBUGCODE(bool verify =) fIter.next();
38 SkASSERT(verify);
39 GrProgramDesc desc;
40 BufferedFlush* bf = fIter.get();
41 const GrPipeline* pipeline = bf->fPipeline;
42 const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get();
43 fGpu->buildProgramDesc(&desc, *primProc, *pipeline, pipeline->descInfo(),
44 bf->fBatchTracker);
joshualitt4d8da812015-01-28 12:53:54 -080045
joshualitt658d55c2015-02-03 06:56:44 -080046 GrGpu::DrawArgs args(primProc, pipeline, &desc, &bf->fBatchTracker);
47 for (int i = 0; i < bf->fDraws.count(); i++) {
48 fGpu->draw(args, bf->fDraws[i]);
49 }
joshualitt4d8da812015-01-28 12:53:54 -080050 }
51}