OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrBatchTarget.h" | 8 #include "GrBatchTarget.h" |
9 | 9 |
10 #include "GrBufferAllocPool.h" | 10 #include "GrBufferAllocPool.h" |
11 #include "GrPipeline.h" | 11 #include "GrPipeline.h" |
12 | 12 |
13 /* | 13 /* |
14 void GrBatchTarget::flush() { | 14 void GrBatchTarget::flush() { |
15 FlushBuffer::Iter iter(fFlushBuffer); | 15 FlushBuffer::Iter iter(fFlushBuffer); |
16 fVertexPool->unmap(); | 16 fVertexPool->unmap(); |
17 fIndexPool->unmap(); | 17 fIndexPool->unmap(); |
18 | 18 |
19 while (iter.next()) { | 19 while (iter.next()) { |
20 GrProgramDesc desc; | 20 GrProgramDesc desc; |
21 BufferedFlush* bf = iter.get(); | 21 BufferedFlush* bf = iter.get(); |
22 const GrPipeline* pipeline = bf->fPipeline; | 22 const GrPipeline* pipeline = bf->fPipeline; |
23 const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get(); | 23 const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get(); |
24 fGpu->buildProgramDesc(&desc, *primProc, *pipeline, pipeline->descInfo()
, | 24 fGpu->buildProgramDesc(&desc, *primProc, *pipeline, bf->fBatchTracker); |
25 bf->fBatchTracker); | |
26 | 25 |
27 GrGpu::DrawArgs args(primProc, pipeline, &desc, &bf->fBatchTracker); | 26 GrGpu::DrawArgs args(primProc, pipeline, &desc, &bf->fBatchTracker); |
28 for (int i = 0; i < bf->fDraws.count(); i++) { | 27 for (int i = 0; i < bf->fDraws.count(); i++) { |
29 fGpu->draw(args, bf->fDraws[i]); | 28 fGpu->draw(args, bf->fDraws[i]); |
30 } | 29 } |
31 } | 30 } |
32 fFlushBuffer.reset(); | 31 fFlushBuffer.reset(); |
33 }*/ | 32 }*/ |
34 | 33 |
35 void GrBatchTarget::flushNext() { | 34 void GrBatchTarget::flushNext() { |
36 fIter.next(); | 35 fIter.next(); |
37 GrProgramDesc desc; | 36 GrProgramDesc desc; |
38 BufferedFlush* bf = fIter.get(); | 37 BufferedFlush* bf = fIter.get(); |
39 const GrPipeline* pipeline = bf->fPipeline; | 38 const GrPipeline* pipeline = bf->fPipeline; |
40 const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get(); | 39 const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get(); |
41 fGpu->buildProgramDesc(&desc, *primProc, *pipeline, pipeline->descInfo(), | 40 fGpu->buildProgramDesc(&desc, *primProc, *pipeline, bf->fBatchTracker); |
42 bf->fBatchTracker); | |
43 | 41 |
44 GrGpu::DrawArgs args(primProc, pipeline, &desc, &bf->fBatchTracker); | 42 GrGpu::DrawArgs args(primProc, pipeline, &desc, &bf->fBatchTracker); |
45 for (int i = 0; i < bf->fDraws.count(); i++) { | 43 for (int i = 0; i < bf->fDraws.count(); i++) { |
46 fGpu->draw(args, bf->fDraws[i]); | 44 fGpu->draw(args, bf->fDraws[i]); |
47 } | 45 } |
48 } | 46 } |
OLD | NEW |