Sanity check collisions, and increase efficiency of growingpool
This commit is contained in:
parent
2dfc081469
commit
628353988e
|
@ -764,6 +764,10 @@ void load_object_collision_model(void) {
|
|||
LOG_ERROR("Object collisions had invalid vertex count");
|
||||
return;
|
||||
}
|
||||
if (numVertices >= 4096) {
|
||||
LOG_ERROR("Object collisions had too many vertices");
|
||||
return;
|
||||
}
|
||||
|
||||
static s32 sVertexDataCount = 0;
|
||||
static s16* sVertexData = NULL;
|
||||
|
|
|
@ -135,13 +135,19 @@ void* growing_pool_alloc(struct GrowingPool *pool, u32 size) {
|
|||
}
|
||||
|
||||
// search for space in nodes
|
||||
struct GrowingPoolNode* node = pool->tail;
|
||||
u32 depth = 0;
|
||||
while (node) {
|
||||
depth++;
|
||||
s64 freeSpace = (s64)pool->nodeSize - (s64)node->usedSpace;
|
||||
if (freeSpace > size) { break; }
|
||||
node = node->prev;
|
||||
struct GrowingPoolNode* node = NULL;
|
||||
if (size < pool->nodeSize) {
|
||||
node = pool->tail;
|
||||
u32 depth = 0;
|
||||
while (node && depth < 128) {
|
||||
depth++;
|
||||
s64 freeSpace = (s64)pool->nodeSize - (s64)node->usedSpace;
|
||||
if (freeSpace > size) { break; }
|
||||
node = node->prev;
|
||||
}
|
||||
if (depth >= 128) {
|
||||
node = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// allocate new node
|
||||
|
|
Loading…
Reference in New Issue