OLD | NEW |
(Empty) | |
| 1 /* |
| 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 "GrBatchBuffer.h" |
| 9 #include "GrOptDrawState.h" |
| 10 |
| 11 void GrBatchBuffer::initDraw(const GrPrimitiveProcessor* primProc, const GrOptDr
awState* optState) { |
| 12 GrNEW_APPEND_TO_RECORDER(fFlushBuffer, BufferedFlush, (primProc, optState)); |
| 13 } |
| 14 |
| 15 void GrBatchBuffer::draw(const GrDrawTarget::DrawInfo& draw) { |
| 16 GrNEW_APPEND_TO_RECORDER(fFlushBuffer.back().fDraws, DrawInfo, (draw)); |
| 17 } |
| 18 |
| 19 void GrBatchBuffer::flush() { |
| 20 FlushBuffer::Iter iter(fFlushBuffer); |
| 21 |
| 22 while (iter.next()) { |
| 23 GrProgramDesc desc; |
| 24 BufferedFlush* bf = iter.get(); |
| 25 const GrOptDrawState* optState = bf->fOptState; |
| 26 const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get(); |
| 27 fGpu->buildProgramDesc(&desc, *primProc, *optState, optState->descInfo()
, |
| 28 optState->drawType(), bf->fBatchTracker); |
| 29 |
| 30 GrGpu::DrawArgs args(primProc, optState, &desc, &bf->fBatchTracker); |
| 31 DrawRecorder::Iter drawIter(bf->fDraws); |
| 32 while (drawIter.next()) { |
| 33 fGpu->draw(args, *drawIter.get()); |
| 34 } |
| 35 } |
| 36 fFlushBuffer.reset(); |
| 37 } |
OLD | NEW |