blob: f12066609e1a7a3adf469f140713be70579e7031 [file] [log] [blame]
bsalomon75398562015-08-17 12:55:38 -07001/*
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 "GrBatchFlushState.h"
9
10#include "GrBatchAtlas.h"
11#include "GrPipeline.h"
12
13GrBatchFlushState::GrBatchFlushState(GrGpu* gpu, GrResourceProvider* resourceProvider,
14 GrBatchToken lastFlushedToken)
15 : fGpu(gpu)
16 , fUploader(gpu)
17 , fResourceProvider(resourceProvider)
18 , fVertexPool(gpu)
19 , fIndexPool(gpu)
20 , fCurrentToken(lastFlushedToken)
21 , fLastFlushedToken(lastFlushedToken) {}
22
23void* GrBatchFlushState::makeVertexSpace(size_t vertexSize, int vertexCount,
24 const GrVertexBuffer** buffer, int* startVertex) {
25 return fVertexPool.makeSpace(vertexSize, vertexCount, buffer, startVertex);
26}
27
28uint16_t* GrBatchFlushState::makeIndexSpace(int indexCount,
29 const GrIndexBuffer** buffer, int* startIndex) {
30 return reinterpret_cast<uint16_t*>(fIndexPool.makeSpace(indexCount, buffer, startIndex));
31}