summaryrefslogtreecommitdiff
path: root/memory.cpp
diff options
context:
space:
mode:
authorFox Caminiti <fox@foxcam.net>2022-08-21 10:20:31 -0400
committerFox Caminiti <fox@foxcam.net>2022-08-21 10:20:31 -0400
commited51dab429e467fc144f0bfbed70a5291c8a0a27 (patch)
treef79fc3bb577ca996b49b34f1bad5bff4a40ce6a9 /memory.cpp
parent8c5f06c37f3c267ecd8f867cd49765c366b5f47c (diff)
multisampled gl masks
Diffstat (limited to 'memory.cpp')
-rw-r--r--memory.cpp19
1 files changed, 19 insertions, 0 deletions
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)