add clang support to metaprogram
This commit is contained in:
parent
4b207e81fe
commit
fdd888cb32
@ -369,6 +369,8 @@ ASE_Meta ASE_DecodeMeta(Arena *arena, String encoded)
|
|||||||
u64 chunk_end_pos = BB_GetCurrentReaderByte(&bbr) + chunk_size;
|
u64 chunk_end_pos = BB_GetCurrentReaderByte(&bbr) + chunk_size;
|
||||||
switch (encoded_chunk_kind)
|
switch (encoded_chunk_kind)
|
||||||
{
|
{
|
||||||
|
default: break;
|
||||||
|
|
||||||
//- Layer chunk
|
//- Layer chunk
|
||||||
case ASE_EncodedChunkKind_Layer:
|
case ASE_EncodedChunkKind_Layer:
|
||||||
{
|
{
|
||||||
@ -480,8 +482,6 @@ ASE_Meta ASE_DecodeMeta(Arena *arena, String encoded)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Sanity check to make sure all data was read
|
|
||||||
Assert(BB_NumBytesRemaining(&bbr) == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
|
|||||||
@ -204,12 +204,8 @@
|
|||||||
//- Read-only
|
//- Read-only
|
||||||
#if IsCpu
|
#if IsCpu
|
||||||
#if IsPlatformWindows
|
#if IsPlatformWindows
|
||||||
#if IsCompilerMsvc
|
#pragma section(".rdata")
|
||||||
#pragma section(".rdata$", read)
|
#define Readonly __declspec(allocate(".rdata"))
|
||||||
#define Readonly __declspec(allocate(".rdata$"))
|
|
||||||
#else
|
|
||||||
#define Readonly __declspec(allocate(".rdata$"))
|
|
||||||
#endif
|
|
||||||
#elif IsPlatformMac
|
#elif IsPlatformMac
|
||||||
#define Readonly __attribute((section("__TEXT,__const")))
|
#define Readonly __attribute((section("__TEXT,__const")))
|
||||||
#else
|
#else
|
||||||
@ -222,6 +218,8 @@
|
|||||||
//- Thread-local
|
//- Thread-local
|
||||||
#if IsCompilerMsvc
|
#if IsCompilerMsvc
|
||||||
#define ThreadLocal __declspec(thread)
|
#define ThreadLocal __declspec(thread)
|
||||||
|
#else
|
||||||
|
#define ThreadLocal __thread
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//- Compiler memory barriers
|
//- Compiler memory barriers
|
||||||
|
|||||||
@ -393,7 +393,7 @@ Vec2 Vec2FromAngle(f32 a);
|
|||||||
f32 AngleFromVec2(Vec2 v);
|
f32 AngleFromVec2(Vec2 v);
|
||||||
|
|
||||||
//- Area
|
//- Area
|
||||||
f32 DimsFromVec2(Vec2 v);
|
f32 AreaFromVec2(Vec2 v);
|
||||||
|
|
||||||
//- Closest point
|
//- Closest point
|
||||||
Vec2 ClosestPointFromRay(Vec2 ray_pos, Vec2 ray_dir_norm, Vec2 p);
|
Vec2 ClosestPointFromRay(Vec2 ray_pos, Vec2 ray_dir_norm, Vec2 p);
|
||||||
@ -410,6 +410,8 @@ b32 MatchVec2I32(Vec2I32 a, Vec2I32 b);
|
|||||||
Vec2I32 NegVec2I32(Vec2I32 a);
|
Vec2I32 NegVec2I32(Vec2I32 a);
|
||||||
Vec2I32 AddVec2I32(Vec2I32 a, Vec2I32 b);
|
Vec2I32 AddVec2I32(Vec2I32 a, Vec2I32 b);
|
||||||
Vec2I32 SubVec2I32(Vec2I32 a, Vec2I32 b);
|
Vec2I32 SubVec2I32(Vec2I32 a, Vec2I32 b);
|
||||||
|
Vec2I32 MulVec2I32Vec2I32(Vec2I32 a, Vec2I32 b);
|
||||||
|
Vec2I32 DivVec2I32Vec2I32(Vec2I32 a, Vec2I32 b);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Vec4
|
//~ Vec4
|
||||||
@ -489,8 +491,9 @@ Affine InvertAffine(Affine af);
|
|||||||
|
|
||||||
//- Mul
|
//- Mul
|
||||||
Affine MulAffine(Affine a, Affine b);
|
Affine MulAffine(Affine a, Affine b);
|
||||||
Vec2 MulAffineVec2(Affine af, Vec2 v);
|
|
||||||
Vec2 MulAffineBasisVec2(Affine af, Vec2 v);
|
Vec2 MulAffineBasisVec2(Affine af, Vec2 v);
|
||||||
|
Vec2 MulAffineVec2(Affine af, Vec2 v);
|
||||||
|
Affine MulAffineXform(Affine af, Xform xf);
|
||||||
|
|
||||||
//- Helpers
|
//- Helpers
|
||||||
Affine BasisFromAffine(Affine af);
|
Affine BasisFromAffine(Affine af);
|
||||||
|
|||||||
@ -79,7 +79,9 @@ String StringFromChar(Arena *arena, char c);
|
|||||||
String StringFromUint(Arena *arena, u64 n, u64 base, u64 zfill);
|
String StringFromUint(Arena *arena, u64 n, u64 base, u64 zfill);
|
||||||
String StringFromUints(Arena *arena, u64 uints_count, u64 *uints, u64 base, u64 zfill);
|
String StringFromUints(Arena *arena, u64 uints_count, u64 *uints, u64 base, u64 zfill);
|
||||||
String StringFromSint(Arena *arena, i64 n, u64 base, u64 zfill);
|
String StringFromSint(Arena *arena, i64 n, u64 base, u64 zfill);
|
||||||
|
String StringFromSints(Arena *arena, u64 sints_count, i64 *sints, u64 base, u64 zfill);
|
||||||
String StringFromFloat(Arena *arena, f64 src, u32 precision);
|
String StringFromFloat(Arena *arena, f64 src, u32 precision);
|
||||||
|
String StringFromFloats(Arena *arena, u64 floats_count, f64 *floats, u32 precision);
|
||||||
String StringFromPtr(Arena *arena, void *ptr);
|
String StringFromPtr(Arena *arena, void *ptr);
|
||||||
String StringFromhandle(Arena *arena, u64 v);
|
String StringFromhandle(Arena *arena, u64 v);
|
||||||
String StringFromUid(Arena *arena, Uid uid);
|
String StringFromUid(Arena *arena, Uid uid);
|
||||||
|
|||||||
@ -97,10 +97,10 @@ TweakVarArray GetAllTweakVars(Arena *arena);
|
|||||||
//~ Tweak utils
|
//~ Tweak utils
|
||||||
|
|
||||||
b32 TweakBool_(String name, b32 initial, TweakBoolDesc desc);
|
b32 TweakBool_(String name, b32 initial, TweakBoolDesc desc);
|
||||||
#define TweakBool(_name, _initial) TweakBool_(Lit(_name), (_initial), (TweakBoolDesc) { \
|
#define TweakBool(_name, _initial, ...) TweakBool_(Lit(_name), (_initial), (TweakBoolDesc) { \
|
||||||
.category = Lit("Debug"), \
|
.category = Lit("Debug"), \
|
||||||
__VA_ARGS__ \
|
__VA_ARGS__ \
|
||||||
}) \
|
})
|
||||||
|
|
||||||
f64 TweakFloat_(String name, f64 initial, TweakFloatDesc desc);
|
f64 TweakFloat_(String name, f64 initial, TweakFloatDesc desc);
|
||||||
#define TweakFloat(_name, _initial, _min, _max, ...) TweakFloat_(Lit(_name), (_initial), (TweakFloatDesc) { \
|
#define TweakFloat(_name, _initial, _min, _max, ...) TweakFloat_(Lit(_name), (_initial), (TweakFloatDesc) { \
|
||||||
|
|||||||
@ -109,7 +109,7 @@ BOOL W32_FindEmbeddedRcData(HMODULE module, LPCWSTR type, LPWSTR wstr_entry_name
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Log
|
//~ Log
|
||||||
|
|
||||||
void W32_BootstrapLogs();
|
void W32_BootstrapLogs(void);
|
||||||
void W32_Log(i32 level, String msg);
|
void W32_Log(i32 level, String msg);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -327,7 +327,7 @@ void GC_TickAsync(WaveLaneCtx *lane, AsyncFrameLaneCtx *base_async_lane_frame)
|
|||||||
// Determine pos in atlas
|
// Determine pos in atlas
|
||||||
pos_in_atlas = atlas->cur_pos;
|
pos_in_atlas = atlas->cur_pos;
|
||||||
atlas->cur_row_height = MaxI32(atlas->cur_row_height, image_dims.y);
|
atlas->cur_row_height = MaxI32(atlas->cur_row_height, image_dims.y);
|
||||||
if (pos_in_atlas.x + image_dims.x > atlas->dims.x);
|
if (pos_in_atlas.x + image_dims.x > atlas->dims.x)
|
||||||
{
|
{
|
||||||
atlas->cur_pos.x = 0;
|
atlas->cur_pos.x = 0;
|
||||||
atlas->cur_pos.y += atlas->cur_row_height;
|
atlas->cur_pos.y += atlas->cur_row_height;
|
||||||
|
|||||||
242
src/meta/meta.c
242
src/meta/meta.c
@ -213,7 +213,7 @@ M_EmbedObj M_Embed(String store_name, String dir_path)
|
|||||||
F_ClearWrite(arc_path, arc_contents);
|
F_ClearWrite(arc_path, arc_contents);
|
||||||
|
|
||||||
// Generate object file
|
// Generate object file
|
||||||
if (IsPlatformWindows)
|
if (M.cmdline.target_platform == M_PlatformKind_Windows)
|
||||||
{
|
{
|
||||||
// Generate RC file
|
// Generate RC file
|
||||||
String rc_out_file = StringF(perm, "%F.rc", FmtString(store_name));
|
String rc_out_file = StringF(perm, "%F.rc", FmtString(store_name));
|
||||||
@ -303,19 +303,15 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- Command line
|
//- Init command line
|
||||||
|
|
||||||
Struct(CmdLineArgs)
|
// Layer name
|
||||||
{
|
{
|
||||||
String leaf_layer_name;
|
CommandlineArg arg = CommandlineArgFromName(Lit("layer"));
|
||||||
};
|
|
||||||
CmdLineArgs cmdline = Zi;
|
|
||||||
{
|
|
||||||
CommandlineArg layer_arg = CommandlineArgFromName(Lit("layer"));
|
|
||||||
String layer_name = Zi;
|
String layer_name = Zi;
|
||||||
if (layer_arg.name.len != 0)
|
if (arg.name.len != 0)
|
||||||
{
|
{
|
||||||
layer_name = layer_arg.value;
|
layer_name = arg.value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -329,12 +325,95 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
|
|||||||
M_EchoLine(Lit("No layer specified, assuming \"pp\" build"));
|
M_EchoLine(Lit("No layer specified, assuming \"pp\" build"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmdline.leaf_layer_name = layer_name;
|
M.cmdline.leaf_layer_name = layer_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Platform
|
||||||
|
{
|
||||||
|
CommandlineArg arg = CommandlineArgFromName(Lit("platform"));
|
||||||
|
if (MatchString(arg.value, Lit("windows")))
|
||||||
|
{
|
||||||
|
M.cmdline.target_platform = M_PlatformKind_Windows;
|
||||||
|
}
|
||||||
|
else if (MatchString(arg.value, Lit("macos")))
|
||||||
|
{
|
||||||
|
M.cmdline.target_platform = M_PlatformKind_Mac;
|
||||||
|
}
|
||||||
|
else if (MatchString(arg.value, Lit("linux")))
|
||||||
|
{
|
||||||
|
M.cmdline.target_platform = M_PlatformKind_Linux;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (IsPlatformWindows)
|
||||||
|
{
|
||||||
|
M.cmdline.target_platform = M_PlatformKind_Windows;
|
||||||
|
}
|
||||||
|
else if (IsPlatformMac)
|
||||||
|
{
|
||||||
|
M.cmdline.target_platform = M_PlatformKind_Mac;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
M.cmdline.target_platform = M_PlatformKind_Linux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compiler
|
||||||
|
{
|
||||||
|
CommandlineArg arg = CommandlineArgFromName(Lit("compiler"));
|
||||||
|
if (MatchString(arg.value, Lit("msvc")))
|
||||||
|
{
|
||||||
|
M.cmdline.target_compiler = M_CompilerKind_Msvc;
|
||||||
|
}
|
||||||
|
else if (MatchString(arg.value, Lit("clang")))
|
||||||
|
{
|
||||||
|
M.cmdline.target_compiler = M_CompilerKind_Clang;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (IsPlatformWindows)
|
||||||
|
{
|
||||||
|
M.cmdline.target_compiler = M_CompilerKind_Msvc;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
M.cmdline.target_compiler = M_CompilerKind_Clang;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Release/Debug
|
||||||
|
{
|
||||||
|
CommandlineArg arg = CommandlineArgFromName(Lit("release"));
|
||||||
|
if (arg.exists)
|
||||||
|
{
|
||||||
|
M.cmdline.release = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lane->idx == 0)
|
if (lane->idx == 0)
|
||||||
{
|
{
|
||||||
M_EchoLine(StringF(perm, "Building layer \"%F\"", FmtString(cmdline.leaf_layer_name)));
|
if (M.cmdline.target_compiler == M_CompilerKind_Msvc)
|
||||||
|
{
|
||||||
|
M_EchoLine(Lit("[Msvc]"));
|
||||||
|
}
|
||||||
|
else if (M.cmdline.target_compiler == M_CompilerKind_Clang)
|
||||||
|
{
|
||||||
|
M_EchoLine(Lit("[Clang]"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (M.cmdline.release)
|
||||||
|
{
|
||||||
|
M_EchoLine(Lit("[Release build]"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
M_EchoLine(Lit("[Debug build]"));
|
||||||
|
}
|
||||||
|
|
||||||
|
M_EchoLine(StringF(perm, "Building layer \"%F\"", FmtString(M.cmdline.leaf_layer_name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
@ -352,19 +431,28 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
|
|||||||
PushStringToList(perm, &cp.defs, Lit("-DIsUnoptimized=1"));
|
PushStringToList(perm, &cp.defs, Lit("-DIsUnoptimized=1"));
|
||||||
PushStringToList(perm, &cp.defs, Lit("-DIsTestingEnabled=0"));
|
PushStringToList(perm, &cp.defs, Lit("-DIsTestingEnabled=0"));
|
||||||
PushStringToList(perm, &cp.defs, Lit("-DIsHotSwappingEnabled=1"));
|
PushStringToList(perm, &cp.defs, Lit("-DIsHotSwappingEnabled=1"));
|
||||||
PushStringToList(perm, &cp.defs, StringF(perm, "-DDefaultAppName=%F", FmtString(cmdline.leaf_layer_name)));
|
PushStringToList(perm, &cp.defs, StringF(perm, "-DDefaultAppName=%F", FmtString(M.cmdline.leaf_layer_name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Msvc
|
//- Msvc
|
||||||
{
|
{
|
||||||
PushStringToList(perm, &cp.compiler_only_flags_msvc, Lit("-diagnostics:column"));
|
|
||||||
PushStringToList(perm, &cp.flags_msvc, Lit("-INCREMENTAL:NO"));
|
PushStringToList(perm, &cp.flags_msvc, Lit("-INCREMENTAL:NO"));
|
||||||
PushStringToList(perm, &cp.flags_msvc, Lit("-nologo"));
|
PushStringToList(perm, &cp.flags_msvc, Lit("-nologo"));
|
||||||
|
|
||||||
// Optimization
|
PushStringToList(perm, &cp.compiler_only_flags_msvc, Lit("-diagnostics:column"));
|
||||||
PushStringToList(perm, &cp.compiler_only_flags_msvc, Lit("-Od"));
|
|
||||||
|
|
||||||
// Debug info
|
if (M.cmdline.release)
|
||||||
|
{
|
||||||
|
PushStringToList(perm, &cp.compiler_only_flags_msvc, Lit("-MT"));
|
||||||
|
PushStringToList(perm, &cp.compiler_only_flags_msvc, Lit("-O2"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PushStringToList(perm, &cp.compiler_only_flags_msvc, Lit("-MTd"));
|
||||||
|
PushStringToList(perm, &cp.compiler_only_flags_msvc, Lit("-Od"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Export debug info separately for release builds
|
||||||
PushStringToList(perm, &cp.flags_msvc, Lit("-DEBUG:FULL"));
|
PushStringToList(perm, &cp.flags_msvc, Lit("-DEBUG:FULL"));
|
||||||
PushStringToList(perm, &cp.compiler_only_flags_msvc, Lit("-Z7"));
|
PushStringToList(perm, &cp.compiler_only_flags_msvc, Lit("-Z7"));
|
||||||
|
|
||||||
@ -396,17 +484,39 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
|
|||||||
|
|
||||||
//- Clang
|
//- Clang
|
||||||
{
|
{
|
||||||
PushStringToList(perm, &cp.flags_clang, Lit("-std=c99"));
|
PushStringToList(perm, &cp.compiler_only_flags_clang, Lit("-std=c99"));
|
||||||
PushStringToList(perm, &cp.flags_clang, Lit("-fno-finite-loops"));
|
PushStringToList(perm, &cp.compiler_only_flags_clang, Lit("-fno-finite-loops"));
|
||||||
PushStringToList(perm, &cp.flags_clang, Lit("-fno-strict-aliasing"));
|
PushStringToList(perm, &cp.compiler_only_flags_clang, Lit("-fno-strict-aliasing"));
|
||||||
PushStringToList(perm, &cp.flags_clang, Lit("-g -gcodeview"));
|
PushStringToList(perm, &cp.compiler_only_flags_clang, Lit("-msse4.2"));
|
||||||
PushStringToList(perm, &cp.flags_clang, Lit("-O0"));
|
|
||||||
PushStringToList(perm, &cp.flags_clang, Lit("-msse4.2"));
|
// TODO: Export debug info separately for release builds
|
||||||
|
PushStringToList(perm, &cp.compiler_only_flags_clang, Lit("-g -gcodeview"));
|
||||||
|
|
||||||
|
if (M.cmdline.release)
|
||||||
|
{
|
||||||
|
PushStringToList(perm, &cp.compiler_only_flags_clang, Lit("-O2"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PushStringToList(perm, &cp.compiler_only_flags_clang, Lit("-O0"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (M.cmdline.target_platform == M_PlatformKind_Windows)
|
||||||
|
{
|
||||||
|
if (M.cmdline.release)
|
||||||
|
{
|
||||||
|
PushStringToList(perm, &cp.compiler_only_flags_clang, Lit("-fms-runtime-lib=static_dbg"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PushStringToList(perm, &cp.compiler_only_flags_clang, Lit("-fms-runtime-lib=static"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Enable warnings
|
// Enable warnings
|
||||||
PushStringToList(perm, &cp.warnings_clang, Lit("-Wall"));
|
PushStringToList(perm, &cp.warnings_clang, Lit("-Wall"));
|
||||||
PushStringToList(perm, &cp.warnings_clang, Lit("-Werror"));
|
PushStringToList(perm, &cp.warnings_clang, Lit("-Werror"));
|
||||||
PushStringToList(perm, &cp.warnings_clang, Lit("-Wframe-larger-than=65536"));
|
PushStringToList(perm, &cp.warnings_clang, Lit("-Wframe-larger-than=1048575"));
|
||||||
PushStringToList(perm, &cp.warnings_clang, Lit("-Wmissing-prototypes"));
|
PushStringToList(perm, &cp.warnings_clang, Lit("-Wmissing-prototypes"));
|
||||||
PushStringToList(perm, &cp.warnings_clang, Lit("-Wmissing-declarations"));
|
PushStringToList(perm, &cp.warnings_clang, Lit("-Wmissing-declarations"));
|
||||||
PushStringToList(perm, &cp.warnings_clang, Lit("-Wunused-variable"));
|
PushStringToList(perm, &cp.warnings_clang, Lit("-Wunused-variable"));
|
||||||
@ -418,9 +528,14 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
|
|||||||
// Disable warnings
|
// Disable warnings
|
||||||
PushStringToList(perm, &cp.warnings_clang, Lit("-Wno-initializer-overrides"));
|
PushStringToList(perm, &cp.warnings_clang, Lit("-Wno-initializer-overrides"));
|
||||||
PushStringToList(perm, &cp.warnings_clang, Lit("-Wno-microsoft-enum-forward-reference"));
|
PushStringToList(perm, &cp.warnings_clang, Lit("-Wno-microsoft-enum-forward-reference"));
|
||||||
|
PushStringToList(perm, &cp.warnings_clang, Lit("-Wno-microsoft-anon-tag"));
|
||||||
PushStringToList(perm, &cp.warnings_clang, Lit("-Wno-unused-variable"));
|
PushStringToList(perm, &cp.warnings_clang, Lit("-Wno-unused-variable"));
|
||||||
|
PushStringToList(perm, &cp.warnings_clang, Lit("-Wno-unused-but-set-variable"));
|
||||||
PushStringToList(perm, &cp.warnings_clang, Lit("-Wno-unused-parameter"));
|
PushStringToList(perm, &cp.warnings_clang, Lit("-Wno-unused-parameter"));
|
||||||
PushStringToList(perm, &cp.warnings_clang, Lit("-Wno-incompatible-function-pointer-types"));
|
PushStringToList(perm, &cp.warnings_clang, Lit("-Wno-incompatible-function-pointer-types"));
|
||||||
|
PushStringToList(perm, &cp.warnings_clang, Lit("-Wno-missing-braces"));
|
||||||
|
PushStringToList(perm, &cp.warnings_clang, Lit("-Wno-switch"));
|
||||||
|
PushStringToList(perm, &cp.warnings_clang, Lit("-Wno-unused-value"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Dxc
|
//- Dxc
|
||||||
@ -462,8 +577,8 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
|
|||||||
// TODO: Dispatch OS commands asynchronously
|
// TODO: Dispatch OS commands asynchronously
|
||||||
|
|
||||||
String shader_store_name = Lit("ShadersStore");
|
String shader_store_name = Lit("ShadersStore");
|
||||||
String c_out_file = F_GetFull(perm, StringF(perm, "%F_gen.c", FmtString(cmdline.leaf_layer_name)));
|
String c_out_file = F_GetFull(perm, StringF(perm, "%F_gen.c", FmtString(M.cmdline.leaf_layer_name)));
|
||||||
String gpu_out_file = F_GetFull(perm, StringF(perm, "%F_gen.g", FmtString(cmdline.leaf_layer_name)));
|
String gpu_out_file = F_GetFull(perm, StringF(perm, "%F_gen.g", FmtString(M.cmdline.leaf_layer_name)));
|
||||||
u64 shader_store_hash = HashString(shader_store_name);
|
u64 shader_store_hash = HashString(shader_store_name);
|
||||||
|
|
||||||
if (lane->idx == 0 && M_GetBuildStatus() == 0)
|
if (lane->idx == 0 && M_GetBuildStatus() == 0)
|
||||||
@ -480,7 +595,7 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
|
|||||||
|
|
||||||
// Flatten
|
// Flatten
|
||||||
StringList starting_layer_names = Zi;
|
StringList starting_layer_names = Zi;
|
||||||
PushStringToList(perm, &starting_layer_names, cmdline.leaf_layer_name);
|
PushStringToList(perm, &starting_layer_names, M.cmdline.leaf_layer_name);
|
||||||
M.layers_parse = M_FlattenEntries(perm, parsed, starting_layer_names);
|
M.layers_parse = M_FlattenEntries(perm, parsed, starting_layer_names);
|
||||||
|
|
||||||
M_SetBuildStatus(M.layers_parse.errors.count > 0);
|
M_SetBuildStatus(M.layers_parse.errors.count > 0);
|
||||||
@ -842,17 +957,34 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
|
|||||||
{
|
{
|
||||||
if (lane->idx == WaveLaneIdxFromTaskIdx(lane, task_idx++) && M_GetBuildStatus() == 0)
|
if (lane->idx == WaveLaneIdxFromTaskIdx(lane, task_idx++) && M_GetBuildStatus() == 0)
|
||||||
{
|
{
|
||||||
M.c_obj.obj_file = StringF(perm, "%F_gen_c.obj", FmtString(cmdline.leaf_layer_name));
|
M.c_obj.obj_file = StringF(perm, "%F_gen_c.obj", FmtString(M.cmdline.leaf_layer_name));
|
||||||
String cmd = StringF(
|
String cmd = Zi;
|
||||||
perm,
|
if (M.cmdline.target_compiler == M_CompilerKind_Msvc)
|
||||||
"cl.exe /c %F -Fo:%F %F %F %F %F",
|
{
|
||||||
FmtString(c_out_file),
|
cmd = StringF(
|
||||||
FmtString(M.c_obj.obj_file),
|
perm,
|
||||||
FmtString(StringFromList(perm, cp.flags_msvc, Lit(" "))),
|
"cl.exe /c %F -Fo:%F %F %F %F %F",
|
||||||
FmtString(StringFromList(perm, cp.compiler_only_flags_msvc, Lit(" "))),
|
FmtString(c_out_file),
|
||||||
FmtString(StringFromList(perm, cp.warnings_msvc, Lit(" "))),
|
FmtString(M.c_obj.obj_file),
|
||||||
FmtString(StringFromList(perm, cp.defs, Lit(" ")))
|
FmtString(StringFromList(perm, cp.flags_msvc, Lit(" "))),
|
||||||
);
|
FmtString(StringFromList(perm, cp.compiler_only_flags_msvc, Lit(" "))),
|
||||||
|
FmtString(StringFromList(perm, cp.warnings_msvc, Lit(" "))),
|
||||||
|
FmtString(StringFromList(perm, cp.defs, Lit(" ")))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cmd = StringF(
|
||||||
|
perm,
|
||||||
|
"clang.exe -c %F -o %F %F %F %F %F",
|
||||||
|
FmtString(c_out_file),
|
||||||
|
FmtString(M.c_obj.obj_file),
|
||||||
|
FmtString(StringFromList(perm, cp.flags_clang, Lit(" "))),
|
||||||
|
FmtString(StringFromList(perm, cp.compiler_only_flags_clang, Lit(" "))),
|
||||||
|
FmtString(StringFromList(perm, cp.warnings_clang, Lit(" "))),
|
||||||
|
FmtString(StringFromList(perm, cp.defs, Lit(" ")))
|
||||||
|
);
|
||||||
|
}
|
||||||
OS_CommandResult cmd_result = OS_RunCommand(perm, cmd);
|
OS_CommandResult cmd_result = OS_RunCommand(perm, cmd);
|
||||||
String cmd_output = TrimWhitespace(cmd_result.output);
|
String cmd_output = TrimWhitespace(cmd_result.output);
|
||||||
M.c_obj.output = cmd_output;
|
M.c_obj.output = cmd_output;
|
||||||
@ -941,7 +1073,7 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
|
|||||||
|
|
||||||
if (lane->idx == 0 && M_GetBuildStatus() == 0)
|
if (lane->idx == 0 && M_GetBuildStatus() == 0)
|
||||||
{
|
{
|
||||||
String exe_file = StringF(perm, "%F.exe", FmtString(cmdline.leaf_layer_name));
|
String exe_file = StringF(perm, "%F.exe", FmtString(M.cmdline.leaf_layer_name));
|
||||||
{
|
{
|
||||||
// Wait for exe to become writable (wait for program to close)
|
// Wait for exe to become writable (wait for program to close)
|
||||||
f32 timeout = 1.0;
|
f32 timeout = 1.0;
|
||||||
@ -962,15 +1094,29 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
|
|||||||
}
|
}
|
||||||
obj_files_str = StringFromList(perm, obj_files, Lit(" "));
|
obj_files_str = StringFromList(perm, obj_files, Lit(" "));
|
||||||
}
|
}
|
||||||
|
String cmd = Zi;
|
||||||
String cmd = StringF(
|
if (M.cmdline.target_compiler == M_CompilerKind_Msvc)
|
||||||
perm,
|
{
|
||||||
"link.exe %F /OUT:%F %F %F",
|
cmd = StringF(
|
||||||
FmtString(obj_files_str),
|
perm,
|
||||||
FmtString(exe_file),
|
"link.exe %F /OUT:%F %F %F",
|
||||||
FmtString(StringFromList(perm, cp.flags_msvc, Lit(" "))),
|
FmtString(obj_files_str),
|
||||||
FmtString(StringFromList(perm, cp.linker_only_flags_msvc, Lit(" ")))
|
FmtString(exe_file),
|
||||||
);
|
FmtString(StringFromList(perm, cp.flags_msvc, Lit(" "))),
|
||||||
|
FmtString(StringFromList(perm, cp.linker_only_flags_msvc, Lit(" ")))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cmd = StringF(
|
||||||
|
perm,
|
||||||
|
"lld-link.exe %F /OUT:%F %F %F",
|
||||||
|
FmtString(obj_files_str),
|
||||||
|
FmtString(exe_file),
|
||||||
|
FmtString(StringFromList(perm, cp.flags_clang, Lit(" "))),
|
||||||
|
FmtString(StringFromList(perm, cp.linker_only_flags_clang, Lit(" ")))
|
||||||
|
);
|
||||||
|
}
|
||||||
OS_CommandResult result = OS_RunCommand(perm, cmd);
|
OS_CommandResult result = OS_RunCommand(perm, cmd);
|
||||||
M.link.output = TrimWhitespace(result.output);
|
M.link.output = TrimWhitespace(result.output);
|
||||||
M.link.return_code = result.code;
|
M.link.return_code = result.code;
|
||||||
|
|||||||
@ -121,6 +121,30 @@ Struct(M_EmbedObj)
|
|||||||
i32 return_code;
|
i32 return_code;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
//~ Command line types
|
||||||
|
|
||||||
|
Enum(M_PlatformKind)
|
||||||
|
{
|
||||||
|
M_PlatformKind_Windows,
|
||||||
|
M_PlatformKind_Mac,
|
||||||
|
M_PlatformKind_Linux,
|
||||||
|
};
|
||||||
|
|
||||||
|
Enum(M_CompilerKind)
|
||||||
|
{
|
||||||
|
M_CompilerKind_Msvc,
|
||||||
|
M_CompilerKind_Clang,
|
||||||
|
};
|
||||||
|
|
||||||
|
Struct(M_CommandLine)
|
||||||
|
{
|
||||||
|
b32 release;
|
||||||
|
String leaf_layer_name;
|
||||||
|
M_PlatformKind target_platform;
|
||||||
|
M_CompilerKind target_compiler;
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ State types
|
//~ State types
|
||||||
|
|
||||||
@ -128,6 +152,7 @@ Struct(M_Ctx)
|
|||||||
{
|
{
|
||||||
Atomic32 status;
|
Atomic32 status;
|
||||||
|
|
||||||
|
M_CommandLine cmdline;
|
||||||
M_Layer layers_parse;
|
M_Layer layers_parse;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
|
|||||||
@ -84,12 +84,6 @@ Enum(M_EntryKind)
|
|||||||
M_EntryKind_EmbedDir,
|
M_EntryKind_EmbedDir,
|
||||||
};
|
};
|
||||||
|
|
||||||
Enum(M_PlatformKind)
|
|
||||||
{
|
|
||||||
M_PlatformKind_Any,
|
|
||||||
M_PlatformKind_Win32,
|
|
||||||
};
|
|
||||||
|
|
||||||
Global Readonly char *M_entry_kind_rules[] = {
|
Global Readonly char *M_entry_kind_rules[] = {
|
||||||
[M_EntryKind_Layer] = "@Layer",
|
[M_EntryKind_Layer] = "@Layer",
|
||||||
[M_EntryKind_Dep] = "@Dep",
|
[M_EntryKind_Dep] = "@Dep",
|
||||||
|
|||||||
@ -856,7 +856,7 @@ void NET_W32_TickForever(WaveLaneCtx *lane)
|
|||||||
NET_W32_Packet *next = packet->next;
|
NET_W32_Packet *next = packet->next;
|
||||||
{
|
{
|
||||||
b32 msg_has_end = 0;
|
b32 msg_has_end = 0;
|
||||||
if (packet->msg_seq != peer->last_cont_packet->msg_seq || !!(peer->last_cont_packet->flags | NET_W32_PacketFlag_EndMsg))
|
if (packet->msg_seq != peer->last_cont_packet->msg_seq || !!(peer->last_cont_packet->flags & NET_W32_PacketFlag_EndMsg))
|
||||||
{
|
{
|
||||||
msg_has_end = 1;
|
msg_has_end = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,7 @@ Enum(NET_W32_PacketFlag)
|
|||||||
|
|
||||||
NET_W32_PacketFlag_EndMsg = (1 << 0),
|
NET_W32_PacketFlag_EndMsg = (1 << 0),
|
||||||
NET_W32_PacketFlag_Heartbeat = (1 << 2),
|
NET_W32_PacketFlag_Heartbeat = (1 << 2),
|
||||||
NET_W32_PacketFlag_Raw = (1 << 3),
|
NET_W32_PacketFlag_Raw = (1 << 3),
|
||||||
};
|
};
|
||||||
|
|
||||||
Struct(NET_W32_PacketHeader)
|
Struct(NET_W32_PacketHeader)
|
||||||
|
|||||||
@ -50,6 +50,7 @@ void PLT_Bootstrap(void);
|
|||||||
//- File system helpers
|
//- File system helpers
|
||||||
b32 PLT_IsFile(String path);
|
b32 PLT_IsFile(String path);
|
||||||
b32 PLT_IsDir(String path);
|
b32 PLT_IsDir(String path);
|
||||||
|
b32 PLT_MkDir(String path);
|
||||||
|
|
||||||
//- File creation
|
//- File creation
|
||||||
PLT_File PLT_OpenFileRead(String path);
|
PLT_File PLT_OpenFileRead(String path);
|
||||||
|
|||||||
@ -1313,7 +1313,6 @@ P_Space P_SpaceFromWalls(Arena *arena, P_Frame *frame)
|
|||||||
Vec2I32 end;
|
Vec2I32 end;
|
||||||
};
|
};
|
||||||
|
|
||||||
i64 walls_count = 0;
|
|
||||||
GenWall *first_wall = 0;
|
GenWall *first_wall = 0;
|
||||||
|
|
||||||
//- Generate horizontal walls
|
//- Generate horizontal walls
|
||||||
@ -1350,7 +1349,6 @@ P_Space P_SpaceFromWalls(Arena *arena, P_Frame *frame)
|
|||||||
if (prev_wall_dir != WallDir_None)
|
if (prev_wall_dir != WallDir_None)
|
||||||
{
|
{
|
||||||
GenWall *wall = PushStruct(scratch.arena, GenWall);
|
GenWall *wall = PushStruct(scratch.arena, GenWall);
|
||||||
++walls_count;
|
|
||||||
SllStackPush(first_wall, wall);
|
SllStackPush(first_wall, wall);
|
||||||
wall->dir = prev_wall_dir;
|
wall->dir = prev_wall_dir;
|
||||||
wall->start = VEC2I32(wall_start, tile_y);
|
wall->start = VEC2I32(wall_start, tile_y);
|
||||||
@ -1396,7 +1394,6 @@ P_Space P_SpaceFromWalls(Arena *arena, P_Frame *frame)
|
|||||||
if (prev_wall_dir != WallDir_None)
|
if (prev_wall_dir != WallDir_None)
|
||||||
{
|
{
|
||||||
GenWall *wall = PushStruct(scratch.arena, GenWall);
|
GenWall *wall = PushStruct(scratch.arena, GenWall);
|
||||||
++walls_count;
|
|
||||||
SllStackPush(first_wall, wall);
|
SllStackPush(first_wall, wall);
|
||||||
wall->dir = prev_wall_dir;
|
wall->dir = prev_wall_dir;
|
||||||
wall->start = VEC2I32(tile_x, wall_start);
|
wall->start = VEC2I32(tile_x, wall_start);
|
||||||
|
|||||||
@ -2173,11 +2173,8 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
if (!skip)
|
if (!skip)
|
||||||
{
|
{
|
||||||
f32 trail_len = Vec2Len(SubVec2(end, start));
|
f32 trail_len = Vec2Len(SubVec2(end, start));
|
||||||
// f32 particles_count = MaxF32(trail_len * 10000, 1);
|
f32 particles_count = trail_len * frame->dt * Kibi(8); // Particles per meter per second
|
||||||
// f32 particles_count = MaxF32(trail_len * 512, 1);
|
particles_count = MaxF32(particles_count, 1);
|
||||||
// f32 particles_count = MaxF32(trail_len * 64, 1);
|
|
||||||
f32 particles_count = MaxF32(trail_len * 32, 1);
|
|
||||||
|
|
||||||
|
|
||||||
f32 angle = AngleFromVec2(PerpVec2(SubVec2(end, start)));
|
f32 angle = AngleFromVec2(PerpVec2(SubVec2(end, start)));
|
||||||
// f32 angle = AngleFromVec2(NegVec2(SubVec2(end, start)));
|
// f32 angle = AngleFromVec2(NegVec2(SubVec2(end, start)));
|
||||||
@ -2490,10 +2487,23 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////
|
||||||
|
//- Push test explosion
|
||||||
|
|
||||||
|
// if (frame->held_buttons[Button_F] && !prev_frame->held_buttons[Button_F])
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- Push test emitter
|
//- Push test emitter
|
||||||
|
|
||||||
if (frame->held_buttons[Button_F])
|
if (frame->held_buttons[Button_G])
|
||||||
{
|
{
|
||||||
V_Emitter emitter = Zi;
|
V_Emitter emitter = Zi;
|
||||||
|
|
||||||
@ -2504,7 +2514,8 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
|
|
||||||
// emitter.flags |= V_ParticleFlag_StainTrail;
|
// emitter.flags |= V_ParticleFlag_StainTrail;
|
||||||
|
|
||||||
emitter.count = 128;
|
// emitter.count = 128;
|
||||||
|
emitter.count = CeilF32(Kibi(16) * frame->dt);
|
||||||
emitter.speed = 10;
|
emitter.speed = 10;
|
||||||
|
|
||||||
emitter.color_lin = LinearFromSrgb(Color_Yellow);
|
emitter.color_lin = LinearFromSrgb(Color_Yellow);
|
||||||
@ -3597,7 +3608,7 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
for (u64 cmd_desc_idx = 0; cmd_desc_idx < countof(V_cmd_descs); ++cmd_desc_idx)
|
for (u64 cmd_desc_idx = 0; cmd_desc_idx < countof(V_cmd_descs); ++cmd_desc_idx)
|
||||||
{
|
{
|
||||||
V_CmdDesc cmd_desc = V_cmd_descs[cmd_desc_idx];
|
V_CmdDesc cmd_desc = V_cmd_descs[cmd_desc_idx];
|
||||||
if (!cmd_desc.flags & V_CmdDescFlag_HideFromPalette)
|
if (!(cmd_desc.flags & V_CmdDescFlag_HideFromPalette))
|
||||||
{
|
{
|
||||||
PaletteItem *item = PushStruct(frame->arena, PaletteItem);
|
PaletteItem *item = PushStruct(frame->arena, PaletteItem);
|
||||||
{
|
{
|
||||||
|
|||||||
@ -306,6 +306,11 @@ void V_DrawPoint(Vec2 p, Vec4 srgb);
|
|||||||
V_WidgetTheme V_GetWidgetTheme(void);
|
V_WidgetTheme V_GetWidgetTheme(void);
|
||||||
void V_PushWidgetThemeStyles(V_WidgetTheme theme);
|
void V_PushWidgetThemeStyles(V_WidgetTheme theme);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
//~ Notification helpers
|
||||||
|
|
||||||
|
void V_PushNotif(String msg);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Vis tick
|
//~ Vis tick
|
||||||
|
|
||||||
|
|||||||
@ -450,7 +450,7 @@ void SPR_TickAsync(WaveLaneCtx *lane, AsyncFrameLaneCtx *base_async_lane_frame)
|
|||||||
// Determine pos in atlas
|
// Determine pos in atlas
|
||||||
atlas_pos = atlas->cur_pos;
|
atlas_pos = atlas->cur_pos;
|
||||||
atlas->cur_row_height = MaxI32(atlas->cur_row_height, slice_dims.y);
|
atlas->cur_row_height = MaxI32(atlas->cur_row_height, slice_dims.y);
|
||||||
if (atlas_pos.x + slice_dims.x > atlas->dims.x);
|
if (atlas_pos.x + slice_dims.x > atlas->dims.x)
|
||||||
{
|
{
|
||||||
atlas->cur_pos.x = 0;
|
atlas->cur_pos.x = 0;
|
||||||
atlas->cur_pos.y += atlas->cur_row_height;
|
atlas->cur_pos.y += atlas->cur_row_height;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Based on Allen Webster's dwrite rasterizer example -
|
// Based on Allen Webster's dwrite rasterizer example -
|
||||||
// https://github.com/4th-dimention/examps
|
// https://github.com/4th-dimention/examps
|
||||||
|
|
||||||
extern TTF_DW_Ctx TTF_DW = Zi;
|
TTF_DW_Ctx TTF_DW = Zi;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ @hookimpl Bootstrap
|
//~ @hookimpl Bootstrap
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user