Remove core dn layer
This commit is contained in:
+628
-1771
File diff suppressed because it is too large
Load Diff
+159
-163
@@ -1,4 +1,4 @@
|
||||
// Generated by the DN single header generator 2025-11-08 18:54:58
|
||||
// Generated by the DN single header generator 2025-11-09 13:19:26
|
||||
|
||||
#if !defined(DN_BASE_INC_H)
|
||||
#define DN_BASE_INC_H
|
||||
@@ -983,6 +983,50 @@ struct DN_FmtAppendResult
|
||||
bool truncated;
|
||||
};
|
||||
|
||||
struct DN_ProfilerAnchor
|
||||
{
|
||||
// Inclusive refers to the time spent to complete the function call
|
||||
// including all children functions.
|
||||
//
|
||||
// Exclusive refers to the time spent in the function, not including any
|
||||
// time spent in children functions that we call that are also being
|
||||
// profiled. If we recursively call into ourselves, the time we spent in
|
||||
// our function is accumulated.
|
||||
DN_U64 tsc_inclusive;
|
||||
DN_U64 tsc_exclusive;
|
||||
DN_U16 hit_count;
|
||||
DN_Str8 name;
|
||||
};
|
||||
|
||||
struct DN_ProfilerZone
|
||||
{
|
||||
DN_U16 anchor_index;
|
||||
DN_U64 begin_tsc;
|
||||
DN_U16 parent_zone;
|
||||
DN_U64 elapsed_tsc_at_zone_start;
|
||||
};
|
||||
|
||||
struct DN_ProfilerAnchorArray
|
||||
{
|
||||
DN_ProfilerAnchor *data;
|
||||
DN_USize count;
|
||||
};
|
||||
|
||||
typedef DN_U64 (DN_ProfilerTSCNowFunc)();
|
||||
struct DN_Profiler
|
||||
{
|
||||
DN_USize frame_index;
|
||||
DN_ProfilerAnchor *anchors;
|
||||
DN_USize anchors_count;
|
||||
DN_USize anchors_per_frame;
|
||||
DN_U16 parent_zone;
|
||||
bool paused;
|
||||
DN_ProfilerTSCNowFunc *tsc_now;
|
||||
DN_U64 tsc_frequency;
|
||||
DN_ProfilerZone frame_zone;
|
||||
DN_F64 frame_avg_tsc;
|
||||
};
|
||||
|
||||
#if !defined(DN_STB_SPRINTF_HEADER_ONLY)
|
||||
#define STB_SPRINTF_IMPLEMENTATION
|
||||
#define STB_SPRINTF_STATIC
|
||||
@@ -2924,6 +2968,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
DN_GCC_WARNING_POP
|
||||
DN_MSVC_WARNING_POP
|
||||
|
||||
DN_API void DN_BeginFrame ();
|
||||
|
||||
#define DN_SPrintF(...) STB_SPRINTF_DECORATE(sprintf)(__VA_ARGS__)
|
||||
#define DN_SNPrintF(...) STB_SPRINTF_DECORATE(snprintf)(__VA_ARGS__)
|
||||
#define DN_VSPrintF(...) STB_SPRINTF_DECORATE(vsprintf)(__VA_ARGS__)
|
||||
@@ -3215,6 +3261,24 @@ DN_API DN_ByteCountResult DN_ByteCountFromType (DN_U64 bytes, DN_By
|
||||
DN_API DN_Str8x32 DN_ByteCountStr8x32FromType (DN_U64 bytes, DN_ByteCountType type);
|
||||
#define DN_ByteCountStr8x32(bytes) DN_ByteCountStr8x32FromType(bytes, DN_ByteCountType_Auto)
|
||||
|
||||
#define DN_ProfilerZoneLoop(prof, name, index) \
|
||||
DN_ProfilerZone DN_UniqueName(zone_) = DN_ProfilerBeginZone(prof, DN_Str8Lit(name), index), DN_UniqueName(dummy_) = {}; \
|
||||
DN_UniqueName(dummy_).begin_tsc == 0; \
|
||||
DN_ProfilerEndZone(prof, DN_UniqueName(zone_)), DN_UniqueName(dummy_).begin_tsc = 1
|
||||
|
||||
#define DN_ProfilerZoneLoopAuto(prof, name) DN_ProfilerZoneLoop(prof, name, __COUNTER__ + 1)
|
||||
DN_API DN_Profiler DN_ProfilerInit (DN_ProfilerAnchor *anchors, DN_USize count, DN_USize anchors_per_frame, DN_ProfilerTSCNowFunc *tsc_now, DN_U64 tsc_frequency);
|
||||
DN_API DN_ProfilerZone DN_ProfilerBeginZone (DN_Profiler *profiler, DN_Str8 name, DN_U16 anchor_index);
|
||||
#define DN_ProfilerBeginZoneAuto(prof, name) DN_ProfilerBeginZone(prof, DN_Str8Lit(name), __COUNTER__ + 1)
|
||||
DN_API void DN_ProfilerEndZone (DN_Profiler *profiler, DN_ProfilerZone zone);
|
||||
DN_API DN_USize DN_ProfilerFrameCount (DN_Profiler const *profiler);
|
||||
DN_API DN_ProfilerAnchorArray DN_ProfilerFrameAnchorsFromIndex (DN_Profiler *profiler, DN_USize frame_index);
|
||||
DN_API DN_ProfilerAnchorArray DN_ProfilerFrameAnchors (DN_Profiler *profiler);
|
||||
DN_API void DN_ProfilerNewFrame (DN_Profiler *profiler);
|
||||
DN_API void DN_ProfilerDump (DN_Profiler *profiler);
|
||||
DN_API DN_F64 DN_ProfilerSecFromTSC (DN_Profiler *profiler, DN_U64 duration_tsc);
|
||||
DN_API DN_F64 DN_ProfilerMsFromTSC (DN_Profiler *profiler, DN_U64 duration_tsc);
|
||||
|
||||
#endif // !defined(DN_BASE_H)
|
||||
// DN: Single header generator inlined this file => #include "Base/dn_base_os.h"
|
||||
#if !defined(DN_BASE_OS_H)
|
||||
@@ -3253,26 +3317,26 @@ struct DN_StackTraceWalkResultIterator
|
||||
|
||||
|
||||
#if defined(DN_FREESTANDING)
|
||||
#define DN_StackTrace_WalkStr8FromHeap(...) DN_Str8Lit("N/A")
|
||||
#define DN_StackTrace_Walk(...)
|
||||
#define DN_StackTrace_WalkResultIterate(...)
|
||||
#define DN_StackTrace_WalkResultToStr8(...) DN_Str8Lit("N/A")
|
||||
#define DN_StackTrace_WalkStr8(...) DN_Str8Lit("N/A")
|
||||
#define DN_StackTrace_WalkStr8FromHeap(...) DN_Str8Lit("N/A")
|
||||
#define DN_StackTrace_GetFrames(...)
|
||||
#define DN_StackTrace_RawFrameToFrame(...)
|
||||
#define DN_StackTrace_Print(...)
|
||||
#define DN_StackTrace_ReloadSymbols(...)
|
||||
#define DN_StackTraceWalkStr8FromHeap(...) DN_Str8Lit("N/A")
|
||||
#define DN_StackTraceWalk(...)
|
||||
#define DN_StackTraceWalkResultIterate(...)
|
||||
#define DN_StackTraceWalkResultToStr8(...) DN_Str8Lit("N/A")
|
||||
#define DN_StackTraceWalkStr8(...) DN_Str8Lit("N/A")
|
||||
#define DN_StackTraceWalkStr8FromHeap(...) DN_Str8Lit("N/A")
|
||||
#define DN_StackTraceGetFrames(...)
|
||||
#define DN_StackTraceRawFrameToFrame(...)
|
||||
#define DN_StackTracePrint(...)
|
||||
#define DN_StackTraceReloadSymbols(...)
|
||||
#else
|
||||
DN_API DN_StackTraceWalkResult DN_StackTrace_Walk (struct DN_Arena *arena, DN_U16 limit);
|
||||
DN_API bool DN_StackTrace_WalkResultIterate(DN_StackTraceWalkResultIterator *it, DN_StackTraceWalkResult const *walk);
|
||||
DN_API DN_Str8 DN_StackTrace_WalkResultToStr8 (struct DN_Arena *arena, DN_StackTraceWalkResult const *walk, DN_U16 skip);
|
||||
DN_API DN_Str8 DN_StackTrace_WalkStr8 (struct DN_Arena *arena, DN_U16 limit, DN_U16 skip);
|
||||
DN_API DN_Str8 DN_StackTrace_WalkStr8FromHeap (DN_U16 limit, DN_U16 skip);
|
||||
DN_API DN_Slice<DN_StackTraceFrame> DN_StackTrace_GetFrames (struct DN_Arena *arena, DN_U16 limit);
|
||||
DN_API DN_StackTraceFrame DN_StackTrace_RawFrameToFrame (struct DN_Arena *arena, DN_StackTraceRawFrame raw_frame);
|
||||
DN_API void DN_StackTrace_Print (DN_U16 limit);
|
||||
DN_API void DN_StackTrace_ReloadSymbols ();
|
||||
DN_API DN_StackTraceWalkResult DN_StackTraceWalk (struct DN_Arena *arena, DN_U16 limit);
|
||||
DN_API bool DN_StackTraceWalkResultIterate(DN_StackTraceWalkResultIterator *it, DN_StackTraceWalkResult const *walk);
|
||||
DN_API DN_Str8 DN_StackTraceWalkResultToStr8 (struct DN_Arena *arena, DN_StackTraceWalkResult const *walk, DN_U16 skip);
|
||||
DN_API DN_Str8 DN_StackTraceWalkStr8 (struct DN_Arena *arena, DN_U16 limit, DN_U16 skip);
|
||||
DN_API DN_Str8 DN_StackTraceWalkStr8FromHeap (DN_U16 limit, DN_U16 skip);
|
||||
DN_API DN_Slice<DN_StackTraceFrame> DN_StackTraceGetFrames (struct DN_Arena *arena, DN_U16 limit);
|
||||
DN_API DN_StackTraceFrame DN_StackTraceRawFrameToFrame (struct DN_Arena *arena, DN_StackTraceRawFrame raw_frame);
|
||||
DN_API void DN_StackTracePrint (DN_U16 limit);
|
||||
DN_API void DN_StackTraceReloadSymbols ();
|
||||
#endif
|
||||
#endif // !defined(DN_BASE_OS_H)
|
||||
// DN: Single header generator inlined this file => #include "Base/dn_base_assert.h"
|
||||
@@ -3282,7 +3346,7 @@ DN_API void DN_StackTrace_ReloadSymbols ();
|
||||
#define DN_HardAssertF(expr, fmt, ...) \
|
||||
do { \
|
||||
if (!(expr)) { \
|
||||
DN_Str8 stack_trace_ = DN_StackTrace_WalkStr8FromHeap(128 /*limit*/, 2 /*skip*/); \
|
||||
DN_Str8 stack_trace_ = DN_StackTraceWalkStr8FromHeap(128 /*limit*/, 2 /*skip*/); \
|
||||
DN_LOG_ErrorF("Hard assertion [" #expr "], stack trace was:\n\n%.*s\n\n" fmt, \
|
||||
DN_Str8PrintFmt(stack_trace_), \
|
||||
##__VA_ARGS__); \
|
||||
@@ -3300,7 +3364,7 @@ DN_API void DN_StackTrace_ReloadSymbols ();
|
||||
#define DN_AssertF(expr, fmt, ...) \
|
||||
do { \
|
||||
if (!(expr)) { \
|
||||
DN_Str8 stack_trace_ = DN_StackTrace_WalkStr8FromHeap(128 /*limit*/, 2 /*skip*/); \
|
||||
DN_Str8 stack_trace_ = DN_StackTraceWalkStr8FromHeap(128 /*limit*/, 2 /*skip*/); \
|
||||
DN_LOG_ErrorF("Assertion [" #expr "], stack trace was:\n\n%.*s\n\n" fmt, \
|
||||
DN_Str8PrintFmt(stack_trace_), \
|
||||
##__VA_ARGS__); \
|
||||
@@ -3313,7 +3377,7 @@ DN_API void DN_StackTrace_ReloadSymbols ();
|
||||
static bool once = true; \
|
||||
if (!(expr) && once) { \
|
||||
once = false; \
|
||||
DN_Str8 stack_trace_ = DN_StackTrace_WalkStr8FromHeap(128 /*limit*/, 2 /*skip*/); \
|
||||
DN_Str8 stack_trace_ = DN_StackTraceWalkStr8FromHeap(128 /*limit*/, 2 /*skip*/); \
|
||||
DN_LOG_ErrorF("Assertion [" #expr "], stack trace was:\n\n%.*s\n\n" fmt, \
|
||||
DN_Str8PrintFmt(stack_trace_), \
|
||||
##__VA_ARGS__); \
|
||||
@@ -3339,7 +3403,7 @@ DN_API void DN_StackTrace_ReloadSymbols ();
|
||||
((expr) ? true : (DN_LOG_WarningF(fmt, ##__VA_ARGS__), false))
|
||||
#else
|
||||
#define DN_CheckF(expr, fmt, ...) \
|
||||
((expr) ? true : (DN_LOG_ErrorF(fmt, ##__VA_ARGS__), DN_StackTrace_Print(128 /*limit*/), DN_DebugBreak, false))
|
||||
((expr) ? true : (DN_LOG_ErrorF(fmt, ##__VA_ARGS__), DN_StackTracePrint(128 /*limit*/), DN_DebugBreak, false))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -3913,6 +3977,51 @@ template <typename T> void DN_List_Ad
|
||||
template <typename T> DN_Slice<T> DN_List_ToSliceCopy (DN_List<T> const *list, DN_Arena* arena);
|
||||
#endif // !defined(DN_NO_LIST)
|
||||
#endif // !defined(DN_CONTAINER_H)
|
||||
// DN: Single header generator inlined this file => #include "Base/dn_base_leak.h"
|
||||
// DN: Single header generator commented out this header => #include "../dn_base_inc.h"
|
||||
|
||||
enum DN_LeakAllocFlag
|
||||
{
|
||||
DN_LeakAllocFlag_Freed = 1 << 0,
|
||||
DN_LeakAllocFlag_LeakPermitted = 1 << 1,
|
||||
};
|
||||
|
||||
struct DN_LeakAlloc
|
||||
{
|
||||
void *ptr; // 8 Pointer to the allocation being tracked
|
||||
DN_USize size; // 16 Size of the allocation
|
||||
DN_USize freed_size; // 24 Store the size of the allocation when it is freed
|
||||
DN_Str8 stack_trace; // 40 Stack trace at the point of allocation
|
||||
DN_Str8 freed_stack_trace; // 56 Stack trace of where the allocation was freed
|
||||
DN_U16 flags; // 72 Bit flags from `DN_LeakAllocFlag`
|
||||
};
|
||||
|
||||
// NOTE: We aim to keep the allocation record as light as possible as memory tracking can get
|
||||
// expensive. Enforce that there is no unexpected padding.
|
||||
DN_StaticAssert(sizeof(DN_LeakAlloc) == 64 || sizeof(DN_LeakAlloc) == 32); // NOTE: 64 bit vs 32 bit pointers respectively
|
||||
|
||||
struct DN_LeakTracker
|
||||
{
|
||||
DN_DSMap<DN_LeakAlloc> alloc_table;
|
||||
DN_TicketMutex alloc_table_mutex;
|
||||
DN_Arena alloc_table_arena;
|
||||
DN_U64 alloc_table_bytes_allocated_for_stack_traces;
|
||||
};
|
||||
|
||||
DN_API void DN_LeakTrackAlloc_ (DN_LeakTracker *leak, void *ptr, DN_USize size, bool alloc_can_leak);
|
||||
DN_API void DN_LeakTrackDealloc_(DN_LeakTracker *leak, void *ptr);
|
||||
DN_API void DN_LeakDump_ (DN_LeakTracker *leak);
|
||||
|
||||
#if defined(DN_LEAK_TRACKING)
|
||||
#define DN_LeakTrackAlloc(leak, ptr, size, alloc_can_leak) DN_LeakTrackAlloc_(leak, ptr, size, alloc_can_leak)
|
||||
#define DN_LeakTrackDealloc(leak, ptr) DN_LeakTrackDealloc_(leak, ptr)
|
||||
#define DN_LeakDump(leak) DN_LeakDump(leak);
|
||||
#else
|
||||
#define DN_LeakTrackAlloc(leak, ptr, size, alloc_can_leak) do { (void)ptr; (void)size; (void)alloc_can_leak; } while (0)
|
||||
#define DN_LeakTrackDealloc(leak, ptr) do { (void)ptr; } while (0)
|
||||
#define DN_LeakDump(leak) do { } while (0)
|
||||
#endif
|
||||
|
||||
|
||||
#endif // !defined(DN_BASE_INC_H)
|
||||
#if !defined(DN_OS_INC_H)
|
||||
@@ -5816,14 +5925,6 @@ struct DN_OSHttpResponse
|
||||
#endif
|
||||
};
|
||||
|
||||
struct DN_OSInitArgs
|
||||
{
|
||||
DN_U64 tls_reserve;
|
||||
DN_U64 tls_commit;
|
||||
DN_U64 tls_err_sink_reserve;
|
||||
DN_U64 tls_err_sink_commit;
|
||||
};
|
||||
|
||||
struct DN_OSCore
|
||||
{
|
||||
DN_CPUReport cpu_report;
|
||||
@@ -5862,7 +5963,6 @@ struct DN_OSDiskSpace
|
||||
DN_U64 size;
|
||||
};
|
||||
|
||||
DN_API void DN_OS_Init (DN_OSCore *os, DN_OSInitArgs *args);
|
||||
DN_API void DN_OS_EmitLogsWithOSPrintFunctions (DN_OSCore *os);
|
||||
DN_API void DN_OS_DumpThreadContextArenaStat (DN_Str8 file_path);
|
||||
|
||||
@@ -6205,146 +6305,42 @@ DN_API DN_Slice<DN_Str8> DN_Str8BuilderBuildSliceFromTLS (DN_Str8Bui
|
||||
#endif // !defined(DN_OS_STRING_H)
|
||||
|
||||
#endif // DN_OS_INC_H
|
||||
#if !defined(DN_CORE_INC_H)
|
||||
#define DN_CORE_INC_H
|
||||
#if !defined(DN_INC_H)
|
||||
#define DN_INC_H
|
||||
|
||||
// DN: Single header generator inlined this file => #include "Core/dn_core_debug.h"
|
||||
#if !defined(DN_CORE_DEBUG_H)
|
||||
#define DN_CORE_DEBUG_H
|
||||
|
||||
// DN: Single header generator commented out this header => #include "../dn_base_inc.h"
|
||||
|
||||
// NOTE: DN_Debug
|
||||
enum DN_DebugAllocFlag
|
||||
{
|
||||
DN_DebugAllocFlag_Freed = 1 << 0,
|
||||
DN_DebugAllocFlag_LeakPermitted = 1 << 1,
|
||||
};
|
||||
|
||||
struct DN_DebugAlloc
|
||||
{
|
||||
void *ptr; // 8 Pointer to the allocation being tracked
|
||||
DN_USize size; // 16 Size of the allocation
|
||||
DN_USize freed_size; // 24 Store the size of the allocation when it is freed
|
||||
DN_Str8 stack_trace; // 40 Stack trace at the point of allocation
|
||||
DN_Str8 freed_stack_trace; // 56 Stack trace of where the allocation was freed
|
||||
DN_U16 flags; // 72 Bit flags from `DN_DebugAllocFlag`
|
||||
};
|
||||
|
||||
static_assert(sizeof(DN_DebugAlloc) == 64 || sizeof(DN_DebugAlloc) == 32, // NOTE: 64 bit vs 32 bit pointers respectively
|
||||
"We aim to keep the allocation record as light as possible as "
|
||||
"memory tracking can get expensive. Enforce that there is no "
|
||||
"unexpected padding.");
|
||||
|
||||
// NOTE: DN_Profiler
|
||||
struct DN_ProfilerAnchor
|
||||
{
|
||||
// Inclusive refers to the time spent to complete the function call
|
||||
// including all children functions.
|
||||
//
|
||||
// Exclusive refers to the time spent in the function, not including any
|
||||
// time spent in children functions that we call that are also being
|
||||
// profiled. If we recursively call into ourselves, the time we spent in
|
||||
// our function is accumulated.
|
||||
DN_U64 tsc_inclusive;
|
||||
DN_U64 tsc_exclusive;
|
||||
DN_U16 hit_count;
|
||||
DN_Str8 name;
|
||||
};
|
||||
|
||||
struct DN_ProfilerZone
|
||||
{
|
||||
DN_U16 anchor_index;
|
||||
DN_U64 begin_tsc;
|
||||
DN_U16 parent_zone;
|
||||
DN_U64 elapsed_tsc_at_zone_start;
|
||||
};
|
||||
|
||||
struct DN_ProfilerAnchorArray
|
||||
{
|
||||
DN_ProfilerAnchor *data;
|
||||
DN_USize count;
|
||||
};
|
||||
|
||||
enum DN_ProfilerTSC
|
||||
{
|
||||
DN_ProfilerTSC_RDTSC,
|
||||
DN_ProfilerTSC_OSPerformanceCounter,
|
||||
};
|
||||
|
||||
struct DN_Profiler
|
||||
{
|
||||
DN_USize frame_index;
|
||||
DN_ProfilerAnchor *anchors;
|
||||
DN_USize anchors_count;
|
||||
DN_USize anchors_per_frame;
|
||||
DN_U16 parent_zone;
|
||||
bool paused;
|
||||
DN_ProfilerTSC tsc;
|
||||
DN_U64 tsc_frequency;
|
||||
DN_ProfilerZone frame_zone;
|
||||
DN_F64 frame_avg_tsc;
|
||||
};
|
||||
|
||||
#define DN_Profiler_ZoneLoop(prof, name, index) \
|
||||
DN_ProfilerZone DN_UniqueName(zone_) = DN_Profiler_BeginZone(prof, DN_Str8Lit(name), index), DN_UniqueName(dummy_) = {}; \
|
||||
DN_UniqueName(dummy_).begin_tsc == 0; \
|
||||
DN_Profiler_EndZone(prof, DN_UniqueName(zone_)), DN_UniqueName(dummy_).begin_tsc = 1
|
||||
|
||||
#define DN_Profiler_ZoneLoopAuto(prof, name) DN_Profiler_ZoneLoop(prof, name, __COUNTER__ + 1)
|
||||
|
||||
DN_API DN_Profiler DN_Profiler_Init (DN_ProfilerAnchor *anchors, DN_USize count, DN_USize anchors_per_frame, DN_ProfilerTSC tsc, DN_U64 tsc_frequency);
|
||||
DN_API DN_ProfilerZone DN_Profiler_BeginZone (DN_Profiler *profiler, DN_Str8 name, DN_U16 anchor_index);
|
||||
#define DN_Profiler_BeginZoneAuto(prof, name) DN_Profiler_BeginZone(prof, DN_Str8Lit(name), __COUNTER__ + 1)
|
||||
DN_API void DN_Profiler_EndZone (DN_Profiler *profiler, DN_ProfilerZone zone);
|
||||
DN_API DN_USize DN_Profiler_FrameCount (DN_Profiler const *profiler);
|
||||
DN_API DN_ProfilerAnchorArray DN_Profiler_FrameAnchorsFromIndex (DN_Profiler *profiler, DN_USize frame_index);
|
||||
DN_API DN_ProfilerAnchorArray DN_Profiler_FrameAnchors (DN_Profiler *profiler);
|
||||
DN_API void DN_Profiler_NewFrame (DN_Profiler *profiler);
|
||||
DN_API void DN_Profiler_Dump (DN_Profiler *profiler);
|
||||
DN_API DN_F64 DN_Profiler_SecFromTSC (DN_Profiler *profiler, DN_U64 duration_tsc);
|
||||
DN_API DN_F64 DN_Profiler_MsFromTSC (DN_Profiler *profiler, DN_U64 duration_tsc);
|
||||
|
||||
|
||||
#if defined(DN_LEAK_TRACKING)
|
||||
DN_API void DN_DBGTrackAlloc (void *ptr, DN_USize size, bool alloc_can_leak);
|
||||
DN_API void DN_DBGTrackDealloc (void *ptr);
|
||||
DN_API void DN_DBGDumpLeaks ();
|
||||
#else
|
||||
#define DN_DBGTrackAlloc(ptr, size, alloc_can_leak) do { (void)ptr; (void)size; (void)alloc_can_leak; } while (0)
|
||||
#define DN_DBGTrackDealloc(ptr) do { (void)ptr; } while (0)
|
||||
#define DN_DBGDumpLeaks() do { } while (0)
|
||||
#endif
|
||||
#endif // DN_CORE_DEBUG_H
|
||||
// DN: Single header generator inlined this file => #include "Core/dn_core.h"
|
||||
#if !defined(DN_CORE_H)
|
||||
#define DN_CORE_H
|
||||
|
||||
// NOTE: DN_Core
|
||||
struct DN_Core
|
||||
{
|
||||
// NOTE: Leak Tracing
|
||||
#if defined(DN_LEAK_TRACKING)
|
||||
DN_DSMap<DN_DebugAlloc> alloc_table;
|
||||
DN_TicketMutex alloc_table_mutex;
|
||||
DN_Arena alloc_table_arena;
|
||||
DN_USize mem_allocs_frame;
|
||||
DN_LeakTracker leak;
|
||||
#if defined(DN_OS_H)
|
||||
DN_OSCore os;
|
||||
#endif
|
||||
DN_U64 alloc_table_bytes_allocated_for_stack_traces;
|
||||
};
|
||||
|
||||
enum DN_CoreOnInit
|
||||
struct DN_InitArgs
|
||||
{
|
||||
DN_CoreOnInit_Nil = 0,
|
||||
DN_CoreOnInit_LogLibFeatures = 1 << 0,
|
||||
DN_CoreOnInit_LogCPUFeatures = 1 << 1,
|
||||
DN_CoreOnInit_LogAllFeatures = DN_CoreOnInit_LogLibFeatures | DN_CoreOnInit_LogCPUFeatures,
|
||||
DN_U64 os_tls_reserve;
|
||||
DN_U64 os_tls_commit;
|
||||
DN_U64 os_tls_err_sink_reserve;
|
||||
DN_U64 os_tls_err_sink_commit;
|
||||
};
|
||||
|
||||
DN_API void DN_Core_Init (DN_Core *core, DN_CoreOnInit on_init);
|
||||
DN_API void DN_Core_BeginFrame();
|
||||
#endif // !defined(DN_CORE_H)
|
||||
typedef DN_USize DN_InitFlags;
|
||||
enum DN_InitFlags_
|
||||
{
|
||||
DN_InitFlags_Nil = 0,
|
||||
DN_InitFlags_OS = 1 << 0,
|
||||
DN_InitFlags_LogLibFeatures = 1 << 1,
|
||||
DN_InitFlags_LogCPUFeatures = 1 << 2,
|
||||
DN_InitFlags_LogAllFeatures = DN_InitFlags_LogLibFeatures | DN_InitFlags_LogCPUFeatures,
|
||||
};
|
||||
|
||||
#endif // !defined(DN_CORE_INC_H)
|
||||
extern DN_Core *g_dn_;
|
||||
|
||||
DN_API void DN_Init(DN_Core *dn, DN_InitFlags flags, DN_InitArgs *args);
|
||||
DN_API void DN_BeginFrame();
|
||||
|
||||
#endif // !defined(DN_INC_H)
|
||||
#if !defined(DN_MATH_H)
|
||||
#define DN_MATH_H
|
||||
|
||||
|
||||
Reference in New Issue
Block a user