bsalomon | 7539856 | 2015-08-17 12:55:38 -0700 | [diff] [blame] | 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 "GrBatchFlushState.h" |
| 9 | |
| 10 | #include "GrBatchAtlas.h" |
| 11 | #include "GrPipeline.h" |
| 12 | |
robertphillips | 1f0e350 | 2015-11-10 10:19:50 -0800 | [diff] [blame] | 13 | GrBatchFlushState::GrBatchFlushState(GrGpu* gpu, GrResourceProvider* resourceProvider) |
bsalomon | 7539856 | 2015-08-17 12:55:38 -0700 | [diff] [blame] | 14 | : fGpu(gpu) |
bsalomon | 7539856 | 2015-08-17 12:55:38 -0700 | [diff] [blame] | 15 | , fResourceProvider(resourceProvider) |
| 16 | , fVertexPool(gpu) |
| 17 | , fIndexPool(gpu) |
bsalomon | 342bfc2 | 2016-04-01 06:06:20 -0700 | [diff] [blame] | 18 | , fLastIssuedToken(GrBatchDrawToken::AlreadyFlushedToken()) |
robertphillips | 1f0e350 | 2015-11-10 10:19:50 -0800 | [diff] [blame] | 19 | , fLastFlushedToken(0) {} |
bsalomon | 7539856 | 2015-08-17 12:55:38 -0700 | [diff] [blame] | 20 | |
| 21 | void* GrBatchFlushState::makeVertexSpace(size_t vertexSize, int vertexCount, |
cdalton | 397536c | 2016-03-25 12:15:03 -0700 | [diff] [blame] | 22 | const GrBuffer** buffer, int* startVertex) { |
bsalomon | 7539856 | 2015-08-17 12:55:38 -0700 | [diff] [blame] | 23 | return fVertexPool.makeSpace(vertexSize, vertexCount, buffer, startVertex); |
| 24 | } |
| 25 | |
| 26 | uint16_t* GrBatchFlushState::makeIndexSpace(int indexCount, |
cdalton | 397536c | 2016-03-25 12:15:03 -0700 | [diff] [blame] | 27 | const GrBuffer** buffer, int* startIndex) { |
bsalomon | 7539856 | 2015-08-17 12:55:38 -0700 | [diff] [blame] | 28 | return reinterpret_cast<uint16_t*>(fIndexPool.makeSpace(indexCount, buffer, startIndex)); |
| 29 | } |