Fixing some VectorArena to use external arena and reduce the number of alloc.

Made the passing of name to arena more flexible
This commit is contained in:
2026-02-14 22:28:32 -05:00
parent 36ee786128
commit 38f8662d80
7 changed files with 41 additions and 27 deletions

View File

@@ -198,8 +198,8 @@ void JulietApplication::Init()
if ((Running = GameCode.IsValid))
{
GameInitParams params;
params.GameArena = ArenaAllocate({} JULIET_DEBUG_ONLY(, "Game Arena"));
params.ScratchArena = ArenaAllocate({} JULIET_DEBUG_ONLY(, "Scratch Arena"));
params.GameArena = GameArena = ArenaAllocate({} JULIET_DEBUG_ONLY(, "Game Arena"));
params.ScratchArena = GameScratchArena = ArenaAllocate({} JULIET_DEBUG_ONLY(, "Scratch Arena"));
Game.Init(&params);
}
}
@@ -356,6 +356,8 @@ void JulietApplication::Update()
Debug::DebugDrawMemoryArena();
#endif
}
ArenaClear(GameScratchArena);
}
void JulietApplication::OnPreRender(CommandList* cmd)

View File

@@ -26,11 +26,11 @@ class JulietApplication : public Juliet::IApplication
Juliet::GraphicsDevice* GetGraphicsDevice() override { return GraphicsDevice; }
// Render Lifecycle
void OnPreRender(Juliet::CommandList* cmd) override;
void OnRender(Juliet::RenderPass* pass, Juliet::CommandList* cmd) override;
Juliet::ColorTargetInfo GetColorTargetInfo(Juliet::Texture* swapchainTexture) override;
Juliet::DepthStencilTargetInfo* GetDepthTargetInfo() override;
Juliet::Camera GetDebugCamera() override;
void OnPreRender(Juliet::CommandList* cmd) override;
void OnRender(Juliet::RenderPass* pass, Juliet::CommandList* cmd) override;
Juliet::ColorTargetInfo GetColorTargetInfo(Juliet::Texture* swapchainTexture) override;
Juliet::DepthStencilTargetInfo* GetDepthTargetInfo() override;
Juliet::Camera GetDebugCamera() override;
public:
void SetAutoCloseFrameCount(int count) { AutoCloseFrameCount = count; }
@@ -45,7 +45,10 @@ class JulietApplication : public Juliet::IApplication
Juliet::GraphicsTransferBuffer* TransferBuffer = {};
Juliet::Texture* DepthBuffer = {};
bool Running = false;
Juliet::Arena* GameArena = nullptr;
Juliet::Arena* GameScratchArena = nullptr;
bool Running = false;
int AutoCloseFrameCount = -1;
};