diff options
Diffstat (limited to 'source/blender/blenlib/BLI_mempool.h')
-rw-r--r-- | source/blender/blenlib/BLI_mempool.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h index 61b572a4943..4093b9b5fe0 100644 --- a/source/blender/blenlib/BLI_mempool.h +++ b/source/blender/blenlib/BLI_mempool.h @@ -87,11 +87,35 @@ enum { * order of allocation when no chunks have been freed. */ BLI_MEMPOOL_ALLOW_ITER = (1 << 0), + + /* allow random access, implies BLI_MEMPOOL_ALLOW_ITER since we + need the freewords to detect free state of elements*/ + BLI_MEMPOOL_RANDOM_ACCESS = (1 << 1) | (1 << 0) }; void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter) ATTR_NONNULL(); void *BLI_mempool_iterstep(BLI_mempool_iter *iter) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +/* +This preallocates a mempool suitable for threading. totelem elements are preallocated +in chunks of size pchunk, and returned in r_chunks. +*/ + +BLI_mempool *BLI_mempool_create_for_tasks(const unsigned int esize, + int totelem, + const int pchunk, + void ***r_chunks, + int *r_totchunk, + int *r_esize, + int flag); + +// memory coherence stuff +int BLI_mempool_find_elems_fuzzy( + BLI_mempool *pool, int idx, int range, void **r_elems, int r_elems_size); + +int BLI_mempool_get_size(BLI_mempool *pool); +int BLI_mempool_find_real_index(BLI_mempool *pool, void *ptr); + #ifdef __cplusplus } #endif |