Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Obelisk/EntryPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int applicationEntryPoint(int argc, char* argv[])

if (launch_editor)
{
app = ZPushStructCtor(arena, Tetragrama::Editor);
app = ZPushStructCtor<Tetragrama::Editor>(arena);
app->EnableRenderOverlay = true;
}

Expand Down
2 changes: 1 addition & 1 deletion Tetragrama/Controllers/EditorCameraController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ namespace Tetragrama::Controllers
settings.MinOrbitDistance = 0.5f;
settings.MaxOrbitDistance = 10000.0f;

m_camera = ZPushStructCtorArgs(arena, FlyCamera, logicalW / logicalH, settings);
m_camera = ZPushStructCtorArgs<FlyCamera>(arena, std::source_location::current(), logicalW / logicalH, settings);
m_camera->SetViewportSize(logicalW, logicalH);

m_camera->Hooks.Context = app;
Expand Down
14 changes: 7 additions & 7 deletions Tetragrama/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace Tetragrama
// Reserve the editor owner before creating configuration and workspace
// state. EditorScene will later carve its 200 MiB local arena from here.
Memory->CreateBudgetedArena(Memory->Budget.EditorContext, &EditorArena);
Configuration = ZPushStructCtor(&EditorArena, EditorConfiguration);
Configuration = ZPushStructCtor<EditorConfiguration>(&EditorArena);

if (ZEngine::Helpers::secure_strlen(ConfigFile))
{
Expand Down Expand Up @@ -61,26 +61,26 @@ namespace Tetragrama

void Editor::OnInitialized()
{
auto editor_scene = ZPushStructCtor(&EditorArena, EditorScene);
auto editor_cam_controller = ZPushStructCtor(&EditorArena, Controllers::EditorCameraController);
ZUIUILayer = ZPushStructCtor(&EditorArena, ZUILayer);
auto editor_scene = ZPushStructCtor<EditorScene>(&EditorArena);
auto editor_cam_controller = ZPushStructCtor<Controllers::EditorCameraController>(&EditorArena);
ZUIUILayer = ZPushStructCtor<ZUILayer>(&EditorArena);

ZUIUILayer->Initialize(&EditorArena, this);

// Single panel-manager component replaces all old per-panel components.
// It owns the dock tree, tab bars, and all panel views.
auto* pm = ZPushStructCtor(&EditorArena, Tetragrama::Panels::ZUIPanelManagerComponent);
auto* pm = ZPushStructCtor<Tetragrama::Panels::ZUIPanelManagerComponent>(&EditorArena);
pm->Initialize(ZUIUILayer, "PanelManager");
ZUIUILayer->AddComponent(pm);

// Editor shell: menu bar + floating overlays (settings, etc.)
// Registered after PanelManager so it renders on top.
auto* shell = ZPushStructCtor(&EditorArena, Tetragrama::Components::ZUIDockspaceComponent);
auto* shell = ZPushStructCtor<Tetragrama::Components::ZUIDockspaceComponent>(&EditorArena);
shell->Initialize(ZUIUILayer, "EditorShell");
shell->ShellPanelManager = &pm->Manager;
ZUIUILayer->AddComponent(shell);

auto* sbar = ZPushStructCtor(&EditorArena, Tetragrama::Components::ZUIStatusBarComponent);
auto* sbar = ZPushStructCtor<Tetragrama::Components::ZUIStatusBarComponent>(&EditorArena);
sbar->ShellPanelManager = &pm->Manager;
sbar->Initialize(ZUIUILayer, "StatusBar");
ZUIUILayer->AddComponent(sbar);
Expand Down
8 changes: 4 additions & 4 deletions Tetragrama/Panels/AssetImporterPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ namespace Tetragrama::Panels
import_arena->CreateSubArena(ZMega(64), &m_gltf_importer_arena, "ImportPipeline/EditorGltfImporter");
import_arena->CreateSubArena(ZMega(128), &m_assimp_importer_arena, "ImportPipeline/EditorAssimpImporter");

m_gltf_importer = ZPushStructCtor(import_arena, ZEngine::Importers::GltfImporter);
m_fbx_importer = ZPushStructCtor(import_arena, ZEngine::Importers::FbxImporter);
m_assimp_importer = ZPushStructCtor(import_arena, ZEngine::Importers::AssimpImporter);
m_gltf_importer = ZPushStructCtor<ZEngine::Importers::GltfImporter>(import_arena);
m_fbx_importer = ZPushStructCtor<ZEngine::Importers::FbxImporter>(import_arena);
m_assimp_importer = ZPushStructCtor<ZEngine::Importers::AssimpImporter>(import_arena);

m_gltf_importer->Initialize(&m_gltf_importer_arena);
m_fbx_importer->Initialize(import_arena);
Expand Down Expand Up @@ -615,7 +615,7 @@ namespace Tetragrama::Panels

m_local_arena.Clear();

auto* config = ZPushStruct(&m_local_arena, ZEngine::Importers::AssetCodec::ImportConfiguration);
auto* config = ZPushStruct<ZEngine::Importers::AssetCodec::ImportConfiguration>(&m_local_arena);
const auto& cfg = *app->Configuration;
config->OutputWorkingSpacePath.init(&m_local_arena, cfg.WorkingSpacePath.c_str());
config->OutputTextureFilesPath.init(&m_local_arena, cfg.TexturePath.c_str());
Expand Down
8 changes: 4 additions & 4 deletions Tetragrama/Panels/HierarchyPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ namespace Tetragrama::Panels
EntityID EID;
EntityID Parent;
};
OutlinerNode* nodes = ZPushArray(&ctx->FrameArena, OutlinerNode, cap);
uint32_t* first_child = ZPushArray(&ctx->FrameArena, uint32_t, cap);
uint32_t* next_sib = ZPushArray(&ctx->FrameArena, uint32_t, cap);
OutlinerNode* nodes = ZPushArray<OutlinerNode>(&ctx->FrameArena, cap);
uint32_t* first_child = ZPushArray<uint32_t>(&ctx->FrameArena, cap);
uint32_t* next_sib = ZPushArray<uint32_t>(&ctx->FrameArena, cap);
uint32_t node_count = 0;

for (uint32_t i = 0; i < cap; ++i)
Expand Down Expand Up @@ -196,7 +196,7 @@ namespace Tetragrama::Panels
uint32_t idx;
int depth;
};
DFSEntry* stk = ZPushArray(&ctx->FrameArena, DFSEntry, node_count * 2 + 2);
DFSEntry* stk = ZPushArray<DFSEntry>(&ctx->FrameArena, node_count * 2 + 2);
int sp = 0;
for (int i = (int) node_count - 1; i >= 0; --i)
if (nodes[i].Parent == INVALID_ENTITY)
Expand Down
2 changes: 1 addition & 1 deletion Tetragrama/Panels/ProjectViewPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ namespace Tetragrama::Panels
int depth;
};
static constexpr int kMaxStack = 512;
StackEntry* stk = ZPushArray(&ctx->FrameArena, StackEntry, kMaxStack);
StackEntry* stk = ZPushArray<StackEntry>(&ctx->FrameArena, kMaxStack);
int sp = 0;

// Seed the stack with top-level directories (pushed in reverse for L-to-R order)
Expand Down
6 changes: 3 additions & 3 deletions ZEngine/ZEngine/Applications/AppRenderPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ namespace ZEngine::Applications
{
Device = device;
RenderWorkerThreadCount = Device->CommandBufferMgr->TotalThreadCount > 0u ? Device->CommandBufferMgr->TotalThreadCount - 1u : 0u;
SceneRenderer = ZPushStructCtor(Device->Arena, Rendering::Renderers::GraphicRenderer);
ZUIRenderPass = ZPushStructCtor(Device->Arena, Rendering::Renderers::ZUIPass);
SceneRenderer = ZPushStructCtor<Rendering::Renderers::GraphicRenderer>(Device->Arena);
ZUIRenderPass = ZPushStructCtor<Rendering::Renderers::ZUIPass>(Device->Arena);

ZUIRenderPass->Initialize(Device);
SceneRenderer->Initialize(Device);
Expand All @@ -87,7 +87,7 @@ namespace ZEngine::Applications
// UIContext arena: created by Engine::Initialize via MemoryBudgetConfig::Editor().UIContext
// (128 MB budgeted, ~60 MB committed: FrameArena 32 MB · PersistentArena 1 MB · ZUIPayloadArenas 9 MB × 3)
auto* ui_arena = &Engine::GetContext()->UIContextArena;
ZUICtx = ZPushStructCtor(ui_arena, ZEngine::UI::ZUIContext);
ZUICtx = ZPushStructCtor<ZEngine::UI::ZUIContext>(ui_arena);
ZEngine::UI::ZUIContextInit(ZUICtx, ui_arena, ZMega(32), ZMega(1), 8192, 8192);
for (uint32_t i = 0; i < MaxOverlayBufferCount; ++i)
{
Expand Down
4 changes: 2 additions & 2 deletions ZEngine/ZEngine/Applications/GameApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace ZEngine::Applications
{
Memory = memory;

State = ZPushStructCtor(&Memory->BootstrapArena, ApplicationState);
State = ZPushStructCtor<ApplicationState>(&Memory->BootstrapArena);

OnInitializing();
OverrideWindowConfiguration();
Expand All @@ -34,7 +34,7 @@ namespace ZEngine::Applications
}
}

RenderPipeline = ZPushStructCtor(&Memory->BootstrapArena, AppRenderPipeline);
RenderPipeline = ZPushStructCtor<AppRenderPipeline>(&Memory->BootstrapArena);
RenderPipeline->Initialize(Engine::GetContext()->Device);

OnInitialized();
Expand Down
4 changes: 2 additions & 2 deletions ZEngine/ZEngine/Core/Containers/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ namespace ZEngine::Core::Containers
if (m_slab)
m_data = static_cast<pointer>(m_slab->Realloc(m_data, new_alloc_size));
else
m_data = static_cast<pointer>(ZResize(m_allocator, m_data, old_alloc_size, new_alloc_size, ZAlignof(value_type)));
m_data = static_cast<pointer>(ZResize(m_allocator, m_data, old_alloc_size, new_alloc_size, ZAlignof<value_type>()));

m_capacity = new_capacity;
}
Expand Down Expand Up @@ -339,4 +339,4 @@ namespace ZEngine::Core::Containers
T* m_data;
size_t m_size;
};
} // namespace ZEngine::Core::Containers
} // namespace ZEngine::Core::Containers
4 changes: 2 additions & 2 deletions ZEngine/ZEngine/Core/Containers/InitializerList.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace ZEngine::Core::Containers
{
size_t count = sizeof...(args) + 1;

T* buffer = static_cast<T*>(ZAlloc(allocator, count * sizeof(T), ZAlignof(T)));
T* buffer = static_cast<T*>(ZAlloc(allocator, count * sizeof(T), ZAlignof<T>()));

buffer[0] = first;

Expand All @@ -79,4 +79,4 @@ namespace ZEngine::Core::Containers
return InitializerList<T>(buffer, count);
}

} // namespace ZEngine::Core::Containers
} // namespace ZEngine::Core::Containers
4 changes: 2 additions & 2 deletions ZEngine/ZEngine/Core/Containers/Strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ namespace ZEngine::Core::Containers
size_t old_alloc_size = m_capacity * sizeof(char);
size_t new_alloc_size = new_capacity * sizeof(char);

m_data = static_cast<pointer>(ZResize(m_allocator, m_data, old_alloc_size, new_alloc_size, ZAlignof(value_type)));
m_data = static_cast<pointer>(ZResize(m_allocator, m_data, old_alloc_size, new_alloc_size, ZAlignof<value_type>()));
m_capacity = new_capacity;
}

Expand Down Expand Up @@ -285,4 +285,4 @@ namespace ZEngine::Core::Containers
size_type m_size;
};

} // namespace ZEngine::Core::Containers
} // namespace ZEngine::Core::Containers
2 changes: 1 addition & 1 deletion ZEngine/ZEngine/Core/VFS/Platform/VFSRDCWatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ namespace ZEngine::Core::VFS

std::lock_guard<std::mutex> lock(m_watch_mutex);

void* storage = ZAlloc(m_arena, sizeof(WatchEntry), ZAlignof(WatchEntry));
void* storage = ZAlloc(m_arena, sizeof(WatchEntry), ZAlignof<WatchEntry>());
if (!storage)
{
CloseHandle(dir);
Expand Down
4 changes: 2 additions & 2 deletions ZEngine/ZEngine/Core/VFS/Registry/DependencyGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ namespace ZEngine::Core::VFS
// Inline open-addressing visited set backed by scratch arena.
uint32_t visited_cap = 256;
uint32_t visited_count = 0;
uuids::uuid* visited = ZPushArray(scratch, uuids::uuid, visited_cap);
uuids::uuid* visited = ZPushArray<uuids::uuid>(scratch, visited_cap);
std::memset(visited, 0, visited_cap * sizeof(uuids::uuid));

auto visited_rehash = [&]() {
uint32_t new_cap = visited_cap * 2;
uuids::uuid* new_table = ZPushArray(scratch, uuids::uuid, new_cap);
uuids::uuid* new_table = ZPushArray<uuids::uuid>(scratch, new_cap);
std::memset(new_table, 0, new_cap * sizeof(uuids::uuid));
for (uint32_t i = 0; i < visited_cap; ++i)
{
Expand Down
8 changes: 4 additions & 4 deletions ZEngine/ZEngine/Core/VFS/VFSContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace ZEngine::Core::VFS

#if defined(__APPLE__)
{
void* storage = ZAlloc(m_arena, sizeof(VFSFSEventsWatcher), ZAlignof(VFSFSEventsWatcher));
void* storage = ZAlloc(m_arena, sizeof(VFSFSEventsWatcher), ZAlignof<VFSFSEventsWatcher>());
if (!storage)
{
ZENGINE_LOG_VFS_ERR("InitWatcher: arena allocation failed for VFSFSEventsWatcher");
Expand All @@ -65,7 +65,7 @@ namespace ZEngine::Core::VFS
}
#elif defined(__linux__)
{
void* storage = ZAlloc(m_arena, sizeof(VFSInotifyWatcher), ZAlignof(VFSInotifyWatcher));
void* storage = ZAlloc(m_arena, sizeof(VFSInotifyWatcher), ZAlignof<VFSInotifyWatcher>());
if (!storage)
{
ZENGINE_LOG_VFS_ERR("InitWatcher: arena allocation failed for VFSInotifyWatcher");
Expand All @@ -83,7 +83,7 @@ namespace ZEngine::Core::VFS
}
#elif defined(_WIN32)
{
void* storage = ZAlloc(m_arena, sizeof(VFSRDCWatcher), ZAlignof(VFSRDCWatcher));
void* storage = ZAlloc(m_arena, sizeof(VFSRDCWatcher), ZAlignof<VFSRDCWatcher>());
if (!storage)
{
ZENGINE_LOG_VFS_ERR("InitWatcher: arena allocation failed for VFSRDCWatcher");
Expand All @@ -104,7 +104,7 @@ namespace ZEngine::Core::VFS
return;
#endif

void* fw_storage = ZAlloc(m_arena, sizeof(VFSFileWatcher), ZAlignof(VFSFileWatcher));
void* fw_storage = ZAlloc(m_arena, sizeof(VFSFileWatcher), ZAlignof<VFSFileWatcher>());
if (!fw_storage)
{
ZENGINE_LOG_VFS_ERR("InitWatcher: arena allocation failed for VFSFileWatcher");
Expand Down
2 changes: 1 addition & 1 deletion ZEngine/ZEngine/Core/VFS/VFSDiskBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ namespace ZEngine::Core::VFS
{
return VFSResult<IVFSFile*>::Fail(VFSError::OutOfMemory);
}
VFSDiskFile* file = ZConstruct(mem, VFSDiskFile);
VFSDiskFile* file = ZConstruct<VFSDiskFile>(mem);
file->Owner = this;
file->m_path = relative_path;
file->m_writable = wants_write;
Expand Down
4 changes: 2 additions & 2 deletions ZEngine/ZEngine/Core/VFS/VFSMemoryBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ namespace ZEngine::Core::VFS

MemNode* VFSMemoryBackend::CreateNode(const VFSPath& path, MemNode::Kind kind)
{
MemNode* node = ZPushStructCtor(m_arena, MemNode);
MemNode* node = ZPushStructCtor<MemNode>(m_arena);
node->NodeKind = kind;
node->Path = path;
m_nodes.insert(node->Path.CStr(), node);
Expand All @@ -199,7 +199,7 @@ namespace ZEngine::Core::VFS
{
return nullptr;
}
return ZConstruct(mem, VFSMemoryFile);
return ZConstruct<VFSMemoryFile>(mem);
}

void VFSMemoryBackend::FreeFile(IVFSFile* file)
Expand Down
2 changes: 1 addition & 1 deletion ZEngine/ZEngine/Core/VFS/VFSZipBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ namespace ZEngine::Core::VFS
{
return VFSResult<IVFSFile*>::Fail(VFSError::OutOfMemory);
}
VFSZipFile* file = ZConstruct(mem, VFSZipFile);
VFSZipFile* file = ZConstruct<VFSZipFile>(mem);
file->Owner = this;
file->m_entry = entry;
file->m_backend = this;
Expand Down
5 changes: 2 additions & 3 deletions ZEngine/ZEngine/ECS/Actor.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include <ZEngine/ECS/EntityID.h>
#include <ZEngine/ECS/Scene.h>
#include <ZEngine/ZEngineDef.h>

namespace ZEngine::ECS
{
Expand All @@ -9,6 +10,7 @@ namespace ZEngine::ECS
class Actor
{
public:
Actor() = default;
virtual ~Actor() = default;

[[nodiscard]] EntityID GetEntityID() const
Expand Down Expand Up @@ -67,9 +69,6 @@ namespace ZEngine::ECS
virtual void OnDestroy() {}
virtual void OnTick(float dt) {}

protected:
Actor() = default;

private:
friend class ActorManager;

Expand Down
2 changes: 1 addition & 1 deletion ZEngine/ZEngine/ECS/ActorManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ namespace ZEngine::ECS
ActorHandle ActorManager::CreateWithExistingEntityID(EntityID id)
{
ZENGINE_VALIDATE_ASSERT(m_arena != nullptr, "ActorManager::CreateWithExistingEntityID: not initialized")
Actor* actor = ZPushStructCtor(m_arena, Actor);
Actor* actor = ZPushStructCtor<Actor>(m_arena);
actor->m_entity_id = id;
actor->m_scene = m_scene;
AssertUniqueEntityID(actor->m_entity_id);
Expand Down
2 changes: 1 addition & 1 deletion ZEngine/ZEngine/ECS/ActorManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace ZEngine::ECS

ZENGINE_VALIDATE_ASSERT(m_arena != nullptr, "ActorManager::Create: not initialized")

T* actor = ZPushStructCtor(m_arena, T);
T* actor = ZPushStructCtor<T>(m_arena);
actor->m_entity_id = m_scene->CreateEntity();
actor->m_scene = m_scene;

Expand Down
2 changes: 1 addition & 1 deletion ZEngine/ZEngine/ECS/Scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ namespace ZEngine::ECS
return *static_cast<ComponentStorage<T>*>(*existing);

// Arena-allocate the storage object
auto* storage = ZPushStructCtor(m_arena, ComponentStorage<T>);
auto* storage = ZPushStructCtor<ComponentStorage<T>>(m_arena);
storage->Initialize(m_arena, EntityRegistry::MAX_ENTITIES);
auto* iface = static_cast<IComponentStorage*>(storage);
m_storages.insert(type_id, iface);
Expand Down
Loading
Loading