blob: 52261a18397a79c81492affbea8c7dca15f7ad8f [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
robertphillips1f0e3502015-11-10 10:19:50 -080013GrBatchFlushState::GrBatchFlushState(GrGpu* gpu, GrResourceProvider* resourceProvider)
bsalomon75398562015-08-17 12:55:38 -070014 : fGpu(gpu)
15 , fUploader(gpu)
16 , fResourceProvider(resourceProvider)
17 , fVertexPool(gpu)
18 , fIndexPool(gpu)
robertphillips1f0e3502015-11-10 10:19:50 -080019 , fCurrentToken(0)
20 , fLastFlushedToken(0) {}
bsalomon75398562015-08-17 12:55:38 -070021
22void* GrBatchFlushState::makeVertexSpace(size_t vertexSize, int vertexCount,
23 const GrVertexBuffer** buffer, int* startVertex) {
24 return fVertexPool.makeSpace(vertexSize, vertexCount, buffer, startVertex);
25}
26
27uint16_t* GrBatchFlushState::makeIndexSpace(int indexCount,
28 const GrIndexBuffer** buffer, int* startIndex) {
29 return reinterpret_cast<uint16_t*>(fIndexPool.makeSpace(indexCount, buffer, startIndex));
30}