| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrBatchBuffer_DEFINED | 8 #ifndef GrBatchBuffer_DEFINED |
| 9 #define GrBatchBuffer_DEFINED | 9 #define GrBatchBuffer_DEFINED |
| 10 | 10 |
| 11 #include "GrBufferAllocPool.h" | 11 #include "GrBufferAllocPool.h" |
| 12 #include "batches/GrVertexBatch.h" | 12 #include "batches/GrVertexBatch.h" |
| 13 | 13 |
| 14 class GrGpuCommandBuffer; |
| 14 class GrResourceProvider; | 15 class GrResourceProvider; |
| 15 | 16 |
| 16 /** Tracks the state across all the GrBatches in a GrDrawTarget flush. */ | 17 /** Tracks the state across all the GrBatches in a GrDrawTarget flush. */ |
| 17 class GrBatchFlushState { | 18 class GrBatchFlushState { |
| 18 public: | 19 public: |
| 19 GrBatchFlushState(GrGpu*, GrResourceProvider*); | 20 GrBatchFlushState(GrGpu*, GrResourceProvider*); |
| 20 | 21 |
| 21 ~GrBatchFlushState() { this->reset(); } | 22 ~GrBatchFlushState() { this->reset(); } |
| 22 | 23 |
| 23 /** Inserts an upload to be executed after all batches in the flush prepared
their draws | 24 /** Inserts an upload to be executed after all batches in the flush prepared
their draws |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 return this->fGpu->writePixels(surface, left, top, width, height, co
nfig, buffer, | 78 return this->fGpu->writePixels(surface, left, top, width, height, co
nfig, buffer, |
| 78 rowBytes); | 79 rowBytes); |
| 79 }; | 80 }; |
| 80 upload(wp); | 81 upload(wp); |
| 81 } | 82 } |
| 82 | 83 |
| 83 void putBackIndices(size_t indices) { fIndexPool.putBack(indices * sizeof(ui
nt16_t)); } | 84 void putBackIndices(size_t indices) { fIndexPool.putBack(indices * sizeof(ui
nt16_t)); } |
| 84 | 85 |
| 85 void putBackVertexSpace(size_t sizeInBytes) { fVertexPool.putBack(sizeInByte
s); } | 86 void putBackVertexSpace(size_t sizeInBytes) { fVertexPool.putBack(sizeInByte
s); } |
| 86 | 87 |
| 88 GrGpuCommandBuffer* commandBuffer() { return fCommandBuffer; } |
| 89 void setCommandBuffer(GrGpuCommandBuffer* buffer) { fCommandBuffer = buffer;
} |
| 90 |
| 87 GrGpu* gpu() { return fGpu; } | 91 GrGpu* gpu() { return fGpu; } |
| 88 | 92 |
| 89 void reset() { | 93 void reset() { |
| 90 fVertexPool.reset(); | 94 fVertexPool.reset(); |
| 91 fIndexPool.reset(); | 95 fIndexPool.reset(); |
| 92 } | 96 } |
| 93 | 97 |
| 94 private: | 98 private: |
| 95 | 99 |
| 96 GrGpu* fGpu; | 100 GrGpu* fGpu; |
| 97 | 101 |
| 98 GrResourceProvider* fResourceProvider; | 102 GrResourceProvider* fResourceProvider; |
| 99 | 103 |
| 104 GrGpuCommandBuffer* fCommandBuffer; |
| 105 |
| 100 GrVertexBufferAllocPool fVertexPool; | 106 GrVertexBufferAllocPool fVertexPool; |
| 101 GrIndexBufferAllocPool fIndexPool; | 107 GrIndexBufferAllocPool fIndexPool; |
| 102 | 108 |
| 103 SkSTArray<4, GrDrawBatch::DeferredUploadFn> fAsapUploads; | 109 SkSTArray<4, GrDrawBatch::DeferredUploadFn> fAsapUploads; |
| 104 | 110 |
| 105 GrBatchDrawToken fLastIssuedToken; | 111 GrBatchDrawToken fLastIssuedToken; |
| 106 | 112 |
| 107 GrBatchDrawToken fLastFlushedToken; | 113 GrBatchDrawToken fLastFlushedToken; |
| 108 }; | 114 }; |
| 109 | 115 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 void putBackVertices(int vertices, size_t vertexStride) { | 201 void putBackVertices(int vertices, size_t vertexStride) { |
| 196 this->state()->putBackVertexSpace(vertices * vertexStride); | 202 this->state()->putBackVertexSpace(vertices * vertexStride); |
| 197 } | 203 } |
| 198 | 204 |
| 199 private: | 205 private: |
| 200 GrVertexBatch* vertexBatch() { return static_cast<GrVertexBatch*>(this->batc
h()); } | 206 GrVertexBatch* vertexBatch() { return static_cast<GrVertexBatch*>(this->batc
h()); } |
| 201 typedef GrDrawBatch::Target INHERITED; | 207 typedef GrDrawBatch::Target INHERITED; |
| 202 }; | 208 }; |
| 203 | 209 |
| 204 #endif | 210 #endif |
| OLD | NEW |