diff options
author | Fox Caminiti <fox@foxcam.net> | 2022-08-21 10:20:31 -0400 |
---|---|---|
committer | Fox Caminiti <fox@foxcam.net> | 2022-08-21 10:20:31 -0400 |
commit | ed51dab429e467fc144f0bfbed70a5291c8a0a27 (patch) | |
tree | f79fc3bb577ca996b49b34f1bad5bff4a40ce6a9 /memory.cpp | |
parent | 8c5f06c37f3c267ecd8f867cd49765c366b5f47c (diff) |
multisampled gl masks
Diffstat (limited to 'memory.cpp')
-rw-r--r-- | memory.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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) |