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 "GrOpFlushState.h"
9
10 #include "GrDrawOpAtlas.h"
11 #include "GrPipeline.h"
12
GrOpFlushState(GrGpu * gpu,GrResourceProvider * resourceProvider)13 GrOpFlushState::GrOpFlushState(GrGpu* gpu, GrResourceProvider* resourceProvider)
14 : fGpu(gpu)
15 , fResourceProvider(resourceProvider)
16 , fCommandBuffer(nullptr)
17 , fVertexPool(gpu)
18 , fIndexPool(gpu)
19 , fLastIssuedToken(GrDrawOpUploadToken::AlreadyFlushedToken())
20 , fLastFlushedToken(0)
21 , fOpArgs(nullptr) {}
22
makeVertexSpace(size_t vertexSize,int vertexCount,const GrBuffer ** buffer,int * startVertex)23 void* GrOpFlushState::makeVertexSpace(size_t vertexSize, int vertexCount,
24 const GrBuffer** buffer, int* startVertex) {
25 return fVertexPool.makeSpace(vertexSize, vertexCount, buffer, startVertex);
26 }
27
makeIndexSpace(int indexCount,const GrBuffer ** buffer,int * startIndex)28 uint16_t* GrOpFlushState::makeIndexSpace(int indexCount,
29 const GrBuffer** buffer, int* startIndex) {
30 return reinterpret_cast<uint16_t*>(fIndexPool.makeSpace(indexCount, buffer, startIndex));
31 }
32