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 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 const GrDrawTargetCaps& caps() const { return *fGpu->caps(); } | 113 const GrDrawTargetCaps& caps() const { return *fGpu->caps(); } |
114 | 114 |
115 GrResourceProvider* resourceProvider() const { return fGpu->getContext()->re
sourceProvider(); } | 115 GrResourceProvider* resourceProvider() const { return fGpu->getContext()->re
sourceProvider(); } |
116 | 116 |
117 void* makeVertSpace(size_t vertexSize, int vertexCount, | 117 void* makeVertSpace(size_t vertexSize, int vertexCount, |
118 const GrVertexBuffer** buffer, int* startVertex); | 118 const GrVertexBuffer** buffer, int* startVertex); |
119 uint16_t* makeIndexSpace(int indexCount, | 119 uint16_t* makeIndexSpace(int indexCount, |
120 const GrIndexBuffer** buffer, int* startIndex); | 120 const GrIndexBuffer** buffer, int* startIndex); |
121 | 121 |
122 // A helper for draws which overallocate and then return data to the pool | 122 // A helper for draws which overallocate and then return data to the pool |
123 void putBackIndices(size_t indices) { fIndexPool.putBack(indices * sizeof(ui
nt16_t)); } | 123 void putBackIndices(size_t indices) { fIndexPool->putBack(indices * sizeof(u
int16_t)); } |
124 | 124 |
125 void putBackVertices(size_t vertices, size_t vertexStride) { | 125 void putBackVertices(size_t vertices, size_t vertexStride) { |
126 fVertexPool.putBack(vertices * vertexStride); | 126 fVertexPool->putBack(vertices * vertexStride); |
127 } | 127 } |
128 | 128 |
129 void reset() { | 129 void reset() { |
130 fVertexPool.reset(); | 130 fVertexPool->reset(); |
131 fIndexPool.reset(); | 131 fIndexPool->reset(); |
132 } | 132 } |
133 | 133 |
134 private: | 134 private: |
135 void unmapVertexAndIndexBuffers() { | 135 void unmapVertexAndIndexBuffers() { |
136 fVertexPool.unmap(); | 136 fVertexPool->unmap(); |
137 fIndexPool.unmap(); | 137 fIndexPool->unmap(); |
138 } | 138 } |
139 | 139 |
140 GrGpu* fGpu; | 140 GrGpu* fGpu; |
141 GrVertexBufferAllocPool fVertexPool; | 141 SkAutoTDelete<GrVertexBufferAllocPool> fVertexPool; |
142 GrIndexBufferAllocPool fIndexPool; | 142 SkAutoTDelete<GrIndexBufferAllocPool> fIndexPool; |
143 | 143 |
144 typedef void* TBufferAlign; // This wouldn't be enough align if a command us
ed long double. | 144 typedef void* TBufferAlign; // This wouldn't be enough align if a command us
ed long double. |
145 | 145 |
146 struct BufferedFlush { | 146 struct BufferedFlush { |
147 BufferedFlush(const GrPrimitiveProcessor* primProc, const GrPipeline* pi
peline) | 147 BufferedFlush(const GrPrimitiveProcessor* primProc, const GrPipeline* pi
peline) |
148 : fPrimitiveProcessor(primProc) | 148 : fPrimitiveProcessor(primProc) |
149 , fPipeline(pipeline) {} | 149 , fPipeline(pipeline) {} |
150 typedef GrPendingProgramElement<const GrPrimitiveProcessor> ProgramPrimi
tiveProcessor; | 150 typedef GrPendingProgramElement<const GrPrimitiveProcessor> ProgramPrimi
tiveProcessor; |
151 ProgramPrimitiveProcessor fPrimitiveProcessor; | 151 ProgramPrimitiveProcessor fPrimitiveProcessor; |
152 const GrPipeline* fPipeline; | 152 const GrPipeline* fPipeline; |
(...skipping 12 matching lines...) Expand all Loading... |
165 FlushBuffer::Iter fIter; | 165 FlushBuffer::Iter fIter; |
166 int fNumberOfDraws; | 166 int fNumberOfDraws; |
167 BatchToken fCurrentToken; | 167 BatchToken fCurrentToken; |
168 BatchToken fLastFlushedToken; // The next token to be flushed | 168 BatchToken fLastFlushedToken; // The next token to be flushed |
169 SkTArray<SkAutoTUnref<Uploader>, true> fAsapUploads; | 169 SkTArray<SkAutoTUnref<Uploader>, true> fAsapUploads; |
170 SkTArray<SkAutoTUnref<Uploader>, true> fInlineUploads; | 170 SkTArray<SkAutoTUnref<Uploader>, true> fInlineUploads; |
171 int fInlineUpdatesIndex; | 171 int fInlineUpdatesIndex; |
172 }; | 172 }; |
173 | 173 |
174 #endif | 174 #endif |
OLD | NEW |