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 | |
Brian Salomon | 742e31d | 2016-12-07 17:06:19 -0500 | [diff] [blame] | 8 | #include "GrOpFlushState.h" |
bsalomon | 7539856 | 2015-08-17 12:55:38 -0700 | [diff] [blame] | 9 | |
Brian Salomon | 903da79 | 2016-12-16 14:24:46 -0500 | [diff] [blame] | 10 | #include "GrDrawOpAtlas.h" |
bsalomon | 7539856 | 2015-08-17 12:55:38 -0700 | [diff] [blame] | 11 | #include "GrPipeline.h" |
| 12 | |
Brian Salomon | 742e31d | 2016-12-07 17:06:19 -0500 | [diff] [blame] | 13 | GrOpFlushState::GrOpFlushState(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) |
egdaniel | 9cb6340 | 2016-06-23 08:37:05 -0700 | [diff] [blame] | 16 | , fCommandBuffer(nullptr) |
bsalomon | 7539856 | 2015-08-17 12:55:38 -0700 | [diff] [blame] | 17 | , fVertexPool(gpu) |
| 18 | , fIndexPool(gpu) |
Brian Salomon | 9afd371 | 2016-12-01 10:59:09 -0500 | [diff] [blame] | 19 | , fLastIssuedToken(GrDrawOpUploadToken::AlreadyFlushedToken()) |
robertphillips | 1f0e350 | 2015-11-10 10:19:50 -0800 | [diff] [blame] | 20 | , fLastFlushedToken(0) {} |
bsalomon | 7539856 | 2015-08-17 12:55:38 -0700 | [diff] [blame] | 21 | |
Brian Salomon | 742e31d | 2016-12-07 17:06:19 -0500 | [diff] [blame] | 22 | void* GrOpFlushState::makeVertexSpace(size_t vertexSize, int vertexCount, |
cdalton | 397536c | 2016-03-25 12:15:03 -0700 | [diff] [blame] | 23 | const GrBuffer** buffer, int* startVertex) { |
bsalomon | 7539856 | 2015-08-17 12:55:38 -0700 | [diff] [blame] | 24 | return fVertexPool.makeSpace(vertexSize, vertexCount, buffer, startVertex); |
| 25 | } |
| 26 | |
Brian Salomon | 742e31d | 2016-12-07 17:06:19 -0500 | [diff] [blame] | 27 | uint16_t* GrOpFlushState::makeIndexSpace(int indexCount, |
cdalton | 397536c | 2016-03-25 12:15:03 -0700 | [diff] [blame] | 28 | const GrBuffer** buffer, int* startIndex) { |
bsalomon | 7539856 | 2015-08-17 12:55:38 -0700 | [diff] [blame] | 29 | return reinterpret_cast<uint16_t*>(fIndexPool.makeSpace(indexCount, buffer, startIndex)); |
| 30 | } |