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
13 changes: 6 additions & 7 deletions Engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@ add_library(ProjectDelta SHARED
"include/delta/definitions.h"
"src/delta/platform/os_internal.h"
"src/delta/platform/os_win32.cpp"
"src/delta/platform/os_linux.cpp"
"include/delta/platform/os.h"
"include/delta/pch.h"
"src/delta/pch.h"
"src/delta/pch.cpp"
"src/delta/core/MemoryManager.h"
"src/delta/core/MemoryManager.cpp"
"src/delta/core/FrameAllocator.h"
"src/delta/core/FrameAllocator.cpp"
"src/delta/internal_definitions.h"
"src/delta/core/FreeListAllocator.h" "src/delta/core/FreeListAllocator.cpp")
"src/delta/core/EngineTypes.h"
"src/delta/core/ThreadContext.h"
"src/delta/core/ThreadContext.cpp"
"src/delta/core/MemoryConfig.h"
"src/delta/core/MemoryConfig.cpp"
)

target_compile_definitions(ProjectDelta
PRIVATE DLT_EXPORT_SYMBOLS
Expand Down
17 changes: 10 additions & 7 deletions Engine/include/delta/platform/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,22 @@ namespace delta::platform
{
struct OSInfo
{
// cpu
char cpuManufacturerId[13];
char cpuBrandString[sizeof(int) * 12 + 1];
const char* cpuArchitecture;
uint32_t cpuCoreCount;

uint32_t cpuPhysicalCoreCount;
uint32_t cpuLogicalProcessorCount;
uint32_t maxEngineWorkerCount;
uint32_t osPageSize;

char cpuBrandString[sizeof(int) * 12 + 1];
char cpuManufacturerId[13];

bool cpuHasSMT;
bool cpuHasAVX2;
bool cpuHasAVX512f;
bool cpuHasAVX512cd;
bool cpuHasAVX512er;
bool cpuHasAVX512pf;

// general OS info
uint32_t osPageSize;
};

struct MemoryStatus
Expand Down
33 changes: 33 additions & 0 deletions Engine/src/delta/core/EngineTypes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pragma once

#include <delta/platform/os_internal.h>

namespace delta::core
{
struct ThreadPageCoordinator
{
uint8_t* virtualAddressBase;
size_t commitedOffset;
size_t reservedCapacity;
size_t pageSize;
};

struct EngineArena
{
uint8_t* backingMemory;
size_t capacity;
size_t offset;
};

struct alignas(64) ThreadExecutionContext
{
uint32_t threadIx;
uint32_t threadId;

ThreadPageCoordinator pageCoordinator;
EngineArena transientArena;
delta::platform::Timer perThreadTimer;
};

extern thread_local ThreadExecutionContext* tl_CurrentThreadContext;
}
91 changes: 0 additions & 91 deletions Engine/src/delta/core/FrameAllocator.cpp

This file was deleted.

40 changes: 0 additions & 40 deletions Engine/src/delta/core/FrameAllocator.h

This file was deleted.

78 changes: 0 additions & 78 deletions Engine/src/delta/core/FreeListAllocator.cpp

This file was deleted.

41 changes: 0 additions & 41 deletions Engine/src/delta/core/FreeListAllocator.h

This file was deleted.

24 changes: 24 additions & 0 deletions Engine/src/delta/core/MemoryConfig.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "MemoryConfig.h"

#include <delta/platform/os.h>

namespace delta::core
{
EngineMemoryConfig g_MemoryConfig{};
std::atomic<size_t> g_TotalLockedBytes{ 0 };

void MemoryConfig_Initialize(size_t physicalRamInstalled, uint32_t maxEngineWorkers)
{
g_MemoryConfig.totalPhysicalRam = physicalRamInstalled;
g_MemoryConfig.globalLockCeiling = (g_MemoryConfig.totalPhysicalRam / 10) * 7;
g_MemoryConfig.threadSoftBaseline = g_MemoryConfig.globalLockCeiling / maxEngineWorkers;

g_TotalLockedBytes.store(0, std::memory_order_relaxed);
}

void MemoryConfig_Shutdown()
{
g_MemoryConfig = {};
g_TotalLockedBytes.store(0, std::memory_order_relaxed);
}
}
17 changes: 17 additions & 0 deletions Engine/src/delta/core/MemoryConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

namespace delta::core
{
struct EngineMemoryConfig
{
size_t totalPhysicalRam;
size_t globalLockCeiling;
size_t threadSoftBaseline;
};

extern EngineMemoryConfig g_MemoryConfig;
extern std::atomic<size_t> g_TotalLockedBytes;

void MemoryConfig_Initialize(size_t physicalRamInstalled, uint32_t maxEngineWorkers);
void MemoryConfig_Shutdown();
}
Loading