From ed51dab429e467fc144f0bfbed70a5291c8a0a27 Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Sun, 21 Aug 2022 10:20:31 -0400 Subject: multisampled gl masks --- memory.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'memory.cpp') diff --git a/memory.cpp b/memory.cpp index 7c08f91..2a9b29b 100644 --- a/memory.cpp +++ b/memory.cpp @@ -25,6 +25,25 @@ AllocateMemory(memory *Memory, uint64 Size, memory_table_list TableName) { return Address; } +// Returns the address and THEN advances +static void* +Memory_Advance(memory *Memory, uint64 Size, memory_table_list TableName) { + return AllocateMemory(Memory, Size, TableName); +} + +// Rewinds and THEN returns the address +static void* +Memory_Rewind(memory *Memory, uint64 Size, memory_table_list TableName) { + void *Address; + memory_table *Table = &Memory->Slot[TableName]; + if (Table->CurrentPosition - Size < 0) { + return NULL; + } + Table->CurrentPosition -= Size; + Address = (ptrsize *)((uint8 *)Table->Address + Table->CurrentPosition); + return Address; +} + // Returns 0-1 range wherever Pointer is in relation to StartingPointer to Size*Amount. static real32 Memory_NormalizedPosition(void *StartingPointer, uint32 Amount, uint32 Size, void *Pointer) -- cgit v1.2.3