scratch memory improvements
This commit is contained in:
parent
09db50e3d4
commit
f6ab76ee2a
Binary file not shown.
|
@ -7,7 +7,7 @@ lumenarium_init()
|
|||
App_State* state = 0;
|
||||
|
||||
permanent = bump_allocator_create_reserve(GB(2));
|
||||
scratch_ = bump_allocator_create_reserve(GB(8));
|
||||
global_scratch_ = bump_allocator_create_reserve(GB(8));
|
||||
platform_file_jobs_init();
|
||||
|
||||
run_tests();
|
||||
|
@ -40,7 +40,7 @@ lumenarium_init()
|
|||
internal void
|
||||
lumenarium_frame_prepare(App_State* state)
|
||||
{
|
||||
allocator_clear(scratch_);
|
||||
allocator_clear(global_scratch_);
|
||||
|
||||
input_state_swap_frames(state->input_state);
|
||||
|
||||
|
|
|
@ -14,10 +14,8 @@ typedef struct App_State App_State;
|
|||
#include "lumenarium_hash.cpp"
|
||||
#include "lumenarium_geometry.h"
|
||||
|
||||
global Allocator* scratch_; // gets reset at frame boundaries
|
||||
|
||||
#define scratch_get(ident) Allocator_Scratch ident = Allocator_Scratch(scratch_)
|
||||
|
||||
global Allocator* global_scratch_; // gets reset at frame boundaries
|
||||
#define scratch_get(ident) Allocator_Scratch ident = Allocator_Scratch(global_scratch_)
|
||||
#include "lumenarium_bsp.h"
|
||||
|
||||
// Engine
|
||||
|
|
|
@ -94,6 +94,7 @@ struct Allocator_Bump
|
|||
u64 size_committed;
|
||||
u64 size_reserved;
|
||||
u64 page_size;
|
||||
u64 high_water_mark;
|
||||
};
|
||||
|
||||
internal u8*
|
||||
|
@ -152,7 +153,7 @@ bump_allocator_alloc_inner(Allocator* allocator, Allocator_Bump* bump, u64 size)
|
|||
|
||||
u8* result = bump->base + bump->at;
|
||||
bump->at = at_after;
|
||||
|
||||
bump->high_water_mark = max(bump->at, bump->high_water_mark);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -248,6 +249,7 @@ bump_allocator_create_child(Allocator* parent, u64 init_size)
|
|||
result->parent = parent;
|
||||
|
||||
Allocator_Bump* bump = (Allocator_Bump*)result->allocator_data;
|
||||
zero_struct(*bump);
|
||||
bump->base = allocator_alloc(result->parent, init_size);
|
||||
if (bump->base != 0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue