specify platform name as argument for default downstream layer declarations

This commit is contained in:
jacob 2025-12-09 14:14:33 -06:00
parent a54b9c62c8
commit 7c1602e463
64 changed files with 423 additions and 249 deletions

View File

@ -1,7 +1,11 @@
@Layer ase
//////////////////////////////
//- Api
@IncludeC ase.h
//////////////////////////////
//- Impl
@IncludeC ase.c

View File

@ -666,6 +666,24 @@
};
#endif
////////////////////////////////////////////////////////////
//~ Arena types
#if IsLanguageC
Struct(Arena)
{
u64 pos;
u64 committed;
u64 reserved;
};
Struct(TempArena)
{
Arena *arena;
u64 start_pos;
};
#endif
////////////////////////////////////////////////////////////
//~ Resource types
@ -775,25 +793,43 @@ Struct(SamplerStateHandle) { u32 v; };
#endif
////////////////////////////////////////////////////////////
//~ @hookdecl Core api hooks
//~ @hookdecl Core api
#if IsLanguageC
//- Core hooks
StringList GetRawCommandline(void);
void Echo(String msg);
b32 Panic(String msg);
b32 IsRunningInDebugger(void);
i64 TimeNs(void);
u32 GetNumHardwareThreads(void);
void TrueRand(String buffer);
CpuTopologyInfo GetCpuTopologyInfo(void);
#endif
////////////////////////////////////////////////////////////
//~ @hookdecl Swap
#if IsLanguageC
b32 IsSwappedIn(void);
b32 IsSwappingOut(void);
String SwappedStateFromName(Arena *arena, String name);
void WriteSwappedState(String name, String data);
#endif
////////////////////////////////////////////////////////////
//~ @hookdecl Exit
#if IsLanguageC
void OnExit(ExitFunc *func);
void SignalExit(i32 code);
void ExitNow(i32 code);
#endif
////////////////////////////////////////////////////////////
//~ @hookdecl Bootstrap layers
//- Meta hooks
void StartupLayers(void);
#if IsLanguageC
void BootstrapLayers(void);
#endif
////////////////////////////////////////////////////////////

View File

@ -4,19 +4,6 @@
#define ArenaHeaderSize 256
#define ArenaBlockSize 16384
Struct(Arena)
{
u64 pos;
u64 committed;
u64 reserved;
};
Struct(TempArena)
{
Arena *arena;
u64 start_pos;
};
////////////////////////////////////////////////////////////
//~ State types

View File

@ -1,20 +0,0 @@
////////////////////////////////////////////////////////////
//~ @hookdecl Swap hooks
b32 IsSwappedIn(void);
b32 IsSwappingOut(void);
String SwappedStateFromName(Arena *arena, String name);
void WriteSwappedState(String name, String data);
////////////////////////////////////////////////////////////
//~ @hookdecl Exit hooks
void OnExit(ExitFunc *func);
void SignalExit(i32 code);
void ExitNow(i32 code);
////////////////////////////////////////////////////////////
//~ @hookdecl Application defined hooks
void Startup(void);

View File

@ -22,7 +22,6 @@
# include "base_math.h"
# include "base_rand.h"
# include "base_util.h"
# include "base_entry.h"
# include "base_bitbuff.h"
# include "base_resource.h"
# include "base_controller.h"

View File

@ -1,7 +1,7 @@
SharedResourceState shared_resource_state = ZI;
////////////////////////////////////////////////////////////
//~ Startup
//~ Bootstrap
void InitResourceSystem(u64 archive_strings_count, String *archive_strings)
{

View File

@ -31,7 +31,7 @@ Struct(SharedResourceState)
} extern shared_resource_state;
////////////////////////////////////////////////////////////
//~ Startup
//~ Bootstrap
void InitResourceSystem(u64 archive_strings_count, String *archive_strings);

View File

@ -36,7 +36,7 @@ BOOL W32_FindEmbeddedRcData(HMODULE module, LPCWSTR type, LPWSTR wstr_entry_name
}
////////////////////////////////////////////////////////////
//~ @hookimpl Core api hooks
//~ @hookimpl Core api
StringList GetRawCommandline(void)
{
@ -99,11 +99,6 @@ i64 TimeNs(void)
return result;
}
u32 GetNumHardwareThreads(void)
{
return GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
}
void TrueRand(String buffer)
{
BCryptGenRandom(BCRYPT_RNG_ALG_HANDLE, (u8 *)buffer.text, buffer.len, 0);
@ -171,7 +166,7 @@ CpuTopologyInfo GetCpuTopologyInfo(void)
}
////////////////////////////////////////////////////////////
//~ @hookimpl Swap hooks
//~ @hookimpl Swap
b32 IsSwappedIn(void)
{
@ -232,7 +227,7 @@ void WriteSwappedState(String name, String data)
}
////////////////////////////////////////////////////////////
//~ @hookimpl Exit hooks
//~ @hookimpl Exit
void OnExit(ExitFunc *func)
{
@ -307,29 +302,33 @@ i32 W32_Main(void)
g->raw_command_line = args_list;
}
/* Init command line */
//////////////////////////////
//- Bootstrap
/* Bootstrap command line */
InitCmdline();
/* Init log system */
/* Bootstrap log system */
/* FIXME: Remove hardcoded log path */
InitLogSystem(Lit("log.log"));
LogInfoF("Main thread ID: %F", FmtUint(ThreadId()));
/* Init resources */
/* Bootstrap resource system */
{
W32_FindEmbeddedDataCtx ctx = ZI;
EnumResourceNamesW(0, RT_RCDATA, &W32_FindEmbeddedRcData, (LONG_PTR)&ctx);
InitResourceSystem(ctx.embedded_strings_count, ctx.embedded_strings);
}
//- App startup
/* Startup layers */
/* Bootstrap layers */
if (!Atomic32Fetch(&g->panicking))
{
StartupLayers();
BootstrapLayers();
}
//////////////////////////////
//- Wait for exit signal
/* Wait for exit start or panic */
if (!Atomic32Fetch(&g->panicking))
{
@ -340,7 +339,8 @@ i32 W32_Main(void)
DWORD wake = WaitForMultipleObjects(countof(handles), handles, 0, INFINITE);
}
//- App shutdown
//////////////////////////////
//- Shutdown
/* Run exit callbacks */
if (!Atomic32Fetch(&g->panicking))

View File

@ -1,7 +1,11 @@
@Layer collider
//////////////////////////////
//- Api
@IncludeC collider.h
//////////////////////////////
//- Impl
@IncludeC collider.c

View File

@ -1,9 +1,9 @@
D_SharedState D_shared_state = ZI;
////////////////////////////////////////////////////////////
//~ Startup
//~ Bootstrap
void D_Startup(void)
void D_Bootstrap(void)
{
D_SharedState *g = &D_shared_state;
u32 pixel_white = 0xFFFFFFFF;

View File

@ -107,9 +107,9 @@ Struct(D_SharedState)
} extern D_shared_state;
////////////////////////////////////////////////////////////
//~ Startup
//~ Bootstrap
void D_Startup(void);
void D_Bootstrap(void);
////////////////////////////////////////////////////////////
//~ Material operations

View File

@ -1,17 +1,22 @@
@Layer draw
//////////////////////////////
//- Dependencies
@Dep base
@Dep gpu
@Dep sprite
@Dep font
@Dep collider
//////////////////////////////
//- Api
@IncludeC draw.h
//- Impl
@IncludeC draw.c
@Bootstrap D_Bootstrap
//- Init
@Startup D_Startup
//////////////////////////////
//- Impl
@IncludeC draw.c

View File

@ -1,11 +1,17 @@
@Layer glyph_cache
//////////////////////////////
//- Dependencies
@Dep ttf
@Dep gpu
//////////////////////////////
//- Api
@IncludeC glyph_cache.h
//////////////////////////////
//- Impl
@IncludeC glyph_cache.c

View File

@ -1,24 +1,30 @@
@Layer gpu
//////////////////////////////
//- Dependencies
@Dep platform
//////////////////////////////
//- Resources
@EmbedDir GPU_Resources gpu_res
//////////////////////////////
//- Api
@IncludeC gpu_core.h
@IncludeC gpu_shader_extras.cgh
@IncludeC gpu_common.h
@IncludeG gpu_shader_extras.cgh
@IncludeG gpu_shader_extras.gh
@Bootstrap GPU_Bootstrap
@Bootstrap GPU_BootstrapExtra
//////////////////////////////
//- Impl
@IncludeC gpu_common.c
//- Dx12 impl
@DefaultWindowsImpl gpu_dx12
//- Embeds
@EmbedDir GPU_Resources gpu_res
//- Startup
@Startup GPU_Startup
@Startup GPU_StartupExtra
@DefaultDownstream Win32 gpu_dx12

View File

@ -2,9 +2,9 @@ GPU_SharedUtilState GPU_shared_util_state = ZI;
ThreadLocal GPU_ArenaHandle GPU_t_perm_arena = ZI;
////////////////////////////////////////////////////////////
//~ Startup
//~ Bootstrap
void GPU_StartupExtra(void)
void GPU_BootstrapExtra(void)
{
GPU_SharedUtilState *g = &GPU_shared_util_state;

View File

@ -10,9 +10,9 @@ Struct(GPU_SharedUtilState)
extern ThreadLocal GPU_ArenaHandle GPU_t_perm_arena;
////////////////////////////////////////////////////////////
//~ Startup
//~ Bootstrap
void GPU_StartupExtra(void);
void GPU_BootstrapExtra(void);
////////////////////////////////////////////////////////////
//~ Helpers

View File

@ -502,9 +502,9 @@ Struct(GPU_Stats)
};
////////////////////////////////////////////////////////////
//~ @hookdecl Startup
//~ @hookdecl Bootstrap
void GPU_Startup(void);
void GPU_Bootstrap(void);
////////////////////////////////////////////////////////////
//~ @hookdecl Arena

View File

@ -1,9 +1,9 @@
GPU_D12_SharedState GPU_D12_shared_state = ZI;
////////////////////////////////////////////////////////////
//~ @hookimpl Startup
//~ @hookimpl Bootstrap
void GPU_Startup(void)
void GPU_Bootstrap(void)
{
GPU_D12_SharedState *g = &GPU_D12_shared_state;
TempArena scratch = BeginScratchNoConflict();

View File

@ -1,7 +1,11 @@
@Layer gpu_dx12
//////////////////////////////
//- Api
@IncludeC gpu_dx12.h
//////////////////////////////
//- Impl
@IncludeC gpu_dx12.c

View File

@ -1,10 +1,16 @@
@Layer json
//////////////////////////////
//- Dependencies
@Dep base
//////////////////////////////
//- Api
@IncludeC json_core.h
//////////////////////////////
//- Impl
@IncludeC json_core.c

View File

@ -58,7 +58,9 @@ LineCol LineColFromPos(String data, i64 pos)
String StringFromMetaErrors(Arena *arena, M_ErrorList errors)
{
String result = ZI;
TempArena scratch = BeginScratch(arena);
StringList error_strings = ZI;
for (M_Error *e = errors.first; e; e = e->next)
{
M_Token *token = e->token;
@ -79,18 +81,23 @@ String StringFromMetaErrors(Arena *arena, M_ErrorList errors)
{
line_col = LineColFromPos(token_file_data, token_pos);
}
result = StringF(arena,
String formatted = StringF(scratch.arena,
"%F:%F:%F: error: %F",
FmtString(token_file),
FmtSint(line_col.line),
FmtSint(line_col.col),
FmtString(e->msg));
PushStringToList(scratch.arena, &error_strings, formatted);
}
else
{
result = StringF(arena, "error: %F", FmtString(e->msg));
PushStringToList(scratch.arena, &error_strings, StringF(scratch.arena, "error: %F", FmtString(e->msg)));
}
}
String result = StringFromList(arena, error_strings, Lit("\n"));
EndScratch(scratch);
return result;
}
@ -465,7 +472,7 @@ void BuildEntryPoint(WaveLaneCtx *lane)
StringList c_store_lines = ZI;
StringList c_shader_lines = ZI;
StringList c_include_lines = ZI;
StringList c_startup_lines = ZI;
StringList c_bootstrap_lines = ZI;
{
for (M_Entry *entry = build.layers_parse.first; entry->valid; entry = entry->next)
{
@ -546,17 +553,17 @@ void BuildEntryPoint(WaveLaneCtx *lane)
M_PushError(perm, &build.c_parse.errors, entry_tok, Lit("Expected file name"));
}
} break;
case M_EntryKind_Startup:
case M_EntryKind_Bootstrap:
{
if (arg0_tok->valid)
{
String startup = arg0_tok->s;
String line = StringF(perm, " %F();", FmtString(startup));
PushStringToList(perm, &c_startup_lines, line);
String bootstrap = arg0_tok->s;
String line = StringF(perm, " %F();", FmtString(bootstrap));
PushStringToList(perm, &c_bootstrap_lines, line);
}
else
{
M_PushError(perm, &build.c_parse.errors, entry_tok, Lit("Expected startup function name"));
M_PushError(perm, &build.c_parse.errors, entry_tok, Lit("Expected bootstrap function name"));
}
} break;
}
@ -603,13 +610,13 @@ void BuildEntryPoint(WaveLaneCtx *lane)
PushStringToList(perm, &c_out_lines, n->s);
}
}
/* Define StartupLayers */
/* Define BootstrapLayers */
{
PushStringToList(perm, &c_out_lines, Lit(""));
PushStringToList(perm, &c_out_lines, Lit("//- Startup"));
PushStringToList(perm, &c_out_lines, Lit("void StartupLayers(void)"));
PushStringToList(perm, &c_out_lines, Lit("//- Bootstrap"));
PushStringToList(perm, &c_out_lines, Lit("void BootstrapLayers(void)"));
PushStringToList(perm, &c_out_lines, Lit("{"));
for (StringListNode *n = c_startup_lines.first; n; n = n->next)
for (StringListNode *n = c_bootstrap_lines.first; n; n = n->next)
{
PushStringToList(perm, &c_out_lines, n->s);
}
@ -998,11 +1005,11 @@ void BuildEntryPoint(WaveLaneCtx *lane)
}
////////////////////////////////////////////////////////////
//~ @hookimpl Startup
//~ @hookimpl Bootstrap layers
void StartupLayers(void)
void BootstrapLayers(void)
{
OS_Startup();
OS_Bootstrap();
CpuTopologyInfo cpu_info = GetCpuTopologyInfo();
i32 meta_lanes_count = cpu_info.num_logical_cores - 1;
DispatchWave(Lit("Meta"), MaxI32(meta_lanes_count, 1), BuildEntryPoint, 0);

View File

@ -464,37 +464,61 @@ M_Layer M_FlattenEntries(Arena *arena, M_LayerList unflattened, StringList start
{
state->is_entered = 1;
/* Push downstream impl enters to stack */
/* Push downstream impl entries to stack */
for (M_Entry *entry = layer->first; entry->valid; entry = entry->next)
{
b32 include = (IsPlatformWindows && entry->kind == M_EntryKind_DefaultWindowsImpl);
if (include)
if (entry->kind == M_EntryKind_DefaultDownstream)
{
M_Token *impl_token = entry->arg_tokens[0];
if (impl_token->valid)
M_Token *platform_token = entry->arg_tokens[0];
M_Token *downstream_layer_token = entry->arg_tokens[1];
if (platform_token->valid && downstream_layer_token->valid)
{
String impl_name = impl_token->s;
u64 hash = HashFnv64(Fnv64Basis, impl_name);
IterState *impl_layer_state = (IterState *)DictValueOrNilFromHash(layer_name_to_state, hash, (u64)&NilIterState);
M_Layer *impl_layer = impl_layer_state->layer;
if (impl_layer->valid)
/* Determine platform match */
b32 should_include = 0;
{
if (!impl_layer_state->is_exited)
String platform_name = platform_token->s;
if (MatchString(platform_name, Lit("Any")))
{
should_include = 1;
}
else if (MatchString(platform_name, Lit("Win32")))
{
should_include = IsPlatformWindows;
}
else
{
String err = StringF(arena, "Unknown platform \"%F\"", FmtString(platform_name));
M_PushError(arena, &result.errors, platform_token, err);
}
}
/* Include layer downstream */
if (should_include)
{
String downstream_layer_name = downstream_layer_token->s;
u64 hash = HashFnv64(Fnv64Basis, downstream_layer_name);
IterState *downstream_layer_state = (IterState *)DictValueOrNilFromHash(layer_name_to_state, hash, (u64)&NilIterState);
M_Layer *downstream_layer = downstream_layer_state->layer;
if (downstream_layer->valid)
{
if (!downstream_layer_state->is_exited)
{
StackNode *n = PushStruct(scratch.arena, StackNode);
n->state = impl_layer_state;
n->state = downstream_layer_state;
SllStackPush(stack, n);
}
}
else
{
String err = StringF(arena, "Layer \"%F\" not found", FmtString(impl_name));
M_PushError(arena, &result.errors, impl_token, err);
String err = StringF(arena, "Layer \"%F\" not found", FmtString(downstream_layer_name));
M_PushError(arena, &result.errors, downstream_layer_token, err);
}
}
}
else
{
M_PushError(arena, &result.errors, entry->name_token, Lit("Expected layer argument"));
M_PushError(arena, &result.errors, entry->name_token, Lit("Expected platform and layer arguments"));
}
}
}
@ -505,7 +529,7 @@ M_Layer M_FlattenEntries(Arena *arena, M_LayerList unflattened, StringList start
SllStackPush(stack, stack_node);
}
/* Push upstream dep enters to stack */
/* Push upstream dep entries to stack */
for (M_Entry *entry = layer->first; entry->valid; entry = entry->next)
{
if (entry->kind == M_EntryKind_Dep)

View File

@ -76,21 +76,27 @@ Enum(M_EntryKind)
M_EntryKind_Dep,
M_EntryKind_IncludeC,
M_EntryKind_IncludeG,
M_EntryKind_DefaultWindowsImpl,
M_EntryKind_Startup,
M_EntryKind_DefaultDownstream,
M_EntryKind_Bootstrap,
M_EntryKind_VertexShader,
M_EntryKind_PixelShader,
M_EntryKind_ComputeShader,
M_EntryKind_EmbedDir,
};
Enum(M_PlatformKind)
{
M_PlatformKind_Any,
M_PlatformKind_Win32,
};
Global Readonly char *M_entry_kind_rules[] = {
[M_EntryKind_Layer] = "@Layer",
[M_EntryKind_Dep] = "@Dep",
[M_EntryKind_IncludeC] = "@IncludeC",
[M_EntryKind_IncludeG] = "@IncludeG",
[M_EntryKind_DefaultWindowsImpl] = "@DefaultWindowsImpl",
[M_EntryKind_Startup] = "@Startup",
[M_EntryKind_DefaultDownstream] = "@DefaultDownstream",
[M_EntryKind_Bootstrap] = "@Bootstrap",
[M_EntryKind_VertexShader] = "@VertexShader",
[M_EntryKind_PixelShader] = "@PixelShader",
[M_EntryKind_ComputeShader] = "@ComputeShader",

View File

@ -24,9 +24,9 @@ Struct(OS_CommandResult)
};
////////////////////////////////////////////////////////////
//~ @hookdecl Startup hooks
//~ @hookdecl Bootstrap
void OS_Startup(void);
void OS_Bootstrap(void);
////////////////////////////////////////////////////////////
//~ @hookdecl File system operations

View File

@ -26,9 +26,9 @@ String W32_StringFromError(Arena *arena, DWORD err)
}
////////////////////////////////////////////////////////////
//~ @hookimpl Startup hook
//~ @hookimpl Bootstrap
void OS_Startup(void)
void OS_Bootstrap(void)
{
}

View File

@ -17,9 +17,9 @@
MIX_SharedState M_shared_state = ZI;
////////////////////////////////////////////////////////////
//~ Startup
//~ Bootstrap
void MIX_Startup(void)
void MIX_Bootstrap(void)
{
MIX_SharedState *g = &M_shared_state;
g->track_arena = AcquireArena(Gibi(64));

View File

@ -94,9 +94,9 @@ Struct(MIX_SharedState)
} extern M_shared_state;
////////////////////////////////////////////////////////////
//~ Startup
//~ Bootstrap
void MIX_Startup(void);
void MIX_Bootstrap(void);
////////////////////////////////////////////////////////////
//~ Track operations

View File

@ -1,14 +1,19 @@
@Layer mixer
//////////////////////////////
//- Dependencies
@Dep platform
@Dep sound
//////////////////////////////
//- Api
@IncludeC mixer.h
//- Impl
@IncludeC mixer.c
@Bootstrap MIX_Bootstrap
//- Startup
@Startup MIX_Startup
//////////////////////////////
//- Impl
@IncludeC mixer.c

View File

@ -1,7 +1,11 @@
@Layer mp3
//////////////////////////////
//- Api
@IncludeC mp3.h
//- Mmf impl
@DefaultWindowsImpl mp3_mmf
//////////////////////////////
//- Impl
@DefaultDownstream mp3_mmf

View File

@ -1,7 +1,11 @@
@Layer mp3_mmf
//////////////////////////////
//- Api
@IncludeC mp3_mmf.h
//////////////////////////////
//- Impl
@IncludeC mp3_mmf.c

View File

@ -1,10 +1,16 @@
@Layer net
//////////////////////////////
//- Dependencies
@Dep platform
//////////////////////////////
//- Api
@IncludeC net.h
//////////////////////////////
//- Impl
@IncludeC net.c

View File

@ -67,9 +67,9 @@ Enum(P_MessageBoxKind)
};
////////////////////////////////////////////////////////////
//~ @hookdecl Startup
//~ @hookdecl Bootstrap
void P_Startup(void);
void P_Bootstrap(void);
////////////////////////////////////////////////////////////
//~ @hookdecl File system hooks

View File

@ -1,10 +1,13 @@
@Layer platform
//////////////////////////////
//- Api
@IncludeC platform.h
//- Win32 impl
@DefaultWindowsImpl platform_win32
@Bootstrap P_Bootstrap
//- Startup
@Startup P_Startup
//////////////////////////////
//- Impl
@DefaultDownstream Win32 platform_win32

View File

@ -1,9 +1,9 @@
P_W32_SharedState P_W32_shared_state = ZI;
////////////////////////////////////////////////////////////
//~ @hookimpl Startup
//~ @hookimpl Bootstrap
void P_Startup(void)
void P_Bootstrap(void)
{
P_W32_SharedState *g = &P_W32_shared_state;

View File

@ -1,7 +1,11 @@
@Layer platform_win32
//////////////////////////////
//- Api
@IncludeC platform_win32.h
//////////////////////////////
//- Impl
@IncludeC platform_win32.c

View File

@ -1,3 +1,3 @@
#define PB_SampleRate 48000
void PB_Startup(void);
void PB_Bootstrap(void);

View File

@ -1,14 +1,19 @@
@Layer playback
//////////////////////////////
//- Dependencies
@Dep platform
@Dep mixer
//////////////////////////////
//- Api
@IncludeC playback.h
//- Wasapi impl
@DefaultWindowsImpl playback_wasapi
@Bootstrap PB_Bootstrap
//- Startup
@Startup PB_Startup
//////////////////////////////
//- Impl
@DefaultDownstream playback_wasapi

View File

@ -7,9 +7,9 @@
PB_WSP_SharedState PB_WSP_shared_state = ZI;
////////////////////////////////////////////////////////////
//~ Startup
//~ Bootstrap
void PB_Startup(void)
void PB_Bootstrap(void)
{
PB_WSP_SharedState *g = &PB_WSP_shared_state;
PB_WSP_InitializeWasapi();

View File

@ -1,7 +1,11 @@
@Layer playback_wasapi
//////////////////////////////
//- Api
@IncludeC playback_wasapi.h
//////////////////////////////
//- Impl
@IncludeC playback_wasapi.c

View File

@ -1,4 +1,7 @@
@Layer pp
//////////////////////////////
//- Dependencies
@Dep pp_sim
@Dep pp_vis

View File

@ -1,13 +1,18 @@
@Layer pp_sim
//////////////////////////////
//- Dependencies
@Dep platform
//////////////////////////////
//- Api
@IncludeC pp_sim_core.h
//- Impl
@IncludeC pp_sim_core.c
@Bootstrap S_Bootstrap
//- Startup
@Startup S_Startup
//////////////////////////////
//- Impl
@IncludeC pp_sim_core.c

View File

@ -7,9 +7,9 @@ Readonly S_Ent S_nil_ent = {
};
////////////////////////////////////////////////////////////
//~ Startup
//~ Bootstrap
void S_Startup(void)
void S_Bootstrap(void)
{
S_SharedState *shared = &S_shared_state;

View File

@ -242,9 +242,9 @@ Struct(S_SharedState)
} extern S_shared_state;
////////////////////////////////////////////////////////////
//~ Startup
//~ Bootstrap
void S_Startup(void);
void S_Bootstrap(void);
void S_Shutdown(void);
////////////////////////////////////////////////////////////

View File

@ -1,6 +1,8 @@
@Layer pp_vis
//////////////////////////////
//- Dependencies
@Dep gpu
@Dep glyph_cache
@Dep platform
@ -8,28 +10,32 @@
@Dep ui
@Dep pp_sim
//- Api
@IncludeC pp_vis_widgets.h
@IncludeC pp_vis_shaders.cgh
@IncludeC pp_vis_draw.h
@IncludeC pp_vis_core.h
@IncludeG pp_vis_shaders.cgh
//////////////////////////////
//- Resources
//- Impl
@IncludeC pp_vis_widgets.c
@IncludeC pp_vis_draw.c
@IncludeC pp_vis_core.c
@IncludeG pp_vis_shaders.g
//- Embeds
@EmbedDir V_Resources pp_vis_res
//- Shaders
@ComputeShader V_BackdropCS
@VertexShader V_DQuadVS
@PixelShader V_DQuadPS
@VertexShader V_DVertVS
@PixelShader V_DVertPS
//- Startup
@Startup V_Startup
//////////////////////////////
//- Api
@IncludeC pp_vis_widgets.h
@IncludeC pp_vis_shaders.cgh
@IncludeC pp_vis_draw.h
@IncludeC pp_vis_core.h
@IncludeG pp_vis_shaders.cgh
@Bootstrap V_Bootstrap
//////////////////////////////
//- Impl
@IncludeC pp_vis_widgets.c
@IncludeC pp_vis_draw.c
@IncludeC pp_vis_core.c
@IncludeG pp_vis_shaders.g

View File

@ -1,9 +1,9 @@
V_State V = ZI;
////////////////////////////////////////////////////////////
//~ Startup
//~ Bootstrap
void V_Startup(void)
void V_Bootstrap(void)
{
DispatchWave(Lit("Vis"), 1, V_TickForever, 0);
}

View File

@ -100,9 +100,9 @@ Struct(V_State)
} extern V;
////////////////////////////////////////////////////////////
//~ Startup
//~ Bootstrap
void V_Startup(void);
void V_Bootstrap(void);
void V_Shutdown(void);
////////////////////////////////////////////////////////////

View File

@ -1,6 +1,8 @@
@Layer pp_old
//////////////////////////////
//- Dependencies
@Dep gpu
@Dep sprite
@Dep font
@ -13,7 +15,19 @@
@Dep window
@Dep ui
//////////////////////////////
//- Resources
@EmbedDir PP_Resources pp_res
@VertexShader PP_MaterialVS
@PixelShader PP_MaterialPS
@ComputeShader PP_FloodCS
@ComputeShader PP_ShadeCS
//////////////////////////////
//- Api
@IncludeC pp_sim.h
@IncludeC pp_phys.h
@IncludeC pp_space.h
@ -24,7 +38,12 @@
@IncludeG pp_draw.cgh
@IncludeC pp.h
@Bootstrap PP_StartupSim
@Bootstrap PP_StartupUser
//////////////////////////////
//- Impl
@IncludeC pp_sim.c
@IncludeC pp_phys.c
@IncludeC pp_space.c
@ -33,16 +52,3 @@
@IncludeC pp_widgets.c
@IncludeC pp.c
@IncludeG pp_draw.g
//- Embeds
@EmbedDir PP_Resources pp_res
//- Shaders
@VertexShader PP_MaterialVS
@PixelShader PP_MaterialPS
@ComputeShader PP_FloodCS
@ComputeShader PP_ShadeCS
//- Startup
@Startup PP_StartupSim
@Startup PP_StartupUser

View File

@ -79,7 +79,7 @@ void PT_RunForever(WaveLaneCtx *lane)
}
}
void PT_Startup(void)
void PT_Bootstrap(void)
{
DispatchWave(Lit("Proto"), 1, PT_RunForever, 0);
}

View File

@ -1,22 +1,29 @@
@Layer proto
//////////////////////////////
//- Dependencies
@Dep gpu
@Dep window
@Dep ui
//- Api
@IncludeC proto_shaders.h
@IncludeG proto_shaders.h
//////////////////////////////
//- Resources
//- Impl
@IncludeC proto.c
@IncludeG proto_shaders.g
//- Shaders
@ComputeShader PT_TestCS
@VertexShader PT_BlitVS
@PixelShader PT_BlitPS
//- Startup
@Startup PT_Startup
//////////////////////////////
//- Api
@IncludeC proto_shaders.h
@IncludeG proto_shaders.h
@Bootstrap PT_Bootstrap
//////////////////////////////
//- Impl
@IncludeC proto.c
@IncludeG proto_shaders.g

View File

@ -1,12 +1,18 @@
@Layer settings
//////////////////////////////
//- Dependencies
@Dep base
@Dep platform
@Dep json
//////////////////////////////
//- Api
@IncludeC settings_core.h
//////////////////////////////
//- Impl
@IncludeC settings_core.c

View File

@ -1,12 +1,18 @@
@Layer sound
//////////////////////////////
//- Dependencies
@Dep platform
@Dep mp3
@Dep asset_cache
//////////////////////////////
//- Api
@IncludeC sound.h
//////////////////////////////
//- Impl
@IncludeC sound.c

View File

@ -1,11 +1,17 @@
@Layer sprite
//////////////////////////////
//- Dependencies
@Dep gpu
@Dep ase
//////////////////////////////
//- Api
@IncludeC sprite.h
//////////////////////////////
//- Impl
@IncludeC sprite.c

View File

@ -1,11 +1,17 @@
@Layer tar
//////////////////////////////
//- Dependencies
@Dep platform
@Dep bitbuff
//////////////////////////////
//- Api
@IncludeC tar.h
//////////////////////////////
//- Impl
@IncludeC tar.c

View File

@ -22,6 +22,6 @@ Struct(TTF_Decoded)
};
void TTF_Startup(void);
void TTF_Bootstrap(void);
TTF_Decoded TTF_Decode(Arena *arena, String encoded, f32 em_size, u32 *cache_codes, u32 cache_codes_count);

View File

@ -1,10 +1,13 @@
@Layer ttf
//////////////////////////////
//- Api
@IncludeC ttf.h
//- DirectWrite impl
@DefaultWindowsImpl ttf_dwrite
@Bootstrap TTF_Bootstrap
//- Startup
@Startup TTF_Startup
//////////////////////////////
//- Impl
@DefaultDownstream Win32 ttf_dwrite

View File

@ -4,10 +4,9 @@
TTF_DW_SharedState TTF_DW_shared_state = ZI;
////////////////////////////////////////////////////////////
//~ @hookimpl Startup
//~ @hookimpl Bootstrap
/* Call this during font system startup */
void TTF_Startup(void)
void TTF_Bootstrap(void)
{
TTF_DW_SharedState *g = &TTF_DW_shared_state;
Assert(!g->factory);
@ -15,18 +14,11 @@ void TTF_Startup(void)
* 10? Need to verify. Maybe should just use a custom loader. (We're only
* using a factory5 since I think WriteInMemoryFileLoader wasn't
* implemented until then) */
#if IsCompilerClang
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wlanguage-extension-token" /* for __uuidof */
#endif
HRESULT error = DWriteCreateFactory(
DWRITE_FACTORY_TYPE_SHARED,
&IID_IDWriteFactory5,
(void **)&g->factory
);
#if IsCompilerClang
# pragma clang diagnostic pop
#endif
if (error != S_OK)
{
Panic(Lit("Error creating DWrite factory"));

View File

@ -1,7 +1,11 @@
@Layer ttf_dwrite
//////////////////////////////
//- Api
@IncludeC ttf_dwrite.h
//////////////////////////////
//- Impl
@IncludeC ttf_dwrite.c

View File

@ -1,29 +1,35 @@
@Layer ui
//////////////////////////////
//- Dependencies
@Dep gpu
@Dep glyph_cache
@Dep window
//- Api
@IncludeC ui_core.h
@IncludeC ui_extras.h
@IncludeC ui_shaders.cgh
@IncludeG ui_shaders.cgh
//////////////////////////////
//- Resources
//- Impl
@IncludeC ui_core.c
@IncludeC ui_extras.c
@IncludeG ui_shaders.g
@EmbedDir UI_Resources ui_res
//- Shaders
@VertexShader UI_DRectVS
@PixelShader UI_DRectPS
@VertexShader UI_BlitVS
@PixelShader UI_BlitPS
//- Embeds
@EmbedDir UI_Resources ui_res
//////////////////////////////
//- Api
//- Startup
@Startup UI_Startup
@IncludeC ui_core.h
@IncludeC ui_extras.h
@IncludeC ui_shaders.cgh
@IncludeG ui_shaders.cgh
@Bootstrap UI_Bootstrap
//////////////////////////////
//- Impl
@IncludeC ui_core.c
@IncludeC ui_extras.c
@IncludeG ui_shaders.g

View File

@ -1,9 +1,9 @@
UI_State UI_state = ZI;
////////////////////////////////////////////////////////////
//~ Startup
//~ Bootstrap
void UI_Startup(void)
void UI_Bootstrap(void)
{
}

View File

@ -360,9 +360,9 @@ Struct(UI_State)
} extern UI_state;
////////////////////////////////////////////////////////////
//~ Startup
//~ Bootstrap
void UI_Startup(void);
void UI_Bootstrap(void);
////////////////////////////////////////////////////////////
//~ Font helpers

View File

@ -54,9 +54,9 @@ Struct(WND_Frame)
};
////////////////////////////////////////////////////////////
//~ @hookdecl Startup
//~ @hookdecl Bootstrap
void WND_Startup(void);
void WND_Bootstrap(void);
////////////////////////////////////////////////////////////
//~ @hookdecl Command

View File

@ -1,13 +1,18 @@
@Layer window
//////////////////////////////
//- Dependencies
@Dep gpu
//////////////////////////////
//- Api
@IncludeC window.h
//- Win32 impl
@DefaultWindowsImpl window_win32
@Bootstrap WND_Bootstrap
//- Startup
@Startup WND_Startup
//////////////////////////////
//- Impl
@DefaultDownstream Win32 window_win32

View File

@ -1,9 +1,9 @@
WND_W32_SharedState WND_W32_shared_state = ZI;
////////////////////////////////////////////////////////////
//~ @hookimpl Startup
//~ @hookimpl Bootstrap
void WND_Startup(void)
void WND_Bootstrap(void)
{
WND_W32_SharedState *g = &WND_W32_shared_state;

View File

@ -1,7 +1,11 @@
@Layer window_win32
//////////////////////////////
//- Api
@IncludeC window_win32.h
//////////////////////////////
//- Impl
@IncludeC window_win32.c