Added support via a macro (BASALT_ENABLE_ALLOC_RECORDS 1) to enable tracking all allocations pointer value and their size. Naturally this is slow and should be disabled for any non-debug build.

This commit is contained in:
2025-07-07 22:45:35 +10:00
parent b1c0b714cd
commit cb21dc7ede
2 changed files with 32 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
#pragma once
#define BASALT_ENABLE_ALLOC_RECORDS 1
#if defined(__clang__) || defined(__gcc__)
#define STATIC_ASSERT(x,y) _Static_assert(x,y)
#else
@@ -40,6 +42,10 @@ STATIC_ASSERT(sizeof(i64) == 8, "Expected sizeof(i64) == 8");
STATIC_ASSERT(sizeof(f32) == 4, "Expected sizeof(f32) == 4");
STATIC_ASSERT(sizeof(f64) == 8, "Expected sizeof(f64) == 8");
#define BCLAMP(val, min, max) (val) = (val) > (max) ? (max) : (val) < (min) ? (min) : (val)
#define BCLAMP_EXTENT(val, min, max) \
(val).width = ((val).width > (max).width) ? (max).width : ((val).width < (min).width) ? (min).width : (val).width; \
(val).height = ((val).height > (max).height) ? (max).height : ((val).height < (min).height) ? (min).height : (val).height
#if defined(WIN32) || defined(_WIN32) || defined (__WIN32__)
#define BPLATFORM_WINDOWS 1