| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 | 7 |
| 9 | |
| 10 | |
| 11 #ifndef GrBufferAllocPool_DEFINED | 8 #ifndef GrBufferAllocPool_DEFINED |
| 12 #define GrBufferAllocPool_DEFINED | 9 #define GrBufferAllocPool_DEFINED |
| 13 | 10 |
| 14 #include "GrNoncopyable.h" | |
| 15 | |
| 16 #include "SkTArray.h" | 11 #include "SkTArray.h" |
| 17 #include "SkTDArray.h" | 12 #include "SkTDArray.h" |
| 13 #include "SkTypes.h" |
| 18 | 14 |
| 19 class GrGeometryBuffer; | 15 class GrGeometryBuffer; |
| 20 class GrGpu; | 16 class GrGpu; |
| 21 | 17 |
| 22 /** | 18 /** |
| 23 * A pool of geometry buffers tied to a GrGpu. | 19 * A pool of geometry buffers tied to a GrGpu. |
| 24 * | 20 * |
| 25 * The pool allows a client to make space for geometry and then put back excess | 21 * The pool allows a client to make space for geometry and then put back excess |
| 26 * space if it over allocated. When a client is ready to draw from the pool | 22 * space if it over allocated. When a client is ready to draw from the pool |
| 27 * it calls unlock on the pool ensure buffers are ready for drawing. The pool | 23 * it calls unlock on the pool ensure buffers are ready for drawing. The pool |
| 28 * can be reset after drawing is completed to recycle space. | 24 * can be reset after drawing is completed to recycle space. |
| 29 * | 25 * |
| 30 * At creation time a minimum per-buffer size can be specified. Additionally, | 26 * At creation time a minimum per-buffer size can be specified. Additionally, |
| 31 * a number of buffers to preallocate can be specified. These will | 27 * a number of buffers to preallocate can be specified. These will |
| 32 * be allocated at the min size and kept around until the pool is destroyed. | 28 * be allocated at the min size and kept around until the pool is destroyed. |
| 33 */ | 29 */ |
| 34 class GrBufferAllocPool : GrNoncopyable { | 30 class GrBufferAllocPool : public SkNoncopyable { |
| 35 | |
| 36 public: | 31 public: |
| 37 /** | 32 /** |
| 38 * Ensures all buffers are unlocked and have all data written to them. | 33 * Ensures all buffers are unlocked and have all data written to them. |
| 39 * Call before drawing using buffers from the pool. | 34 * Call before drawing using buffers from the pool. |
| 40 */ | 35 */ |
| 41 void unlock(); | 36 void unlock(); |
| 42 | 37 |
| 43 /** | 38 /** |
| 44 * Invalidates all the data in the pool, unrefs non-preallocated buffers. | 39 * Invalidates all the data in the pool, unrefs non-preallocated buffers. |
| 45 */ | 40 */ |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 * @return number of indices that fit in one of the preallocated index | 338 * @return number of indices that fit in one of the preallocated index |
| 344 * buffers. | 339 * buffers. |
| 345 */ | 340 */ |
| 346 int preallocatedBufferIndices() const; | 341 int preallocatedBufferIndices() const; |
| 347 | 342 |
| 348 private: | 343 private: |
| 349 typedef GrBufferAllocPool INHERITED; | 344 typedef GrBufferAllocPool INHERITED; |
| 350 }; | 345 }; |
| 351 | 346 |
| 352 #endif | 347 #endif |
| OLD | NEW |