Doyle Thai
6df92e7aed
Reduce the number of files in project by merging texture and shaders into assets/renderer file. It's better to keep code local to where it is rather than splitting them into "self-contained modules". It becomes easier to understand reading top-to-bottom and there's is less jumping around which can increase the difficulty of comprehending the code. Convert names to use more of a <namespace>_<object><Action> format.
32 lines
670 B
C
32 lines
670 B
C
#include "Dengine/MemoryArena.h"
|
|
|
|
void memory_arenaInit(MemoryArena_ *arena, void *base, size_t size)
|
|
{
|
|
arena->size = size;
|
|
arena->used = 0;
|
|
arena->base = CAST(u8 *) base;
|
|
arena->tempMemoryCount = 0;
|
|
}
|
|
|
|
TempMemory memory_beginTempRegion(MemoryArena_ *arena)
|
|
{
|
|
TempMemory result = {0};
|
|
result.arena = arena;
|
|
result.used = arena->used;
|
|
|
|
arena->tempMemoryCount++;
|
|
|
|
return result;
|
|
}
|
|
|
|
void memory_endTempRegion(TempMemory tempMemory)
|
|
{
|
|
MemoryArena_ *arena = tempMemory.arena;
|
|
ASSERT(arena->used > tempMemory.used)
|
|
|
|
arena->used = tempMemory.used;
|
|
ASSERT(arena->tempMemoryCount > 0)
|
|
|
|
arena->tempMemoryCount--;
|
|
}
|