blob: c4ba2644a9dfc0d86a80a81df21ab3b8ee5600a3 [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)
bsalomon75398562015-08-17 12:55:38 -070015 , fResourceProvider(resourceProvider)
16 , fVertexPool(gpu)
17 , fIndexPool(gpu)
bsalomon342bfc22016-04-01 06:06:20 -070018 , fLastIssuedToken(GrBatchDrawToken::AlreadyFlushedToken())
robertphillips1f0e3502015-11-10 10:19:50 -080019 , fLastFlushedToken(0) {}
bsalomon75398562015-08-17 12:55:38 -070020
21void* GrBatchFlushState::makeVertexSpace(size_t vertexSize, int vertexCount,
cdalton397536c2016-03-25 12:15:03 -070022 const GrBuffer** buffer, int* startVertex) {
bsalomon75398562015-08-17 12:55:38 -070023 return fVertexPool.makeSpace(vertexSize, vertexCount, buffer, startVertex);
24}
25
26uint16_t* GrBatchFlushState::makeIndexSpace(int indexCount,
cdalton397536c2016-03-25 12:15:03 -070027 const GrBuffer** buffer, int* startIndex) {
bsalomon75398562015-08-17 12:55:38 -070028 return reinterpret_cast<uint16_t*>(fIndexPool.makeSpace(indexCount, buffer, startIndex));
29}