Trying to reduce memory usage
This commit is contained in:
parent
a49fa26a43
commit
18bef60ba1
|
@ -801,7 +801,10 @@ AnimationSystem_FadeToPlaylist(animation_system* System, animation_handle_array
|
||||||
System->Playlist = Playlist;
|
System->Playlist = Playlist;
|
||||||
System->PlaylistAt = 0;
|
System->PlaylistAt = 0;
|
||||||
|
|
||||||
|
if (System->Playlist.Count > 0)
|
||||||
|
{
|
||||||
AnimationFadeGroup_FadeTo(&System->ActiveFadeGroup, Playlist.Handles[0], System->PlaylistFadeTime);
|
AnimationFadeGroup_FadeTo(&System->ActiveFadeGroup, Playlist.Handles[0], System->PlaylistFadeTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
|
|
|
@ -30,11 +30,13 @@ RELOAD_STATIC_DATA(ReloadStaticData)
|
||||||
|
|
||||||
INITIALIZE_APPLICATION(InitializeApplication)
|
INITIALIZE_APPLICATION(InitializeApplication)
|
||||||
{
|
{
|
||||||
app_state* State = (app_state*)Context.MemoryBase;
|
Context->MemorySize = sizeof(app_state);
|
||||||
|
Context->MemoryBase = AllocatorAlloc(Context->ThreadContext.Allocator, Context->MemorySize).Memory;
|
||||||
|
app_state* State = (app_state*)Context->MemoryBase;
|
||||||
*State = {};
|
*State = {};
|
||||||
|
|
||||||
State->Permanent = CreateMemoryArena(Context.ThreadContext.Allocator, "Permanent");
|
State->Permanent = CreateMemoryArena(Context->ThreadContext.Allocator, "Permanent");
|
||||||
State->Transient = Context.ThreadContext.Transient;
|
State->Transient = Context->ThreadContext.Transient;
|
||||||
State->Assemblies = AssemblyArray_Create(8, &State->Permanent);
|
State->Assemblies = AssemblyArray_Create(8, &State->Permanent);
|
||||||
|
|
||||||
State->GlobalLog = PushStruct(&State->Permanent, event_log);
|
State->GlobalLog = PushStruct(&State->Permanent, event_log);
|
||||||
|
@ -47,7 +49,7 @@ INITIALIZE_APPLICATION(InitializeApplication)
|
||||||
AnimSysDesc.SecondsPerFrame = 1.0f / 24.0f;
|
AnimSysDesc.SecondsPerFrame = 1.0f / 24.0f;
|
||||||
State->AnimationSystem = AnimationSystem_Init(AnimSysDesc);
|
State->AnimationSystem = AnimationSystem_Init(AnimSysDesc);
|
||||||
|
|
||||||
if (!Context.Headless)
|
if (!Context->Headless)
|
||||||
{
|
{
|
||||||
interface_config IConfig = {0};
|
interface_config IConfig = {0};
|
||||||
IConfig.FontSize = 14;
|
IConfig.FontSize = 14;
|
||||||
|
@ -61,50 +63,50 @@ INITIALIZE_APPLICATION(InitializeApplication)
|
||||||
IConfig.ListBGHover = v4{ .22f, .22f, .22f, 1.f };
|
IConfig.ListBGHover = v4{ .22f, .22f, .22f, 1.f };
|
||||||
IConfig.ListBGSelected = v4{ .44f, .44f, .44f, 1.f };
|
IConfig.ListBGSelected = v4{ .44f, .44f, .44f, 1.f };
|
||||||
IConfig.Margin = v2{5, 5};
|
IConfig.Margin = v2{5, 5};
|
||||||
State->Interface = ui_InterfaceCreate(Context, IConfig, &State->Permanent);
|
State->Interface = ui_InterfaceCreate(*Context, IConfig, &State->Permanent);
|
||||||
|
|
||||||
PanelSystem_Init(&State->PanelSystem, GlobalPanelDefs, GlobalPanelDefsCount, &State->Permanent);
|
PanelSystem_Init(&State->PanelSystem, GlobalPanelDefs, GlobalPanelDefsCount, &State->Permanent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
State->SACN = SACN_Initialize(Context);
|
State->SACN = SACN_Initialize(*Context);
|
||||||
|
|
||||||
State->LedSystem = LedSystem_Create(Context.ThreadContext.Allocator, 128);
|
State->LedSystem = LedSystem_Create(Context->ThreadContext.Allocator, 128);
|
||||||
State->AssemblyDebugState = AssemblyDebug_Create(&State->Permanent);
|
State->AssemblyDebugState = AssemblyDebug_Create(&State->Permanent);
|
||||||
State->AssemblyDebugState.Brightness = 255;
|
State->AssemblyDebugState.Brightness = 255;
|
||||||
State->AssemblyDebugState.Override = ADS_Override_None;
|
State->AssemblyDebugState.Override = ADS_Override_None;
|
||||||
|
|
||||||
State->Modes = OperationModeSystemInit(&State->Permanent, Context.ThreadContext);
|
State->Modes = OperationModeSystemInit(&State->Permanent, Context->ThreadContext);
|
||||||
|
|
||||||
ReloadStaticData(Context, GlobalDebugServices, true);
|
ReloadStaticData(*Context, GlobalDebugServices, true);
|
||||||
US_CustomInit(&State->UserSpaceDesc, State, Context);
|
US_CustomInit(&State->UserSpaceDesc, State, *Context);
|
||||||
|
|
||||||
GlobalDebugServices->Interface.RenderSculpture = true;
|
GlobalDebugServices->Interface.RenderSculpture = true;
|
||||||
|
|
||||||
if (!Context.Headless)
|
if (!Context->Headless)
|
||||||
{
|
{
|
||||||
// NOTE(pjs): This just sets up the default panel layout
|
// NOTE(pjs): This just sets up the default panel layout
|
||||||
panel* RootPanel = PanelSystem_PushPanel(&State->PanelSystem, PanelType_SculptureView, State, Context);
|
panel* RootPanel = PanelSystem_PushPanel(&State->PanelSystem, PanelType_SculptureView, State, *Context);
|
||||||
SplitPanel(RootPanel, .25f, PanelSplit_Horizontal, &State->PanelSystem, State, Context);
|
SplitPanel(RootPanel, .25f, PanelSplit_Horizontal, &State->PanelSystem, State, *Context);
|
||||||
|
|
||||||
panel* AnimPanel = RootPanel->Bottom;
|
panel* AnimPanel = RootPanel->Bottom;
|
||||||
Panel_SetType(AnimPanel, &State->PanelSystem, PanelType_AnimationTimeline, State, Context);
|
Panel_SetType(AnimPanel, &State->PanelSystem, PanelType_AnimationTimeline, State, *Context);
|
||||||
|
|
||||||
panel* TopPanel = RootPanel->Top;
|
panel* TopPanel = RootPanel->Top;
|
||||||
SplitPanel(TopPanel, .5f, PanelSplit_Vertical, &State->PanelSystem, State, Context);
|
SplitPanel(TopPanel, .5f, PanelSplit_Vertical, &State->PanelSystem, State, *Context);
|
||||||
|
|
||||||
panel* LeftPanel = TopPanel->Left;
|
panel* LeftPanel = TopPanel->Left;
|
||||||
SplitPanel(LeftPanel, .5f, PanelSplit_Vertical, &State->PanelSystem, State, Context);
|
SplitPanel(LeftPanel, .5f, PanelSplit_Vertical, &State->PanelSystem, State, *Context);
|
||||||
|
|
||||||
panel* Profiler = LeftPanel->Right;
|
panel* Profiler = LeftPanel->Right;
|
||||||
Panel_SetType(Profiler, &State->PanelSystem, PanelType_ProfilerView, State, Context);
|
Panel_SetType(Profiler, &State->PanelSystem, PanelType_ProfilerView, State, *Context);
|
||||||
|
|
||||||
panel* Hierarchy = LeftPanel->Left;
|
panel* Hierarchy = LeftPanel->Left;
|
||||||
Panel_SetType(Hierarchy, &State->PanelSystem, PanelType_AssemblyDebug, State, Context);
|
Panel_SetType(Hierarchy, &State->PanelSystem, PanelType_AssemblyDebug, State, *Context);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
State->RunEditor = !Context.Headless;
|
State->RunEditor = !Context->Headless;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
|
|
|
@ -68,7 +68,7 @@ struct packet_ringbuffer
|
||||||
u32 WriteHead;
|
u32 WriteHead;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define INITIALIZE_APPLICATION(name) void name(context Context)
|
#define INITIALIZE_APPLICATION(name) void name(context* Context)
|
||||||
typedef INITIALIZE_APPLICATION(initialize_application);
|
typedef INITIALIZE_APPLICATION(initialize_application);
|
||||||
|
|
||||||
#define UPDATE_AND_RENDER(name) void name(context* Context, input_queue InputQueue, render_command_buffer* RenderBuffer, addressed_data_buffer_list* OutputData)
|
#define UPDATE_AND_RENDER(name) void name(context* Context, input_queue InputQueue, render_command_buffer* RenderBuffer, addressed_data_buffer_list* OutputData)
|
||||||
|
|
|
@ -612,8 +612,6 @@ WinMain (
|
||||||
|
|
||||||
context Context = {};
|
context Context = {};
|
||||||
Context.ThreadContext = ThreadContext;
|
Context.ThreadContext = ThreadContext;
|
||||||
Context.MemorySize = MB(64);
|
|
||||||
Context.MemoryBase = (u8*)Win32Alloc(Context.MemorySize, 0);
|
|
||||||
|
|
||||||
gs_const_string Args = ConstString((char*)CmdLineArgs);
|
gs_const_string Args = ConstString((char*)CmdLineArgs);
|
||||||
if (StringsEqual(Args, ConstString("-headless")))
|
if (StringsEqual(Args, ConstString("-headless")))
|
||||||
|
@ -680,7 +678,7 @@ WinMain (
|
||||||
|
|
||||||
addressed_data_buffer_list OutputData = AddressedDataBufferList_Create(ThreadContext);
|
addressed_data_buffer_list OutputData = AddressedDataBufferList_Create(ThreadContext);
|
||||||
|
|
||||||
Context.InitializeApplication(Context);
|
Context.InitializeApplication(&Context);
|
||||||
|
|
||||||
system_time StartTime = Win32GetSystemTime();
|
system_time StartTime = Win32GetSystemTime();
|
||||||
|
|
||||||
|
|
|
@ -2607,7 +2607,7 @@ CreateMemoryArena_(arena_type ArenaType, gs_allocator Allocator, u64 ChunkSize,
|
||||||
}
|
}
|
||||||
|
|
||||||
internal gs_memory_arena
|
internal gs_memory_arena
|
||||||
CreateMemoryArena(gs_allocator Allocator, char* Name, u64 ChunkSize = KB(32), u64 Alignment = Bytes(8))
|
CreateMemoryArena(gs_allocator Allocator, char* Name, u64 ChunkSize = KB(4), u64 Alignment = Bytes(8))
|
||||||
{
|
{
|
||||||
return CreateMemoryArena_(Arena_BaseArena, Allocator, ChunkSize, Alignment, 0, Name);
|
return CreateMemoryArena_(Arena_BaseArena, Allocator, ChunkSize, Alignment, 0, Name);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue