mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 21:45:12 +00:00
Convert display lists to dynamic memory
This commit is contained in:
parent
57b06e3e09
commit
1e67809cd8
4 changed files with 17 additions and 14 deletions
|
@ -279,6 +279,7 @@ void rendering_init(void) {
|
||||||
gGfxSPTask = &gGfxPool->spTask;
|
gGfxSPTask = &gGfxPool->spTask;
|
||||||
gDisplayListHead = gGfxPool->buffer;
|
gDisplayListHead = gGfxPool->buffer;
|
||||||
gGfxPoolEnd = (u8 *) (gGfxPool->buffer + GFX_POOL_SIZE);
|
gGfxPoolEnd = (u8 *) (gGfxPool->buffer + GFX_POOL_SIZE);
|
||||||
|
alloc_display_list_reset();
|
||||||
init_render_image();
|
init_render_image();
|
||||||
clear_frame_buffer(0);
|
clear_frame_buffer(0);
|
||||||
end_master_display_list();
|
end_master_display_list();
|
||||||
|
@ -294,6 +295,7 @@ void config_gfx_pool(void) {
|
||||||
gGfxSPTask = &gGfxPool->spTask;
|
gGfxSPTask = &gGfxPool->spTask;
|
||||||
gDisplayListHead = gGfxPool->buffer;
|
gDisplayListHead = gGfxPool->buffer;
|
||||||
gGfxPoolEnd = (u8 *) (gGfxPool->buffer + GFX_POOL_SIZE);
|
gGfxPoolEnd = (u8 *) (gGfxPool->buffer + GFX_POOL_SIZE);
|
||||||
|
alloc_display_list_reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Handles vsync. */
|
/** Handles vsync. */
|
||||||
|
|
|
@ -391,17 +391,3 @@ s32 load_patchable_table(struct MarioAnimation *a, u32 index) {
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void *alloc_display_list(u32 size) {
|
|
||||||
void *ptr = NULL;
|
|
||||||
|
|
||||||
size = ALIGN8(size);
|
|
||||||
if (gGfxPoolEnd - size >= (u8 *) gDisplayListHead) {
|
|
||||||
gGfxPoolEnd -= size;
|
|
||||||
ptr = gGfxPoolEnd;
|
|
||||||
} else {
|
|
||||||
LOG_ERROR("Failed to alloc display list!");
|
|
||||||
}
|
|
||||||
return ptr;
|
|
||||||
}
|
|
|
@ -80,6 +80,7 @@ struct MemoryPool *mem_pool_init(u32 size, u32 side);
|
||||||
void *mem_pool_alloc(struct MemoryPool *pool, u32 size);
|
void *mem_pool_alloc(struct MemoryPool *pool, u32 size);
|
||||||
void mem_pool_free(struct MemoryPool *pool, void *addr);
|
void mem_pool_free(struct MemoryPool *pool, void *addr);
|
||||||
|
|
||||||
|
void alloc_display_list_reset(void);
|
||||||
void *alloc_display_list(u32 size);
|
void *alloc_display_list(u32 size);
|
||||||
|
|
||||||
void func_80278A78(struct MarioAnimation *a, void *b, struct Animation *target);
|
void func_80278A78(struct MarioAnimation *a, void *b, struct Animation *target);
|
||||||
|
|
|
@ -122,3 +122,17 @@ void growing_pool_free_pool(struct GrowingPool *pool) {
|
||||||
}
|
}
|
||||||
free(pool);
|
free(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////
|
||||||
|
// display lists //
|
||||||
|
///////////////////
|
||||||
|
|
||||||
|
static struct GrowingPool* sDisplayListPool = NULL;
|
||||||
|
|
||||||
|
void alloc_display_list_reset(void) {
|
||||||
|
sDisplayListPool = growing_pool_init(sDisplayListPool, 100000);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *alloc_display_list(u32 size) {
|
||||||
|
return growing_pool_alloc(sDisplayListPool, size);
|
||||||
|
}
|
Loading…
Reference in a new issue