Update allocator interface
Release / release (push) Successful in 4s

This commit is contained in:
2026-09-30 22:24:46 +01:00
parent cd93b2e479
commit df03b48319
8 changed files with 75 additions and 32 deletions
+24
View File
@@ -56,6 +56,26 @@ void wpMemAllocatorFree(const WpAllocator *allocator, void **ptr, u64 size) {
allocator->free(ptr, size, allocator->obj);
}
void wpMemAllocatorTempBegin(const WpAllocator *allocator) {
wpDebugAssert(allocator != NULL, "`allocator` should not be NULL");
if (!wpMemAllocatorOpSupported(allocator, WP_MEM_OP_TEMP_BEGIN)) {
return;
}
allocator->temp_begin(allocator->obj);
}
void wpMemAllocatorTempEnd(const WpAllocator *allocator) {
wpDebugAssert(allocator != NULL, "`allocator` should not be NULL");
if (!wpMemAllocatorOpSupported(allocator, WP_MEM_OP_TEMP_END)) {
return;
}
allocator->temp_end(allocator->obj);
}
b8 wpMemAllocatorOpSupported(const WpAllocator *allocator, WpMemOp op) {
wpDebugAssert(allocator != NULL, "`allocator` should not be NULL");
@@ -70,6 +90,10 @@ b8 wpMemAllocatorOpSupported(const WpAllocator *allocator, WpMemOp op) {
return allocator->realloc_aligned != NULL;
case WP_MEM_OP_FREE:
return allocator->free != NULL;
case WP_MEM_OP_TEMP_BEGIN:
return allocator->temp_begin != NULL;
case WP_MEM_OP_TEMP_END:
return allocator->temp_end != NULL;
default:
break;
}