|
SBgl 0.1.0
A graphics framework in C99
|


Go to the source code of this file.
Data Structures | |
| struct | sbgl_ivec3 |
| 3D integer vector for chunk coordinates. More... | |
| struct | VoxelPool |
| VoxelPool manages a fixed number of slots for voxel chunks. It uses a flat array layout to maintain cache efficiency. More... | |
Functions | |
| VoxelPool * | VoxelPool_Init (SblArena *arena, uint32_t capacity) |
| Initializes a VoxelPool on the provided arena. | |
| int32_t | VoxelPool_AcquireSlot (VoxelPool *pool, sbgl_ivec3 pos, bool *is_new) |
| Acquires a slot for a given chunk position. Returns the slot index (0 to capacity-1). If the position is already in a slot, returns that index and sets is_new to false. If not, recycles the least recently used slot and sets is_new to true. | |
| void | VoxelPool_UpdateFrame (VoxelPool *pool, uint64_t frame) |
| Advances the pool's internal frame counter for LRU tracking. | |
| int32_t VoxelPool_AcquireSlot | ( | VoxelPool * | pool, |
| sbgl_ivec3 | pos, | ||
| bool * | is_new ) |
Acquires a slot for a given chunk position. Returns the slot index (0 to capacity-1). If the position is already in a slot, returns that index and sets is_new to false. If not, recycles the least recently used slot and sets is_new to true.
| pool | Pointer to the VoxelPool. |
| pos | The world coordinates of the chunk. |
| is_new | Output pointer to indicate if the slot was newly assigned/recycled. |
Definition at line 25 of file sbgl_pool.c.
Initializes a VoxelPool on the provided arena.
| arena | Pointer to the memory arena to allocate from. |
| capacity | Maximum number of slots in the pool. |
The VoxelPool uses a simple linear search for coordinate mapping. For small capacities (like 512 slots), this is extremely cache-friendly and avoids the complexity of a hash map.
Definition at line 10 of file sbgl_pool.c.
| void VoxelPool_UpdateFrame | ( | VoxelPool * | pool, |
| uint64_t | frame ) |
Advances the pool's internal frame counter for LRU tracking.
| pool | Pointer to the VoxelPool. |
| frame | The current frame index. |
Definition at line 78 of file sbgl_pool.c.