| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 GrBufferAllocPool_DEFINED | 8 #ifndef GrBufferAllocPool_DEFINED |
| 9 #define GrBufferAllocPool_DEFINED | 9 #define GrBufferAllocPool_DEFINED |
| 10 | 10 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 * @param startVertex returns the offset into buffer of the first vertex. | 224 * @param startVertex returns the offset into buffer of the first vertex. |
| 225 * In units of the size of a vertex from layout param. | 225 * In units of the size of a vertex from layout param. |
| 226 * @return pointer to first vertex. | 226 * @return pointer to first vertex. |
| 227 */ | 227 */ |
| 228 void* makeSpace(size_t vertexSize, | 228 void* makeSpace(size_t vertexSize, |
| 229 int vertexCount, | 229 int vertexCount, |
| 230 const GrVertexBuffer** buffer, | 230 const GrVertexBuffer** buffer, |
| 231 int* startVertex); | 231 int* startVertex); |
| 232 | 232 |
| 233 /** | 233 /** |
| 234 * Shortcut to make space and then write verts into the made space. | |
| 235 */ | |
| 236 bool appendVertices(size_t vertexSize, | |
| 237 int vertexCount, | |
| 238 const void* vertices, | |
| 239 const GrVertexBuffer** buffer, | |
| 240 int* startVertex); | |
| 241 | |
| 242 /** | |
| 243 * Gets the number of vertices that can be added to the current VB without | 234 * Gets the number of vertices that can be added to the current VB without |
| 244 * spilling to another VB. If the pool has been reset, or the previous | 235 * spilling to another VB. If the pool has been reset, or the previous |
| 245 * makeSpace completely exhausted a VB then the returned number of vertices | 236 * makeSpace completely exhausted a VB then the returned number of vertices |
| 246 * would fit in the next available preallocated buffer. If any makeSpace | 237 * would fit in the next available preallocated buffer. If any makeSpace |
| 247 * would force a new VB to be created the return value will be zero. | 238 * would force a new VB to be created the return value will be zero. |
| 248 * | 239 * |
| 249 * @param the size of a vertex to compute space for. | 240 * @param the size of a vertex to compute space for. |
| 250 * @return the number of vertices that would fit in the current buffer. | 241 * @return the number of vertices that would fit in the current buffer. |
| 251 */ | 242 */ |
| 252 int currentBufferVertices(size_t vertexSize) const; | 243 int currentBufferVertices(size_t vertexSize) const; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 * @param indexCount number of indices to allocate space for | 299 * @param indexCount number of indices to allocate space for |
| 309 * @param buffer returns the index buffer that will hold the indices. | 300 * @param buffer returns the index buffer that will hold the indices. |
| 310 * @param startIndex returns the offset into buffer of the first index. | 301 * @param startIndex returns the offset into buffer of the first index. |
| 311 * @return pointer to first index. | 302 * @return pointer to first index. |
| 312 */ | 303 */ |
| 313 void* makeSpace(int indexCount, | 304 void* makeSpace(int indexCount, |
| 314 const GrIndexBuffer** buffer, | 305 const GrIndexBuffer** buffer, |
| 315 int* startIndex); | 306 int* startIndex); |
| 316 | 307 |
| 317 /** | 308 /** |
| 318 * Shortcut to make space and then write indices into the made space. | |
| 319 */ | |
| 320 bool appendIndices(int indexCount, | |
| 321 const void* indices, | |
| 322 const GrIndexBuffer** buffer, | |
| 323 int* startIndex); | |
| 324 | |
| 325 /** | |
| 326 * Gets the number of indices that can be added to the current IB without | 309 * Gets the number of indices that can be added to the current IB without |
| 327 * spilling to another IB. If the pool has been reset, or the previous | 310 * spilling to another IB. If the pool has been reset, or the previous |
| 328 * makeSpace completely exhausted a IB then the returned number of indices | 311 * makeSpace completely exhausted a IB then the returned number of indices |
| 329 * would fit in the next available preallocated buffer. If any makeSpace | 312 * would fit in the next available preallocated buffer. If any makeSpace |
| 330 * would force a new IB to be created the return value will be zero. | 313 * would force a new IB to be created the return value will be zero. |
| 331 */ | 314 */ |
| 332 int currentBufferIndices() const; | 315 int currentBufferIndices() const; |
| 333 | 316 |
| 334 /** | 317 /** |
| 335 * Gets the number of indices that can fit in a preallocated index buffer. | 318 * Gets the number of indices that can fit in a preallocated index buffer. |
| 336 * Zero if no preallocated buffers. | 319 * Zero if no preallocated buffers. |
| 337 * | 320 * |
| 338 * @return number of indices that fit in one of the preallocated index | 321 * @return number of indices that fit in one of the preallocated index |
| 339 * buffers. | 322 * buffers. |
| 340 */ | 323 */ |
| 341 int preallocatedBufferIndices() const; | 324 int preallocatedBufferIndices() const; |
| 342 | 325 |
| 343 private: | 326 private: |
| 344 typedef GrBufferAllocPool INHERITED; | 327 typedef GrBufferAllocPool INHERITED; |
| 345 }; | 328 }; |
| 346 | 329 |
| 347 #endif | 330 #endif |
| OLD | NEW |