aboutsummaryrefslogtreecommitdiff
path: root/core/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'core/runtime')
-rw-r--r--core/runtime/core.odin5
-rw-r--r--core/runtime/default_allocators.odin7
2 files changed, 11 insertions, 1 deletions
diff --git a/core/runtime/core.odin b/core/runtime/core.odin
index 1ed16d127..d3522c268 100644
--- a/core/runtime/core.odin
+++ b/core/runtime/core.odin
@@ -251,8 +251,11 @@ Allocator_Mode :: enum byte {
Free,
Free_All,
Resize,
+ Query_Features,
}
+Allocator_Mode_Set :: distinct bit_set[Allocator_Mode];
+
Allocator_Proc :: #type proc(allocator_data: rawptr, mode: Allocator_Mode,
size, alignment: int,
old_memory: rawptr, old_size: int, flags: u64 = 0, location: Source_Code_Location = #caller_location) -> rawptr;
@@ -263,7 +266,7 @@ Allocator :: struct {
// Logging stuff
-Logger_Level :: enum {
+Logger_Level :: enum uint {
Debug = 0,
Info = 10,
Warning = 20,
diff --git a/core/runtime/default_allocators.odin b/core/runtime/default_allocators.odin
index 525bb3bc1..3643fccdf 100644
--- a/core/runtime/default_allocators.odin
+++ b/core/runtime/default_allocators.odin
@@ -132,6 +132,13 @@ default_temp_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode
ptr := default_temp_allocator_proc(allocator_data, Allocator_Mode.Alloc, size, alignment, old_memory, old_size, flags, loc);
mem_copy(ptr, old_memory, old_size);
return ptr;
+
+ case .Query_Features:
+ set := (^Allocator_Mode_Set)(old_memory);
+ if set != nil {
+ set^ = {.Alloc, .Free, .Free_All, .Resize, .Query_Features};
+ }
+ return set;
}
return nil;