From 7c1602e46366a80e06c45b91168e94c5c5937154 Mon Sep 17 00:00:00 2001 From: jacob Date: Tue, 9 Dec 2025 14:14:33 -0600 Subject: [PATCH] specify platform name as argument for default downstream layer declarations --- src/ase/ase.lay | 4 ++ src/base/base.cgh | 48 ++++++++++++-- src/base/base_arena.h | 13 ---- src/base/base_entry.h | 20 ------ src/base/base_inc.h | 1 - src/base/base_resource.c | 2 +- src/base/base_resource.h | 2 +- src/base/base_win32/base_win32.c | 32 +++++----- src/collider/collider.lay | 4 ++ src/draw/draw.c | 4 +- src/draw/draw.h | 4 +- src/draw/draw.lay | 13 ++-- src/glyph_cache/glyph_cache.lay | 6 ++ src/gpu/gpu.lay | 24 ++++--- src/gpu/gpu_common.c | 4 +- src/gpu/gpu_common.h | 4 +- src/gpu/gpu_core.h | 4 +- src/gpu/gpu_dx12/gpu_dx12.c | 4 +- src/gpu/gpu_dx12/gpu_dx12.lay | 4 ++ src/json/json.lay | 6 ++ src/meta/meta.c | 49 ++++++++------- src/meta/meta_lay.c | 62 +++++++++++++------ src/meta/meta_lay.h | 14 +++-- src/meta/meta_os/meta_os.h | 4 +- .../meta_os/meta_os_win32/meta_os_win32.c | 4 +- src/mixer/mixer.c | 4 +- src/mixer/mixer.h | 4 +- src/mixer/mixer.lay | 13 ++-- src/mp3/mp3.lay | 8 ++- src/mp3/mp3_mmf/mp3_mmf.lay | 4 ++ src/net/net.lay | 6 ++ src/platform/platform.h | 4 +- src/platform/platform.lay | 11 ++-- src/platform/platform_win32/platform_win32.c | 4 +- .../platform_win32/platform_win32.lay | 4 ++ src/playback/playback.h | 2 +- src/playback/playback.lay | 13 ++-- .../playback_wasapi/playback_wasapi.c | 4 +- .../playback_wasapi/playback_wasapi.lay | 4 ++ src/pp/pp.lay | 3 + src/pp/pp_sim/pp_sim.lay | 13 ++-- src/pp/pp_sim/pp_sim_core.c | 4 +- src/pp/pp_sim/pp_sim_core.h | 4 +- src/pp/pp_vis/pp_vis.lay | 38 +++++++----- src/pp/pp_vis/pp_vis_core.c | 4 +- src/pp/pp_vis/pp_vis_core.h | 4 +- src/pp_old/pp.lay | 32 ++++++---- src/proto/proto.c | 2 +- src/proto/proto.lay | 27 +++++--- src/settings/settings.lay | 6 ++ src/sound/sound.lay | 6 ++ src/sprite/sprite.lay | 6 ++ src/tar/tar.lay | 6 ++ src/ttf/ttf.h | 2 +- src/ttf/ttf.lay | 11 ++-- src/ttf/ttf_dwrite/ttf_dwrite.c | 12 +--- src/ttf/ttf_dwrite/ttf_dwrite.lay | 4 ++ src/ui/ui.lay | 34 +++++----- src/ui/ui_core.c | 4 +- src/ui/ui_core.h | 4 +- src/window/window.h | 4 +- src/window/window.lay | 13 ++-- src/window/window_win32/window_win32.c | 4 +- src/window/window_win32/window_win32.lay | 4 ++ 64 files changed, 423 insertions(+), 249 deletions(-) delete mode 100644 src/base/base_entry.h diff --git a/src/ase/ase.lay b/src/ase/ase.lay index 6da6ae03..6ada8a69 100644 --- a/src/ase/ase.lay +++ b/src/ase/ase.lay @@ -1,7 +1,11 @@ @Layer ase +////////////////////////////// //- Api + @IncludeC ase.h +////////////////////////////// //- Impl + @IncludeC ase.c diff --git a/src/base/base.cgh b/src/base/base.cgh index 9172c6f6..5b41ee31 100644 --- a/src/base/base.cgh +++ b/src/base/base.cgh @@ -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 //////////////////////////////////////////////////////////// diff --git a/src/base/base_arena.h b/src/base/base_arena.h index ece49f67..f0b486ac 100644 --- a/src/base/base_arena.h +++ b/src/base/base_arena.h @@ -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 diff --git a/src/base/base_entry.h b/src/base/base_entry.h deleted file mode 100644 index c4080162..00000000 --- a/src/base/base_entry.h +++ /dev/null @@ -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); diff --git a/src/base/base_inc.h b/src/base/base_inc.h index a7ab1501..ae155bad 100644 --- a/src/base/base_inc.h +++ b/src/base/base_inc.h @@ -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" diff --git a/src/base/base_resource.c b/src/base/base_resource.c index e34d1f29..019dd66f 100644 --- a/src/base/base_resource.c +++ b/src/base/base_resource.c @@ -1,7 +1,7 @@ SharedResourceState shared_resource_state = ZI; //////////////////////////////////////////////////////////// -//~ Startup +//~ Bootstrap void InitResourceSystem(u64 archive_strings_count, String *archive_strings) { diff --git a/src/base/base_resource.h b/src/base/base_resource.h index 94982da1..dc479a6c 100644 --- a/src/base/base_resource.h +++ b/src/base/base_resource.h @@ -31,7 +31,7 @@ Struct(SharedResourceState) } extern shared_resource_state; //////////////////////////////////////////////////////////// -//~ Startup +//~ Bootstrap void InitResourceSystem(u64 archive_strings_count, String *archive_strings); diff --git a/src/base/base_win32/base_win32.c b/src/base/base_win32/base_win32.c index 1ef03f50..1058298f 100644 --- a/src/base/base_win32/base_win32.c +++ b/src/base/base_win32/base_win32.c @@ -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)) diff --git a/src/collider/collider.lay b/src/collider/collider.lay index a1c8af91..cf16c7ca 100644 --- a/src/collider/collider.lay +++ b/src/collider/collider.lay @@ -1,7 +1,11 @@ @Layer collider +////////////////////////////// //- Api + @IncludeC collider.h +////////////////////////////// //- Impl + @IncludeC collider.c diff --git a/src/draw/draw.c b/src/draw/draw.c index 65a7cac7..72b0b8cc 100644 --- a/src/draw/draw.c +++ b/src/draw/draw.c @@ -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; diff --git a/src/draw/draw.h b/src/draw/draw.h index 131d7614..9b0a1cec 100644 --- a/src/draw/draw.h +++ b/src/draw/draw.h @@ -107,9 +107,9 @@ Struct(D_SharedState) } extern D_shared_state; //////////////////////////////////////////////////////////// -//~ Startup +//~ Bootstrap -void D_Startup(void); +void D_Bootstrap(void); //////////////////////////////////////////////////////////// //~ Material operations diff --git a/src/draw/draw.lay b/src/draw/draw.lay index 54d8bcff..d7cb53c8 100644 --- a/src/draw/draw.lay +++ b/src/draw/draw.lay @@ -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 diff --git a/src/glyph_cache/glyph_cache.lay b/src/glyph_cache/glyph_cache.lay index a79c7007..2f625b90 100644 --- a/src/glyph_cache/glyph_cache.lay +++ b/src/glyph_cache/glyph_cache.lay @@ -1,11 +1,17 @@ @Layer glyph_cache +////////////////////////////// //- Dependencies + @Dep ttf @Dep gpu +////////////////////////////// //- Api + @IncludeC glyph_cache.h +////////////////////////////// //- Impl + @IncludeC glyph_cache.c diff --git a/src/gpu/gpu.lay b/src/gpu/gpu.lay index 88e309e2..4a2a039b 100644 --- a/src/gpu/gpu.lay +++ b/src/gpu/gpu.lay @@ -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 diff --git a/src/gpu/gpu_common.c b/src/gpu/gpu_common.c index 20f523d8..9cafcce7 100644 --- a/src/gpu/gpu_common.c +++ b/src/gpu/gpu_common.c @@ -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; diff --git a/src/gpu/gpu_common.h b/src/gpu/gpu_common.h index 1fdb89be..99ed4a89 100644 --- a/src/gpu/gpu_common.h +++ b/src/gpu/gpu_common.h @@ -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 diff --git a/src/gpu/gpu_core.h b/src/gpu/gpu_core.h index 178a8389..3f6a8882 100644 --- a/src/gpu/gpu_core.h +++ b/src/gpu/gpu_core.h @@ -502,9 +502,9 @@ Struct(GPU_Stats) }; //////////////////////////////////////////////////////////// -//~ @hookdecl Startup +//~ @hookdecl Bootstrap -void GPU_Startup(void); +void GPU_Bootstrap(void); //////////////////////////////////////////////////////////// //~ @hookdecl Arena diff --git a/src/gpu/gpu_dx12/gpu_dx12.c b/src/gpu/gpu_dx12/gpu_dx12.c index 2c10e61f..60d623b9 100644 --- a/src/gpu/gpu_dx12/gpu_dx12.c +++ b/src/gpu/gpu_dx12/gpu_dx12.c @@ -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(); diff --git a/src/gpu/gpu_dx12/gpu_dx12.lay b/src/gpu/gpu_dx12/gpu_dx12.lay index 47557a18..8be4a26d 100644 --- a/src/gpu/gpu_dx12/gpu_dx12.lay +++ b/src/gpu/gpu_dx12/gpu_dx12.lay @@ -1,7 +1,11 @@ @Layer gpu_dx12 +////////////////////////////// //- Api + @IncludeC gpu_dx12.h +////////////////////////////// //- Impl + @IncludeC gpu_dx12.c diff --git a/src/json/json.lay b/src/json/json.lay index 402139b3..f382c1d9 100644 --- a/src/json/json.lay +++ b/src/json/json.lay @@ -1,10 +1,16 @@ @Layer json +////////////////////////////// //- Dependencies + @Dep base +////////////////////////////// //- Api + @IncludeC json_core.h +////////////////////////////// //- Impl + @IncludeC json_core.c diff --git a/src/meta/meta.c b/src/meta/meta.c index 844f81d6..7c56752f 100644 --- a/src/meta/meta.c +++ b/src/meta/meta.c @@ -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, - "%F:%F:%F: error: %F", - FmtString(token_file), - FmtSint(line_col.line), - FmtSint(line_col.col), - FmtString(e->msg)); + 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); diff --git a/src/meta/meta_lay.c b/src/meta/meta_lay.c index bf22faf5..5228d657 100644 --- a/src/meta/meta_lay.c +++ b/src/meta/meta_lay.c @@ -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"))) { - StackNode *n = PushStruct(scratch.arena, StackNode); - n->state = impl_layer_state; - SllStackPush(stack, n); + 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); } } - else + + /* Include layer downstream */ + if (should_include) { - String err = StringF(arena, "Layer \"%F\" not found", FmtString(impl_name)); - M_PushError(arena, &result.errors, impl_token, err); + 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 = downstream_layer_state; + SllStackPush(stack, n); + } + } + else + { + 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) diff --git a/src/meta/meta_lay.h b/src/meta/meta_lay.h index f7c835b9..bf0108bd 100644 --- a/src/meta/meta_lay.h +++ b/src/meta/meta_lay.h @@ -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", diff --git a/src/meta/meta_os/meta_os.h b/src/meta/meta_os/meta_os.h index 8ae663f4..95975a7b 100644 --- a/src/meta/meta_os/meta_os.h +++ b/src/meta/meta_os/meta_os.h @@ -24,9 +24,9 @@ Struct(OS_CommandResult) }; //////////////////////////////////////////////////////////// -//~ @hookdecl Startup hooks +//~ @hookdecl Bootstrap -void OS_Startup(void); +void OS_Bootstrap(void); //////////////////////////////////////////////////////////// //~ @hookdecl File system operations diff --git a/src/meta/meta_os/meta_os_win32/meta_os_win32.c b/src/meta/meta_os/meta_os_win32/meta_os_win32.c index 306095f1..c262feb0 100644 --- a/src/meta/meta_os/meta_os_win32/meta_os_win32.c +++ b/src/meta/meta_os/meta_os_win32/meta_os_win32.c @@ -26,9 +26,9 @@ String W32_StringFromError(Arena *arena, DWORD err) } //////////////////////////////////////////////////////////// -//~ @hookimpl Startup hook +//~ @hookimpl Bootstrap -void OS_Startup(void) +void OS_Bootstrap(void) { } diff --git a/src/mixer/mixer.c b/src/mixer/mixer.c index 08e8e248..3bd75735 100644 --- a/src/mixer/mixer.c +++ b/src/mixer/mixer.c @@ -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)); diff --git a/src/mixer/mixer.h b/src/mixer/mixer.h index f813e8c7..687473b3 100644 --- a/src/mixer/mixer.h +++ b/src/mixer/mixer.h @@ -94,9 +94,9 @@ Struct(MIX_SharedState) } extern M_shared_state; //////////////////////////////////////////////////////////// -//~ Startup +//~ Bootstrap -void MIX_Startup(void); +void MIX_Bootstrap(void); //////////////////////////////////////////////////////////// //~ Track operations diff --git a/src/mixer/mixer.lay b/src/mixer/mixer.lay index 6e9fd2c0..871dcd24 100644 --- a/src/mixer/mixer.lay +++ b/src/mixer/mixer.lay @@ -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 diff --git a/src/mp3/mp3.lay b/src/mp3/mp3.lay index 66687626..8750eaa3 100644 --- a/src/mp3/mp3.lay +++ b/src/mp3/mp3.lay @@ -1,7 +1,11 @@ @Layer mp3 +////////////////////////////// //- Api + @IncludeC mp3.h -//- Mmf impl -@DefaultWindowsImpl mp3_mmf +////////////////////////////// +//- Impl + +@DefaultDownstream mp3_mmf diff --git a/src/mp3/mp3_mmf/mp3_mmf.lay b/src/mp3/mp3_mmf/mp3_mmf.lay index cf241bb4..ee14e124 100644 --- a/src/mp3/mp3_mmf/mp3_mmf.lay +++ b/src/mp3/mp3_mmf/mp3_mmf.lay @@ -1,7 +1,11 @@ @Layer mp3_mmf +////////////////////////////// //- Api + @IncludeC mp3_mmf.h +////////////////////////////// //- Impl + @IncludeC mp3_mmf.c diff --git a/src/net/net.lay b/src/net/net.lay index dcf33e5a..45740da9 100644 --- a/src/net/net.lay +++ b/src/net/net.lay @@ -1,10 +1,16 @@ @Layer net +////////////////////////////// //- Dependencies + @Dep platform +////////////////////////////// //- Api + @IncludeC net.h +////////////////////////////// //- Impl + @IncludeC net.c diff --git a/src/platform/platform.h b/src/platform/platform.h index 2860a7e9..036bcb50 100644 --- a/src/platform/platform.h +++ b/src/platform/platform.h @@ -67,9 +67,9 @@ Enum(P_MessageBoxKind) }; //////////////////////////////////////////////////////////// -//~ @hookdecl Startup +//~ @hookdecl Bootstrap -void P_Startup(void); +void P_Bootstrap(void); //////////////////////////////////////////////////////////// //~ @hookdecl File system hooks diff --git a/src/platform/platform.lay b/src/platform/platform.lay index a4ed6edf..abc53fc8 100644 --- a/src/platform/platform.lay +++ b/src/platform/platform.lay @@ -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 diff --git a/src/platform/platform_win32/platform_win32.c b/src/platform/platform_win32/platform_win32.c index c1a664cb..59ad06b0 100644 --- a/src/platform/platform_win32/platform_win32.c +++ b/src/platform/platform_win32/platform_win32.c @@ -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; diff --git a/src/platform/platform_win32/platform_win32.lay b/src/platform/platform_win32/platform_win32.lay index b8e89c6f..c7bbf1b9 100644 --- a/src/platform/platform_win32/platform_win32.lay +++ b/src/platform/platform_win32/platform_win32.lay @@ -1,7 +1,11 @@ @Layer platform_win32 +////////////////////////////// //- Api + @IncludeC platform_win32.h +////////////////////////////// //- Impl + @IncludeC platform_win32.c diff --git a/src/playback/playback.h b/src/playback/playback.h index 2efa16c7..7be90f5a 100644 --- a/src/playback/playback.h +++ b/src/playback/playback.h @@ -1,3 +1,3 @@ #define PB_SampleRate 48000 -void PB_Startup(void); +void PB_Bootstrap(void); diff --git a/src/playback/playback.lay b/src/playback/playback.lay index f2bcb84f..9ed021d5 100644 --- a/src/playback/playback.lay +++ b/src/playback/playback.lay @@ -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 diff --git a/src/playback/playback_wasapi/playback_wasapi.c b/src/playback/playback_wasapi/playback_wasapi.c index 54883387..ecd9a639 100644 --- a/src/playback/playback_wasapi/playback_wasapi.c +++ b/src/playback/playback_wasapi/playback_wasapi.c @@ -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(); diff --git a/src/playback/playback_wasapi/playback_wasapi.lay b/src/playback/playback_wasapi/playback_wasapi.lay index 31223f37..ef9786ba 100644 --- a/src/playback/playback_wasapi/playback_wasapi.lay +++ b/src/playback/playback_wasapi/playback_wasapi.lay @@ -1,7 +1,11 @@ @Layer playback_wasapi +////////////////////////////// //- Api + @IncludeC playback_wasapi.h +////////////////////////////// //- Impl + @IncludeC playback_wasapi.c diff --git a/src/pp/pp.lay b/src/pp/pp.lay index 580ce43a..8efbe07a 100644 --- a/src/pp/pp.lay +++ b/src/pp/pp.lay @@ -1,4 +1,7 @@ @Layer pp +////////////////////////////// +//- Dependencies + @Dep pp_sim @Dep pp_vis diff --git a/src/pp/pp_sim/pp_sim.lay b/src/pp/pp_sim/pp_sim.lay index 92f00c6b..43b3112a 100644 --- a/src/pp/pp_sim/pp_sim.lay +++ b/src/pp/pp_sim/pp_sim.lay @@ -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 diff --git a/src/pp/pp_sim/pp_sim_core.c b/src/pp/pp_sim/pp_sim_core.c index e0fefba9..cbcd1eb3 100644 --- a/src/pp/pp_sim/pp_sim_core.c +++ b/src/pp/pp_sim/pp_sim_core.c @@ -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; diff --git a/src/pp/pp_sim/pp_sim_core.h b/src/pp/pp_sim/pp_sim_core.h index d2f97fba..409276da 100644 --- a/src/pp/pp_sim/pp_sim_core.h +++ b/src/pp/pp_sim/pp_sim_core.h @@ -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); //////////////////////////////////////////////////////////// diff --git a/src/pp/pp_vis/pp_vis.lay b/src/pp/pp_vis/pp_vis.lay index f3219bdd..5d8c2093 100644 --- a/src/pp/pp_vis/pp_vis.lay +++ b/src/pp/pp_vis/pp_vis.lay @@ -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 diff --git a/src/pp/pp_vis/pp_vis_core.c b/src/pp/pp_vis/pp_vis_core.c index 97c6a34c..56f9be90 100644 --- a/src/pp/pp_vis/pp_vis_core.c +++ b/src/pp/pp_vis/pp_vis_core.c @@ -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); } diff --git a/src/pp/pp_vis/pp_vis_core.h b/src/pp/pp_vis/pp_vis_core.h index 9ec73dc6..afb72a2f 100644 --- a/src/pp/pp_vis/pp_vis_core.h +++ b/src/pp/pp_vis/pp_vis_core.h @@ -100,9 +100,9 @@ Struct(V_State) } extern V; //////////////////////////////////////////////////////////// -//~ Startup +//~ Bootstrap -void V_Startup(void); +void V_Bootstrap(void); void V_Shutdown(void); //////////////////////////////////////////////////////////// diff --git a/src/pp_old/pp.lay b/src/pp_old/pp.lay index 91d0b89c..645d0eb7 100644 --- a/src/pp_old/pp.lay +++ b/src/pp_old/pp.lay @@ -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 diff --git a/src/proto/proto.c b/src/proto/proto.c index 4a090138..1ed90e65 100644 --- a/src/proto/proto.c +++ b/src/proto/proto.c @@ -79,7 +79,7 @@ void PT_RunForever(WaveLaneCtx *lane) } } -void PT_Startup(void) +void PT_Bootstrap(void) { DispatchWave(Lit("Proto"), 1, PT_RunForever, 0); } diff --git a/src/proto/proto.lay b/src/proto/proto.lay index 541ee050..877adfb7 100644 --- a/src/proto/proto.lay +++ b/src/proto/proto.lay @@ -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 diff --git a/src/settings/settings.lay b/src/settings/settings.lay index 3c08eb73..a101cb5b 100644 --- a/src/settings/settings.lay +++ b/src/settings/settings.lay @@ -1,12 +1,18 @@ @Layer settings +////////////////////////////// //- Dependencies + @Dep base @Dep platform @Dep json +////////////////////////////// //- Api + @IncludeC settings_core.h +////////////////////////////// //- Impl + @IncludeC settings_core.c diff --git a/src/sound/sound.lay b/src/sound/sound.lay index 772231e0..e638c7b1 100644 --- a/src/sound/sound.lay +++ b/src/sound/sound.lay @@ -1,12 +1,18 @@ @Layer sound +////////////////////////////// //- Dependencies + @Dep platform @Dep mp3 @Dep asset_cache +////////////////////////////// //- Api + @IncludeC sound.h +////////////////////////////// //- Impl + @IncludeC sound.c diff --git a/src/sprite/sprite.lay b/src/sprite/sprite.lay index 195f0eaa..af2462fa 100644 --- a/src/sprite/sprite.lay +++ b/src/sprite/sprite.lay @@ -1,11 +1,17 @@ @Layer sprite +////////////////////////////// //- Dependencies + @Dep gpu @Dep ase +////////////////////////////// //- Api + @IncludeC sprite.h +////////////////////////////// //- Impl + @IncludeC sprite.c diff --git a/src/tar/tar.lay b/src/tar/tar.lay index 0eebaebe..1f4f899b 100644 --- a/src/tar/tar.lay +++ b/src/tar/tar.lay @@ -1,11 +1,17 @@ @Layer tar +////////////////////////////// //- Dependencies + @Dep platform @Dep bitbuff +////////////////////////////// //- Api + @IncludeC tar.h +////////////////////////////// //- Impl + @IncludeC tar.c diff --git a/src/ttf/ttf.h b/src/ttf/ttf.h index ca2675f9..f056343b 100644 --- a/src/ttf/ttf.h +++ b/src/ttf/ttf.h @@ -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); diff --git a/src/ttf/ttf.lay b/src/ttf/ttf.lay index 233f82bb..15b3852f 100644 --- a/src/ttf/ttf.lay +++ b/src/ttf/ttf.lay @@ -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 diff --git a/src/ttf/ttf_dwrite/ttf_dwrite.c b/src/ttf/ttf_dwrite/ttf_dwrite.c index a8e3af1d..85fe40cc 100644 --- a/src/ttf/ttf_dwrite/ttf_dwrite.c +++ b/src/ttf/ttf_dwrite/ttf_dwrite.c @@ -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")); diff --git a/src/ttf/ttf_dwrite/ttf_dwrite.lay b/src/ttf/ttf_dwrite/ttf_dwrite.lay index 77b43ea9..1d906edd 100644 --- a/src/ttf/ttf_dwrite/ttf_dwrite.lay +++ b/src/ttf/ttf_dwrite/ttf_dwrite.lay @@ -1,7 +1,11 @@ @Layer ttf_dwrite +////////////////////////////// //- Api + @IncludeC ttf_dwrite.h +////////////////////////////// //- Impl + @IncludeC ttf_dwrite.c diff --git a/src/ui/ui.lay b/src/ui/ui.lay index 2480ce7d..bec34851 100644 --- a/src/ui/ui.lay +++ b/src/ui/ui.lay @@ -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 diff --git a/src/ui/ui_core.c b/src/ui/ui_core.c index 4d3365ba..a10c4a26 100644 --- a/src/ui/ui_core.c +++ b/src/ui/ui_core.c @@ -1,9 +1,9 @@ UI_State UI_state = ZI; //////////////////////////////////////////////////////////// -//~ Startup +//~ Bootstrap -void UI_Startup(void) +void UI_Bootstrap(void) { } diff --git a/src/ui/ui_core.h b/src/ui/ui_core.h index 7670b4f9..0975198e 100644 --- a/src/ui/ui_core.h +++ b/src/ui/ui_core.h @@ -360,9 +360,9 @@ Struct(UI_State) } extern UI_state; //////////////////////////////////////////////////////////// -//~ Startup +//~ Bootstrap -void UI_Startup(void); +void UI_Bootstrap(void); //////////////////////////////////////////////////////////// //~ Font helpers diff --git a/src/window/window.h b/src/window/window.h index 18e62ba7..c4546d94 100644 --- a/src/window/window.h +++ b/src/window/window.h @@ -54,9 +54,9 @@ Struct(WND_Frame) }; //////////////////////////////////////////////////////////// -//~ @hookdecl Startup +//~ @hookdecl Bootstrap -void WND_Startup(void); +void WND_Bootstrap(void); //////////////////////////////////////////////////////////// //~ @hookdecl Command diff --git a/src/window/window.lay b/src/window/window.lay index af41e667..1665e598 100644 --- a/src/window/window.lay +++ b/src/window/window.lay @@ -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 diff --git a/src/window/window_win32/window_win32.c b/src/window/window_win32/window_win32.c index b200cd76..20c7e69f 100644 --- a/src/window/window_win32/window_win32.c +++ b/src/window/window_win32/window_win32.c @@ -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; diff --git a/src/window/window_win32/window_win32.lay b/src/window/window_win32/window_win32.lay index 89997fa3..0d0eda88 100644 --- a/src/window/window_win32/window_win32.lay +++ b/src/window/window_win32/window_win32.lay @@ -1,7 +1,11 @@ @Layer window_win32 +////////////////////////////// //- Api + @IncludeC window_win32.h +////////////////////////////// //- Impl + @IncludeC window_win32.c