| Index: src/gpu/GrBatchBuffer.cpp
|
| diff --git a/src/gpu/GrBatchBuffer.cpp b/src/gpu/GrBatchBuffer.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0f462d2d0c92c341af191d97613181990169041a
|
| --- /dev/null
|
| +++ b/src/gpu/GrBatchBuffer.cpp
|
| @@ -0,0 +1,37 @@
|
| +/*
|
| + * Copyright 2015 Google Inc.
|
| + *
|
| + * Use of this source code is governed by a BSD-style license that can be
|
| + * found in the LICENSE file.
|
| + */
|
| +
|
| +#include "GrBatchBuffer.h"
|
| +#include "GrOptDrawState.h"
|
| +
|
| +void GrBatchBuffer::initDraw(const GrPrimitiveProcessor* primProc, const GrOptDrawState* optState) {
|
| + GrNEW_APPEND_TO_RECORDER(fFlushBuffer, BufferedFlush, (primProc, optState));
|
| +}
|
| +
|
| +void GrBatchBuffer::draw(const GrDrawTarget::DrawInfo& draw) {
|
| + GrNEW_APPEND_TO_RECORDER(fFlushBuffer.back().fDraws, DrawInfo, (draw));
|
| +}
|
| +
|
| +void GrBatchBuffer::flush() {
|
| + FlushBuffer::Iter iter(fFlushBuffer);
|
| +
|
| + while (iter.next()) {
|
| + GrProgramDesc desc;
|
| + BufferedFlush* bf = iter.get();
|
| + const GrOptDrawState* optState = bf->fOptState;
|
| + const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get();
|
| + fGpu->buildProgramDesc(&desc, *primProc, *optState, optState->descInfo(),
|
| + optState->drawType(), bf->fBatchTracker);
|
| +
|
| + GrGpu::DrawArgs args(primProc, optState, &desc, &bf->fBatchTracker);
|
| + DrawRecorder::Iter drawIter(bf->fDraws);
|
| + while (drawIter.next()) {
|
| + fGpu->draw(args, *drawIter.get());
|
| + }
|
| + }
|
| + fFlushBuffer.reset();
|
| +}
|
|
|