formatting
This commit is contained in:
parent
d2ef6273c9
commit
59e724f57a
47
.natvis
47
.natvis
@ -1,33 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
||||
|
||||
<Type Name = "v2">
|
||||
<Type Name = "Vec2">
|
||||
<DisplayString>({x}, {y})</DisplayString>
|
||||
</Type>
|
||||
|
||||
<Type Name = "string">
|
||||
<Type Name = "String">
|
||||
<DisplayString>({len}) {text, [len] s}</DisplayString>
|
||||
<StringView>text, [len] s</StringView>
|
||||
</Type>
|
||||
|
||||
<Type Name = "string16">
|
||||
<Type Name = "String16">
|
||||
<DisplayString>({len}) {text, [len] su}</DisplayString>
|
||||
<StringView>text, [len] su</StringView>
|
||||
</Type>
|
||||
|
||||
<Type Name = "arena">
|
||||
<Type Name = "Arena">
|
||||
<DisplayString>pos: {pos}, committed: [{committed} / {reserved}]</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="Data">base, [pos] s</Item>
|
||||
<Item Name="Data (Extended)">base, [pos+100] s</Item>
|
||||
<Item Name="Data">(((u8 *)this) + 64), [pos] s</Item>
|
||||
<Item Name="Data (Extended)">(((u8 *)this) + 64), [pos+100] s</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name = "arena_temp">
|
||||
<Type Name = "TempArena">
|
||||
<DisplayString>start: {start_pos}, arena: {{{*arena}}}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="Data">(arena->base + start_pos), [arena->pos - start_pos] s</Item>
|
||||
<Item Name="Data (Extended)">(arena->base + start_pos), [arena->pos - start_pos + 100] s</Item>
|
||||
<Item Name="Data">(((u8 *)arena) + start_pos + 64), [arena->pos - start_pos]</Item>
|
||||
<Item Name="Data (Extended)">(((u8 *)arena) + start_pos + 64), [arena->pos - start_pos + 100]</Item>
|
||||
<Item Name="Size">arena->pos - start_pos</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
@ -42,7 +42,7 @@
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name = "uid">
|
||||
<Type Name = "UID">
|
||||
<DisplayString>[{(u32)(hi >> 32), xb}]{((u32)(hi & 0xFFFFFFFF)), xb}{lo, xb}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="hi">hi, x</Item>
|
||||
@ -50,40 +50,17 @@
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name = "sim_ent_id">
|
||||
<Type Name = "EntityId">
|
||||
<DisplayString Condition="uid.hi == 0 && uid.lo == 0">[NIL]</DisplayString>
|
||||
<DisplayString Condition="uid.hi == 0x66a36cc2bcc752da && uid.lo == 0x6c286c09b366eae6">[ROOT]</DisplayString>
|
||||
<DisplayString>[{(u32)(uid.hi >> 32), xb}]</DisplayString>
|
||||
</Type>
|
||||
|
||||
<Type Name = "sim_ent">
|
||||
<Type Name = "Entity">
|
||||
<DisplayString Condition="(valid == 0 || (id.uid.hi == 0 && id.uid.lo == 0)) && this != *_g_sim_ent_nil">~~~MISMATCH~~~ {id} <{this - this->ss->ents}></DisplayString>
|
||||
<DisplayString Condition="valid == 1 && (id.uid.hi == 0 || id.uid.lo == 0)">~~~MISMATCH~~~ {id} <{this - this->ss->ents}></DisplayString>
|
||||
<DisplayString Condition="this == *_g_sim_ent_nil">{id}</DisplayString>
|
||||
<DisplayString>{id} <{this - this->ss->ents}></DisplayString>
|
||||
|
||||
</Type>
|
||||
|
||||
<Type Name = "String">
|
||||
<DisplayString>({len}) {text, [len] s}</DisplayString>
|
||||
<StringView>text, [len]</StringView>
|
||||
</Type>
|
||||
|
||||
<Type Name = "Arena">
|
||||
<DisplayString>pos: {pos}, committed: [{committed} / {reserved}]</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="Data">base, [pos] s</Item>
|
||||
<Item Name="Data (Extended)">base, [pos+100] s</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name = "TempArena">
|
||||
<DisplayString>start: {start_pos}, arena: {{{*arena}}}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="Data">(arena->base + start_pos), [arena->pos - start_pos] s</Item>
|
||||
<Item Name="Data (Extended)">(arena->base + start_pos), [arena->pos - start_pos + 100] s</Item>
|
||||
<Item Name="Size">arena->pos - start_pos</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
</AutoVisualizer>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
////////////////////////////////
|
||||
//~ Arena types
|
||||
|
||||
#define ArenaHeaderSize 256
|
||||
#define ArenaHeaderSize 64
|
||||
#define ArenaBlockSize 16384
|
||||
|
||||
Struct(Arena)
|
||||
@ -202,13 +202,13 @@ Inline TempArena _BeginScratch(Arena *potential_conflict)
|
||||
* exists in the caller's scope (`BeginScratch(arena)` should be called
|
||||
* instead). */
|
||||
#define BeginScratchNoConflict() \
|
||||
_BeginScratchNoConflict(); \
|
||||
BeginScratchNoConflict_(); \
|
||||
do { \
|
||||
u8 arena = 0; \
|
||||
LAX arena; \
|
||||
} while (0)
|
||||
|
||||
Inline TempArena _BeginScratchNoConflict(void)
|
||||
Inline TempArena BeginScratchNoConflict_(void)
|
||||
{
|
||||
ScratchCtx *ctx = ScratchCtxFromFiberId(FiberId());
|
||||
Arena *scratch_arena = ctx->arenas[0];
|
||||
|
||||
@ -143,7 +143,6 @@ extern "C" {
|
||||
((sizeof(s) / 4) == n) && /* Root constant struct size should match the specified 32-bit-constant count */ \
|
||||
(sizeof(s) <= 256)) /* Root constant struct can only fit 64 DWORDS */
|
||||
|
||||
|
||||
//- Debug alias
|
||||
/* TODO: Remove this */
|
||||
#if CompilerIsMsvc
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
////////////////////////////////
|
||||
//~ Font types
|
||||
|
||||
Struct(F_Glyph) {
|
||||
Struct(F_Glyph)
|
||||
{
|
||||
f32 off_x;
|
||||
f32 off_y;
|
||||
f32 width;
|
||||
@ -10,7 +11,8 @@ Struct(F_Glyph) {
|
||||
Rect atlas_rect;
|
||||
};
|
||||
|
||||
Struct(F_Font) {
|
||||
Struct(F_Font)
|
||||
{
|
||||
GPU_Resource *texture;
|
||||
u32 image_width;
|
||||
u32 image_height;
|
||||
@ -55,7 +57,7 @@ extern F_SharedState F_shared_state;
|
||||
////////////////////////////////
|
||||
//~ Startup
|
||||
|
||||
Struct(F_StartupReceipt) { i32 _; };
|
||||
Struct(F_StartupReceipt) { i32 _; };
|
||||
F_StartupReceipt F_Startup(AC_StartupReceipt *asset_cache_sr, TTF_StartupReceipt *ttf_sr);
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
@ -53,7 +53,7 @@ void P_RegisterLogCallback(P_LogEventCallbackFunc *func, i32 level)
|
||||
////////////////////////////////
|
||||
//~ Append
|
||||
|
||||
void P__LogAppend(String msg)
|
||||
void P_LogAppend_(String msg)
|
||||
{
|
||||
__prof;
|
||||
P_SharedLogCtx *ctx = &P_shared_log_ctx;
|
||||
@ -73,7 +73,7 @@ void P__LogAppend(String msg)
|
||||
|
||||
/* Panic log function is separate to enforce zero side effects other than
|
||||
* writing to log file. */
|
||||
void P__LogPanic(String msg)
|
||||
void P_LogPanic_(String msg)
|
||||
{
|
||||
P_SharedLogCtx *ctx = &P_shared_log_ctx;
|
||||
if (!Atomic32Fetch(&ctx->initialized)) { return; }
|
||||
@ -90,9 +90,9 @@ void P__LogPanic(String msg)
|
||||
//~ Logfv
|
||||
|
||||
#if P_IncludeLogSourceLocation
|
||||
void P__LogFV(i32 level, String file, u32 line, String fmt, va_list args)
|
||||
void P_LogFV_(i32 level, String file, u32 line, String fmt, va_list args)
|
||||
#else
|
||||
void P__LogFV(i32 level, String fmt, va_list args)
|
||||
void P_LogFV_(i32 level, String fmt, va_list args)
|
||||
#endif
|
||||
{
|
||||
P_SharedLogCtx *ctx = &P_shared_log_ctx;
|
||||
@ -100,9 +100,9 @@ void P__LogFV(i32 level, String fmt, va_list args)
|
||||
TempArena scratch = BeginScratchNoConflict();
|
||||
String msg = StringFormatV(scratch.arena, fmt, args);
|
||||
#if P_IncludeLogSourceLocation
|
||||
P__log(level, file, line, msg);
|
||||
P_Log_(level, file, line, msg);
|
||||
#else
|
||||
P__log(level, msg);
|
||||
P_Log_(level, msg);
|
||||
#endif
|
||||
EndScratch(scratch);
|
||||
}
|
||||
@ -111,9 +111,9 @@ void P__LogFV(i32 level, String fmt, va_list args)
|
||||
//~ Logf
|
||||
|
||||
#if P_IncludeLogSourceLocation
|
||||
void P__LogF(i32 level, String file, u32 line, String fmt, ...)
|
||||
void P_LogF_(i32 level, String file, u32 line, String fmt, ...)
|
||||
#else
|
||||
void P__LogF(i32 level, String fmt, ...)
|
||||
void P_LogF_(i32 level, String fmt, ...)
|
||||
#endif
|
||||
{
|
||||
P_SharedLogCtx *ctx = &P_shared_log_ctx;
|
||||
@ -121,9 +121,9 @@ void P__LogF(i32 level, String fmt, ...)
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
#if P_IncludeLogSourceLocation
|
||||
P__LogFV(level, file, line, fmt, args);
|
||||
P_LogFV_(level, file, line, fmt, args);
|
||||
#else
|
||||
P__LogFV(level, fmt, args);
|
||||
P_LogFV_(level, fmt, args);
|
||||
#endif
|
||||
va_end(args);
|
||||
}
|
||||
@ -132,9 +132,9 @@ void P__LogF(i32 level, String fmt, ...)
|
||||
//~ Log
|
||||
|
||||
#if P_IncludeLogSourceLocation
|
||||
void P__log(i32 level, String file, u32 line, String msg)
|
||||
void P_Log_(i32 level, String file, u32 line, String msg)
|
||||
#else
|
||||
void P__log(i32 level, String msg)
|
||||
void P_Log_(i32 level, String msg)
|
||||
#endif
|
||||
{
|
||||
__prof;
|
||||
@ -204,7 +204,7 @@ void P__log(i32 level, String msg)
|
||||
#endif
|
||||
|
||||
__profmsg((char *)msg.text, msg.len, settings.color);
|
||||
P__LogAppend(msg_formatted);
|
||||
P_LogAppend_(msg_formatted);
|
||||
|
||||
//- Run callbacks
|
||||
P_LogEvent event = ZI;
|
||||
|
||||
@ -122,15 +122,15 @@ void P_LogStartup(String logfile_path);
|
||||
////////////////////////////////
|
||||
//~ Logging macros
|
||||
|
||||
#define log_panic(msg) P__LogPanic(msg)
|
||||
#define log_panic(msg) P_LogPanic_(msg)
|
||||
|
||||
#if P_LogLevel(P_LogLevel_Critical)
|
||||
# if P_IncludeLogSourceLocation
|
||||
# define P_LogCritical(msg) P__log(P_LogLevel_Critical, Lit(__FILE__), __LINE__, msg)
|
||||
# define P_LogCriticalF(fmt_lit, ...) P__LogF(P_LogLevel_Critical, Lit(__FILE__), __LINE__, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# define P_LogCritical(msg) P_Log_(P_LogLevel_Critical, Lit(__FILE__), __LINE__, msg)
|
||||
# define P_LogCriticalF(fmt_lit, ...) P_LogF_(P_LogLevel_Critical, Lit(__FILE__), __LINE__, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# else
|
||||
# define P_LogCritical(msg) P__log(P_LogLevel_Critical, msg)
|
||||
# define P_LogCriticalF(fmt_lit, ...) P__LogF(P_LogLevel_Critical, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# define P_LogCritical(msg) P_Log_(P_LogLevel_Critical, msg)
|
||||
# define P_LogCriticalF(fmt_lit, ...) P_LogF_(P_LogLevel_Critical, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# endif
|
||||
#else
|
||||
# define P_LogCritical(msg)
|
||||
@ -139,11 +139,11 @@ void P_LogStartup(String logfile_path);
|
||||
|
||||
#if P_LogLevel(P_LogLevel_Error)
|
||||
# if P_IncludeLogSourceLocation
|
||||
# define P_LogError(msg) P__log(P_LogLevel_Error, Lit(__FILE__), __LINE__, msg)
|
||||
# define P_LogErrorF(fmt_lit, ...) P__LogF(P_LogLevel_Error, Lit(__FILE__), __LINE__, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# define P_LogError(msg) P_Log_(P_LogLevel_Error, Lit(__FILE__), __LINE__, msg)
|
||||
# define P_LogErrorF(fmt_lit, ...) P_LogF_(P_LogLevel_Error, Lit(__FILE__), __LINE__, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# else
|
||||
# define P_LogError(msg) P__log(P_LogLevel_Error, msg)
|
||||
# define P_LogErrorF(fmt_lit, ...) P__LogF(P_LogLevel_Error, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# define P_LogError(msg) P_Log_(P_LogLevel_Error, msg)
|
||||
# define P_LogErrorF(fmt_lit, ...) P_LogF_(P_LogLevel_Error, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# endif
|
||||
#else
|
||||
# define P_LogError(msg)
|
||||
@ -152,11 +152,11 @@ void P_LogStartup(String logfile_path);
|
||||
|
||||
#if P_LogLevel(P_LogLevel_Warning)
|
||||
# if P_IncludeLogSourceLocation
|
||||
# define P_LogWarning(msg) P__log(P_LogLevel_Warning, Lit(__FILE__), __LINE__, msg)
|
||||
# define P_LogWarningF(fmt_lit, ...) P__LogF(P_LogLevel_Warning, Lit(__FILE__), __LINE__, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# define P_LogWarning(msg) P_Log_(P_LogLevel_Warning, Lit(__FILE__), __LINE__, msg)
|
||||
# define P_LogWarningF(fmt_lit, ...) P_LogF_(P_LogLevel_Warning, Lit(__FILE__), __LINE__, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# else
|
||||
# define P_LogWarning(msg) P__log(P_LogLevel_Warning, msg)
|
||||
# define P_LogWarningF(fmt_lit, ...) P__LogF(P_LogLevel_Warning, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# define P_LogWarning(msg) P_Log_(P_LogLevel_Warning, msg)
|
||||
# define P_LogWarningF(fmt_lit, ...) P_LogF_(P_LogLevel_Warning, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# endif
|
||||
#else
|
||||
# define P_LogWarning(msg)
|
||||
@ -165,11 +165,11 @@ void P_LogStartup(String logfile_path);
|
||||
|
||||
#if P_LogLevel(P_LogLevel_Success)
|
||||
# if P_IncludeLogSourceLocation
|
||||
# define P_LogSuccess(msg) P__log(P_LogLevel_Success, Lit(__FILE__), __LINE__, msg)
|
||||
# define P_LogSuccessF(fmt_lit, ...) P__LogF(P_LogLevel_Success, Lit(__FILE__), __LINE__, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# define P_LogSuccess(msg) P_Log_(P_LogLevel_Success, Lit(__FILE__), __LINE__, msg)
|
||||
# define P_LogSuccessF(fmt_lit, ...) P_LogF_(P_LogLevel_Success, Lit(__FILE__), __LINE__, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# else
|
||||
# define P_LogSuccess(msg) P__log(P_LogLevel_Success, msg)
|
||||
# define P_LogSuccessF(fmt_lit, ...) P__LogF(P_LogLevel_Success, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# define P_LogSuccess(msg) P_Log_(P_LogLevel_Success, msg)
|
||||
# define P_LogSuccessF(fmt_lit, ...) P_LogF_(P_LogLevel_Success, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# endif
|
||||
#else
|
||||
# define P_LogSuccess(msg)
|
||||
@ -178,11 +178,11 @@ void P_LogStartup(String logfile_path);
|
||||
|
||||
#if P_LogLevel(P_LogLevel_Info)
|
||||
# if P_IncludeLogSourceLocation
|
||||
# define P_LogInfo(msg) P__log(P_LogLevel_Info, Lit(__FILE__), __LINE__, msg)
|
||||
# define P_LogInfoF(fmt_lit, ...) P__LogF(P_LogLevel_Info, Lit(__FILE__), __LINE__, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# define P_LogInfo(msg) P_Log_(P_LogLevel_Info, Lit(__FILE__), __LINE__, msg)
|
||||
# define P_LogInfoF(fmt_lit, ...) P_LogF_(P_LogLevel_Info, Lit(__FILE__), __LINE__, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# else
|
||||
# define P_LogInfo(msg) P__log(P_LogLevel_Info, msg)
|
||||
# define P_LogInfoF(fmt_lit, ...) P__LogF(P_LogLevel_Info, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# define P_LogInfo(msg) P_Log_(P_LogLevel_Info, msg)
|
||||
# define P_LogInfoF(fmt_lit, ...) P_LogF_(P_LogLevel_Info, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# endif
|
||||
#else
|
||||
# define P_LogInfo(msg)
|
||||
@ -191,11 +191,11 @@ void P_LogStartup(String logfile_path);
|
||||
|
||||
#if P_LogLevel(P_LogLevel_Debug)
|
||||
# if P_IncludeLogSourceLocation
|
||||
# define P_LogDebug(msg) P__log(P_LogLevel_Debug, Lit(__FILE__), __LINE__, msg)
|
||||
# define P_LogDebugF(fmt_lit, ...) P__LogF(P_LogLevel_Debug, Lit(__FILE__), __LINE__, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# define P_LogDebug(msg) P_Log_(P_LogLevel_Debug, Lit(__FILE__), __LINE__, msg)
|
||||
# define P_LogDebugF(fmt_lit, ...) P_LogF_(P_LogLevel_Debug, Lit(__FILE__), __LINE__, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# else
|
||||
# define P_LogDebug(msg) P__log(P_LogLevel_Debug, msg)
|
||||
# define P_LogDebugF(fmt_lit, ...) P__LogF(P_LogLevel_Debug, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# define P_LogDebug(msg) P_Log_(P_LogLevel_Debug, msg)
|
||||
# define P_LogDebugF(fmt_lit, ...) P_LogF_(P_LogLevel_Debug, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||
# endif
|
||||
#else
|
||||
# define P_LogDebug(msg)
|
||||
@ -212,23 +212,23 @@ void P_RegisterLogCallback(P_LogEventCallbackFunc *func, i32 level);
|
||||
|
||||
/* NOTE: Calling these functions rather than using the logging macros may result in logs that are compiled regardless of log level. */
|
||||
|
||||
void P__LogAppend(String msg);
|
||||
void P__LogPanic(String msg);
|
||||
void P_LogAppend_(String msg);
|
||||
void P_LogPanic_(String msg);
|
||||
|
||||
#if P_IncludeLogSourceLocation
|
||||
void P__LogFV(i32 level, String file, u32 line, String fmt, va_list args);
|
||||
void P_LogFV_(i32 level, String file, u32 line, String fmt, va_list args);
|
||||
#else
|
||||
void P__LogFV(i32 level, String fmt, va_list args);
|
||||
void P_LogFV_(i32 level, String fmt, va_list args);
|
||||
#endif
|
||||
|
||||
#if P_IncludeLogSourceLocation
|
||||
void P__LogF(i32 level, String file, u32 line, String fmt, ...);
|
||||
void P_LogF_(i32 level, String file, u32 line, String fmt, ...);
|
||||
#else
|
||||
void P__LogF(i32 level, String fmt, ...);
|
||||
void P_LogF_(i32 level, String fmt, ...);
|
||||
#endif
|
||||
|
||||
#if P_IncludeLogSourceLocation
|
||||
void P__log(i32 level, String file, u32 line, String msg);
|
||||
void P_Log_(i32 level, String file, u32 line, String msg);
|
||||
#else
|
||||
void P__log(i32 level, String msg);
|
||||
void P_Log_(i32 level, String msg);
|
||||
#endif
|
||||
|
||||
@ -782,7 +782,7 @@ P_W32_ThreadDef(P_W32_JobWorkerEntryFunc, worker_ctx_arg)
|
||||
b32 shutdown = 0;
|
||||
while (!shutdown)
|
||||
{
|
||||
/* Pull job from queue */
|
||||
//- Pull job from queue
|
||||
P_Priority job_priority = 0;
|
||||
i16 job_fiber_id = 0;
|
||||
i32 job_id = 0;
|
||||
@ -851,7 +851,7 @@ P_W32_ThreadDef(P_W32_JobWorkerEntryFunc, worker_ctx_arg)
|
||||
}
|
||||
}
|
||||
|
||||
/* Use resumed fiber if present */
|
||||
//- Release old fiber if resuming a yielded fiber
|
||||
if (job_fiber_id > 0)
|
||||
{
|
||||
if (job_fiber)
|
||||
@ -861,7 +861,7 @@ P_W32_ThreadDef(P_W32_JobWorkerEntryFunc, worker_ctx_arg)
|
||||
job_fiber = P_W32_FiberFromId(job_fiber_id);
|
||||
}
|
||||
|
||||
/* Run fiber */
|
||||
//- Run fiber
|
||||
if (job_func)
|
||||
{
|
||||
if (!job_fiber)
|
||||
@ -895,6 +895,7 @@ P_W32_ThreadDef(P_W32_JobWorkerEntryFunc, worker_ctx_arg)
|
||||
EndScratch(scratch);
|
||||
} break;
|
||||
|
||||
//- Fiber is waiting
|
||||
case P_W32_YieldKind_Wait:
|
||||
{
|
||||
__profn("Process fiber wait");
|
||||
@ -919,6 +920,7 @@ P_W32_ThreadDef(P_W32_JobWorkerEntryFunc, worker_ctx_arg)
|
||||
{
|
||||
if (wait_time != 0) P_W32_LockTicketMutex(&wait_time_bin->lock);
|
||||
{
|
||||
//- Load and compare value at address now that wait bins are locked
|
||||
b32 cancel_wait = wait_addr == 0 && wait_time == 0;
|
||||
if (wait_addr != 0)
|
||||
{
|
||||
@ -939,7 +941,7 @@ P_W32_ThreadDef(P_W32_JobWorkerEntryFunc, worker_ctx_arg)
|
||||
{
|
||||
if (wait_addr != 0)
|
||||
{
|
||||
/* Search for wait addr list in bin */
|
||||
//- Search for wait addr list in bin
|
||||
P_W32_WaitList *wait_addr_list = 0;
|
||||
for (P_W32_WaitList *tmp = wait_addr_bin->first_wait_list; tmp && !wait_addr_list; tmp = tmp->next_in_bin)
|
||||
{
|
||||
@ -948,7 +950,7 @@ P_W32_ThreadDef(P_W32_JobWorkerEntryFunc, worker_ctx_arg)
|
||||
wait_addr_list = tmp;
|
||||
}
|
||||
}
|
||||
/* Allocate new wait addr list */
|
||||
//- Allocate new wait addr list
|
||||
if (!wait_addr_list)
|
||||
{
|
||||
if (wait_addr_bin->first_free_wait_list)
|
||||
@ -977,7 +979,7 @@ P_W32_ThreadDef(P_W32_JobWorkerEntryFunc, worker_ctx_arg)
|
||||
}
|
||||
wait_addr_bin->last_wait_list = wait_addr_list;
|
||||
}
|
||||
/* Insert fiber into wait addr list */
|
||||
//- Insert fiber into wait addr list
|
||||
job_fiber->wait_addr = (u64)wait_addr;
|
||||
if (wait_addr_list->last_waiter)
|
||||
{
|
||||
@ -993,7 +995,7 @@ P_W32_ThreadDef(P_W32_JobWorkerEntryFunc, worker_ctx_arg)
|
||||
}
|
||||
if (wait_time != 0)
|
||||
{
|
||||
/* Search for wait time list in bin */
|
||||
//- Search for wait time list in bin
|
||||
P_W32_WaitList *wait_time_list = 0;
|
||||
for (P_W32_WaitList *tmp = wait_time_bin->first_wait_list; tmp && !wait_time_list; tmp = tmp->next_in_bin)
|
||||
{
|
||||
@ -1002,7 +1004,7 @@ P_W32_ThreadDef(P_W32_JobWorkerEntryFunc, worker_ctx_arg)
|
||||
wait_time_list = tmp;
|
||||
}
|
||||
}
|
||||
/* Allocate new wait time list */
|
||||
//- Allocate new wait time list
|
||||
if (!wait_time_list)
|
||||
{
|
||||
if (wait_time_bin->first_free_wait_list)
|
||||
@ -1031,7 +1033,7 @@ P_W32_ThreadDef(P_W32_JobWorkerEntryFunc, worker_ctx_arg)
|
||||
}
|
||||
wait_time_bin->last_wait_list = wait_time_list;
|
||||
}
|
||||
/* Insert fiber into wait time list */
|
||||
//- Insert fiber into wait time list
|
||||
job_fiber->wait_time = wait_time;
|
||||
if (wait_time_list->last_waiter)
|
||||
{
|
||||
@ -1046,7 +1048,7 @@ P_W32_ThreadDef(P_W32_JobWorkerEntryFunc, worker_ctx_arg)
|
||||
++wait_time_list->num_waiters;
|
||||
}
|
||||
|
||||
/* PopStruct worker's job fiber */
|
||||
//- PopStruct worker's job fiber
|
||||
job_fiber = 0;
|
||||
done = 1;
|
||||
}
|
||||
@ -1056,6 +1058,7 @@ P_W32_ThreadDef(P_W32_JobWorkerEntryFunc, worker_ctx_arg)
|
||||
if (wait_addr != 0) P_W32_UnlockTicketMutex(&wait_addr_bin->lock);
|
||||
} break;
|
||||
|
||||
//- Fiber is finished
|
||||
case P_W32_YieldKind_Done:
|
||||
{
|
||||
done = 1;
|
||||
@ -1065,7 +1068,7 @@ P_W32_ThreadDef(P_W32_JobWorkerEntryFunc, worker_ctx_arg)
|
||||
}
|
||||
}
|
||||
|
||||
/* Wait for job */
|
||||
//- Wait for job
|
||||
i64 num_jobs_in_queue = Atomic64Fetch(&pool->num_jobs_in_queue.v);
|
||||
shutdown = Atomic32Fetch(&pool->workers_shutdown.v);
|
||||
if (num_jobs_in_queue <= 0 && !shutdown)
|
||||
@ -1090,7 +1093,7 @@ P_W32_ThreadDef(P_W32_JobWorkerEntryFunc, worker_ctx_arg)
|
||||
}
|
||||
}
|
||||
|
||||
/* Worker shutdown */
|
||||
//- Worker shutdown
|
||||
if (job_fiber)
|
||||
{
|
||||
P_W32_ReleaseFiber(pool, job_fiber);
|
||||
|
||||
@ -80,7 +80,7 @@ P_ExitFuncDef(ShutdownUser)
|
||||
//~ Debug draw
|
||||
|
||||
//- Draw xform
|
||||
void DebugDrawXform(Xform xf, u32 color_x, u32 color_y)
|
||||
void DrawDebugXform(Xform xf, u32 color_x, u32 color_y)
|
||||
{
|
||||
SharedUserState *g = &shared_user_state;
|
||||
f32 thickness = 2.f;
|
||||
@ -104,7 +104,7 @@ void DebugDrawXform(Xform xf, u32 color_x, u32 color_y)
|
||||
}
|
||||
|
||||
//- Draw movement
|
||||
void DebugDrawMovement(Entity *ent)
|
||||
void DrawDebugMovement(Entity *ent)
|
||||
{
|
||||
SharedUserState *g = &shared_user_state;
|
||||
f32 thickness = 2.f;
|
||||
@ -135,7 +135,7 @@ String DebugStringFromEntity(Arena *arena, Entity *ent)
|
||||
String result = ZI;
|
||||
result.text = PushDry(arena, u8);
|
||||
|
||||
result.len += StringFormat(arena, Lit("[%F]"), FmtUid(ent->id.uid)).len;
|
||||
//result.len += StringFormat(arena, Lit("[%F]"), FmtUid(ent->id.uid)).len;
|
||||
{
|
||||
b32 transmitting = sim_ent_has_prop(ent, SEPROP_SYNC_SRC);
|
||||
b32 receiving = sim_ent_has_prop(ent, SEPROP_SYNC_DST);
|
||||
@ -263,7 +263,7 @@ P_LogEventCallbackFuncDef(ConsoleLogCallback, log)
|
||||
}
|
||||
|
||||
//- Draw console
|
||||
void DebugDrawConsole(i32 level, b32 minimized)
|
||||
void DrawDebugConsole(i32 level, b32 minimized)
|
||||
{
|
||||
__prof;
|
||||
SharedUserState *g = &shared_user_state;
|
||||
@ -1204,7 +1204,7 @@ void UpdateUser(P_Window *window)
|
||||
|
||||
if (sim_ent_has_prop(ent, SEPROP_KINEMATIC) || sim_ent_has_prop(ent, SEPROP_DYNAMIC))
|
||||
{
|
||||
DebugDrawMovement(ent);
|
||||
DrawDebugMovement(ent);
|
||||
}
|
||||
|
||||
/* Draw xform */
|
||||
@ -1212,7 +1212,7 @@ void UpdateUser(P_Window *window)
|
||||
{
|
||||
u32 color_x = Rgba32F(1, 0, 0, 0.5);
|
||||
u32 color_y = Rgba32F(0, 1, 0, 0.5);
|
||||
DebugDrawXform(xf, color_x, color_y);
|
||||
DrawDebugXform(xf, color_x, color_y);
|
||||
}
|
||||
|
||||
/* Draw AABB */
|
||||
@ -2026,11 +2026,11 @@ void UpdateUser(P_Window *window)
|
||||
#if DeveloperIsEnabled
|
||||
b32 console_minimized = !g->debug_console;
|
||||
i32 console_level = console_minimized ? P_LogLevel_Success : P_LogLevel_Debug;
|
||||
DebugDrawConsole(console_level, console_minimized);
|
||||
DrawDebugConsole(console_level, console_minimized);
|
||||
#else
|
||||
if (g->debug_draw)
|
||||
{
|
||||
DebugDrawConsole(P_LogLevel_Info, 0);
|
||||
DrawDebugConsole(P_LogLevel_Info, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -270,18 +270,18 @@ P_ExitFuncDef(ShutdownUser);
|
||||
////////////////////////////////
|
||||
//~ Debug draw operations
|
||||
|
||||
void DebugDrawXform(Xform xf, u32 color_x, u32 color_y);
|
||||
void DebugDrawMovement(Entity *ent);
|
||||
void DrawDebugXform(Xform xf, u32 color_x, u32 color_y);
|
||||
void DrawDebugMovement(Entity *ent);
|
||||
String DebugStringFromEntity(Arena *arena, Entity *ent);
|
||||
|
||||
////////////////////////////////
|
||||
//~ Console draw operations
|
||||
|
||||
P_LogEventCallbackFuncDef(ConsoleLogCallback, log);
|
||||
void DebugDrawConsole(i32 level, b32 minimized);
|
||||
void DrawDebugConsole(i32 level, b32 minimized);
|
||||
|
||||
////////////////////////////////
|
||||
//~ Entity sortign
|
||||
//~ Entity sorting
|
||||
|
||||
MergesortCompareFuncDef(EntitySortCmp, arg_a, arg_b, _);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user