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 |
11 #include "SkTArray.h" | 11 #include "SkTArray.h" |
12 #include "SkTDArray.h" | 12 #include "SkTDArray.h" |
13 #include "SkTypes.h" | 13 #include "SkTypes.h" |
14 | 14 |
15 class GrGeometryBuffer; | 15 class GrGeometryBuffer; |
16 class GrGpu; | 16 class GrGpu; |
17 | 17 |
18 /** | 18 /** |
19 * A pool of geometry buffers tied to a GrGpu. | 19 * A pool of geometry buffers tied to a GrGpu. |
20 * | 20 * |
21 * 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 |
22 * 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 |
23 * 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 |
24 * can be reset after drawing is completed to recycle space. | 24 * can be reset after drawing is completed to recycle space. |
25 * | 25 * |
26 * 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, |
27 * a number of buffers to preallocate can be specified. These will | 27 * a number of buffers to preallocate can be specified. These will |
28 * 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. |
29 */ | 29 */ |
30 class GrBufferAllocPool : public SkNoncopyable { | 30 class GrBufferAllocPool : SkNoncopyable { |
31 public: | 31 public: |
32 /** | 32 /** |
33 * 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. |
34 * Call before drawing using buffers from the pool. | 34 * Call before drawing using buffers from the pool. |
35 */ | 35 */ |
36 void unlock(); | 36 void unlock(); |
37 | 37 |
38 /** | 38 /** |
39 * Invalidates all the data in the pool, unrefs non-preallocated buffers. | 39 * Invalidates all the data in the pool, unrefs non-preallocated buffers. |
40 */ | 40 */ |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 * @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 |
339 * buffers. | 339 * buffers. |
340 */ | 340 */ |
341 int preallocatedBufferIndices() const; | 341 int preallocatedBufferIndices() const; |
342 | 342 |
343 private: | 343 private: |
344 typedef GrBufferAllocPool INHERITED; | 344 typedef GrBufferAllocPool INHERITED; |
345 }; | 345 }; |
346 | 346 |
347 #endif | 347 #endif |
OLD | NEW |