calloc to arena
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
extern JULIET_API void DebugDisplay_Initialize(GraphicsDevice* device);
|
||||
extern JULIET_API void DebugDisplay_Initialize(NonNullPtr<Arena> arena, GraphicsDevice* device);
|
||||
extern JULIET_API void DebugDisplay_Shutdown(GraphicsDevice* device);
|
||||
extern JULIET_API void DebugDisplay_DrawLine(const Vector3& start, const Vector3& end, const FColor& color, bool overlay);
|
||||
extern JULIET_API void DebugDisplay_DrawSphere(const Vector3& center, float radius, const FColor& color, bool overlay);
|
||||
|
||||
@@ -37,10 +37,9 @@ namespace Juliet
|
||||
{
|
||||
GraphicsDevice* device = EngineInstance.Application->GetGraphicsDevice();
|
||||
|
||||
// DebugDisplay system
|
||||
if (device)
|
||||
{
|
||||
DebugDisplay_Initialize(device);
|
||||
DebugDisplay_Initialize(EngineInstance.PlatformArena, device);
|
||||
if (Window* window = EngineInstance.Application->GetPlatformWindow())
|
||||
{
|
||||
bool success = InitializeMeshRendererGraphics(device, window);
|
||||
|
||||
@@ -4618,7 +4618,7 @@ namespace Juliet
|
||||
driver->Semantic = WrapString("TEXCOORD");
|
||||
driver->FramesInFlight = 2;
|
||||
|
||||
auto device = static_cast<GraphicsDevice*>(Calloc(1, sizeof(GraphicsDevice)));
|
||||
GraphicsDevice* device = ArenaPushStruct<GraphicsDevice>(driverArena JULIET_DEBUG_PARAM("GraphicsDevice"));
|
||||
if (!device)
|
||||
{
|
||||
DestroyDriver_Internal(driver);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <Core/HAL/Filesystem/Filesystem.h>
|
||||
#include <Core/Logging/LogManager.h>
|
||||
#include <Core/Logging/LogTypes.h>
|
||||
#include <Core/Memory/Allocator.h>
|
||||
#include <Core/Thread/ThreadContext.h>
|
||||
#include <Graphics/GraphicsPipeline.h>
|
||||
#include <Graphics/PushConstants.h>
|
||||
@@ -157,7 +156,7 @@ namespace Juliet
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void DebugDisplay_Initialize(GraphicsDevice* device)
|
||||
void DebugDisplay_Initialize(NonNullPtr<Arena> arena, GraphicsDevice* device)
|
||||
{
|
||||
if (g_DebugState.Initialized)
|
||||
{
|
||||
@@ -167,7 +166,8 @@ namespace Juliet
|
||||
g_DebugState.Device = device;
|
||||
|
||||
// Allocate single CPU vertex array (depth-tested in first half, overlay in second half)
|
||||
g_DebugState.Vertices = static_cast<DebugVertex*>(Malloc(kMaxDebugVertices * sizeof(DebugVertex)));
|
||||
g_DebugState.Vertices =
|
||||
ArenaPushArray<DebugVertex>(arena, kMaxDebugVertices JULIET_DEBUG_PARAM("Debug Display Renderer Vertices"));
|
||||
g_DebugState.DepthTestedVertexCount = 0;
|
||||
g_DebugState.OverlayVertexCount = 0;
|
||||
|
||||
@@ -212,8 +212,6 @@ namespace Juliet
|
||||
DestroyGraphicsTransferBuffer(device, g_DebugState.TransferBuffer);
|
||||
}
|
||||
|
||||
SafeFree(g_DebugState.Vertices);
|
||||
|
||||
g_DebugState = {};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user