convert indentation to 2 spaces
This commit is contained in:
parent
c1b768282f
commit
3377e3f94c
@ -1,7 +1,7 @@
|
|||||||
/* Aseprite (.ase) file parser
|
/* Aseprite (.ase) file parser
|
||||||
*
|
*
|
||||||
* DEFLATE decoder based on Handmade Hero's png parser
|
* DEFLATE decoder based on Handmade Hero's png parser
|
||||||
*/
|
*/
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Shared constants
|
//~ Shared constants
|
||||||
@ -497,9 +497,11 @@ ASE_DecodedImage ASE_DecodeImage(Arena *arena, String encoded)
|
|||||||
|
|
||||||
if (ase_header.color_depth != 32)
|
if (ase_header.color_depth != 32)
|
||||||
{
|
{
|
||||||
String msg = StringF(scratch.arena,
|
String msg = StringF(
|
||||||
|
scratch.arena,
|
||||||
"Only 32 bit rgba color mode is supported (got %F)",
|
"Only 32 bit rgba color mode is supported (got %F)",
|
||||||
FmtUint(ase_header.color_depth));
|
FmtUint(ase_header.color_depth)
|
||||||
|
);
|
||||||
ASE_PushError(arena, &result.errors, msg);
|
ASE_PushError(arena, &result.errors, msg);
|
||||||
goto abort;
|
goto abort;
|
||||||
}
|
}
|
||||||
@ -574,9 +576,11 @@ ASE_DecodedImage ASE_DecodeImage(Arena *arena, String encoded)
|
|||||||
layer->blend_mode = BB_ReadUBits(&br, 16);
|
layer->blend_mode = BB_ReadUBits(&br, 16);
|
||||||
if (layer->blend_mode != 0)
|
if (layer->blend_mode != 0)
|
||||||
{
|
{
|
||||||
ASE_PushError(arena,
|
ASE_PushError(
|
||||||
|
arena,
|
||||||
&result.errors,
|
&result.errors,
|
||||||
Lit("Layer has unsupported blend mode (only 'Normal' mode is supported). Tip: Try using 'merge down' to create a normal layer as a workaround"));
|
Lit("Layer has unsupported blend mode (only 'Normal' mode is supported). Tip: Try using 'merge down' to create a normal layer as a workaround")
|
||||||
|
);
|
||||||
goto abort;
|
goto abort;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -757,7 +761,7 @@ ASE_DecodedImage ASE_DecodeImage(Arena *arena, String encoded)
|
|||||||
/* Assert all data was read */
|
/* Assert all data was read */
|
||||||
Assert(BB_NumBytesRemaining(&br) == 0);
|
Assert(BB_NumBytesRemaining(&br) == 0);
|
||||||
|
|
||||||
abort:
|
abort:
|
||||||
|
|
||||||
if (result.errors.count <= 0)
|
if (result.errors.count <= 0)
|
||||||
{
|
{
|
||||||
@ -945,7 +949,7 @@ ASE_DecodedSheet ASE_DecodeSheet(Arena *arena, String encoded)
|
|||||||
result.first_span = first_span;
|
result.first_span = first_span;
|
||||||
result.first_slice_key = first_slice_key;
|
result.first_slice_key = first_slice_key;
|
||||||
|
|
||||||
abort:
|
abort:
|
||||||
|
|
||||||
if (result.errors.count <= 0)
|
if (result.errors.count <= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -102,13 +102,13 @@
|
|||||||
//- Windows NTDDI version
|
//- Windows NTDDI version
|
||||||
/* TODO: Remove this */
|
/* TODO: Remove this */
|
||||||
#if 0
|
#if 0
|
||||||
#if IsCompilerMsvc
|
#if IsCompilerMsvc
|
||||||
#define NTDDI_WIN11_DT 0x0C0A0000
|
#define NTDDI_WIN11_DT 0x0C0A0000
|
||||||
#define NTDDI_VERSION 0x0A000000
|
#define NTDDI_VERSION 0x0A000000
|
||||||
#if IsRtcEnabled
|
#if IsRtcEnabled
|
||||||
#define _ALLOW_RTCc_IN_STL 1
|
#define _ALLOW_RTCc_IN_STL 1
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -53,7 +53,7 @@ void ReleaseArena(Arena *arena)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the memory from src to dst, replacing old contents.
|
/* Copy the memory from src to dst, replacing old contents.
|
||||||
* Dst will expand if necessary. */
|
* Dst will expand if necessary. */
|
||||||
void CopyArena(Arena *dst, Arena *src)
|
void CopyArena(Arena *dst, Arena *src)
|
||||||
{
|
{
|
||||||
ResetArena(dst);
|
ResetArena(dst);
|
||||||
|
|||||||
@ -68,9 +68,9 @@ TempArena BeginScratchNoConflict_(void);
|
|||||||
void EndScratch(TempArena scratch_temp);
|
void EndScratch(TempArena scratch_temp);
|
||||||
|
|
||||||
/* This macro declares an unused "arena" variable that will produce a shadowing
|
/* This macro declares an unused "arena" variable that will produce a shadowing
|
||||||
* warning variable is present (due to shadowing). This is for catching obvious
|
* warning variable is present (due to shadowing). This is for catching obvious
|
||||||
* cases of `BeginScratchNoConflict` getting called when an `arena` variable
|
* cases of `BeginScratchNoConflict` getting called when an `arena` variable
|
||||||
* already exists in the caller's scope. */
|
* already exists in the caller's scope. */
|
||||||
#define BeginScratchNoConflict() \
|
#define BeginScratchNoConflict() \
|
||||||
BeginScratchNoConflict_(); \
|
BeginScratchNoConflict_(); \
|
||||||
do { \
|
do { \
|
||||||
|
|||||||
@ -118,11 +118,11 @@ void BB_WriteSeekBytes(BB_Writer *bw, u64 num_bytes);
|
|||||||
//~ Writer debug
|
//~ Writer debug
|
||||||
|
|
||||||
#if BITBUFF_DEBUG
|
#if BITBUFF_DEBUG
|
||||||
void BB_WriteDebugMagic(BB_Writer *bw, BB_DebugMagicKind magic, u8 num_bits);
|
void BB_WriteDebugMagic(BB_Writer *bw, BB_DebugMagicKind magic, u8 num_bits);
|
||||||
void BB_WriteDebugMarker(BB_Writer *bw, String name);
|
void BB_WriteDebugMarker(BB_Writer *bw, String name);
|
||||||
#else
|
#else
|
||||||
#define BB_WriteDebugMagic(bw, magic, num_bits)
|
#define BB_WriteDebugMagic(bw, magic, num_bits)
|
||||||
#define BB_WriteDebugMarker(bw, name)
|
#define BB_WriteDebugMarker(bw, name)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -5,53 +5,53 @@
|
|||||||
//- Api
|
//- Api
|
||||||
#include "base.cgh"
|
#include "base.cgh"
|
||||||
#if IsLanguageC
|
#if IsLanguageC
|
||||||
# include "base_intrinsics.h"
|
#include "base_intrinsics.h"
|
||||||
# include "base_memory.h"
|
#include "base_memory.h"
|
||||||
# include "base_arena.h"
|
#include "base_arena.h"
|
||||||
# include "base_futex.h"
|
#include "base_futex.h"
|
||||||
# include "base_sync.h"
|
#include "base_sync.h"
|
||||||
# include "base_time.h"
|
#include "base_time.h"
|
||||||
# include "base_uid.h"
|
#include "base_uid.h"
|
||||||
# include "base_math.h"
|
#include "base_math.h"
|
||||||
# include "base_wave.h"
|
#include "base_wave.h"
|
||||||
# include "base_string.h"
|
#include "base_string.h"
|
||||||
# include "base_cmdline.h"
|
#include "base_cmdline.h"
|
||||||
# include "base_log.h"
|
#include "base_log.h"
|
||||||
# include "base_uni.h"
|
#include "base_uni.h"
|
||||||
# include "base_gstat.h"
|
#include "base_gstat.h"
|
||||||
# include "base_buddy.h"
|
#include "base_buddy.h"
|
||||||
# include "base_rand.h"
|
#include "base_rand.h"
|
||||||
# include "base_util.h"
|
#include "base_util.h"
|
||||||
# include "base_bitbuff.h"
|
#include "base_bitbuff.h"
|
||||||
# include "base_resource.h"
|
#include "base_resource.h"
|
||||||
# include "base_controller.h"
|
#include "base_controller.h"
|
||||||
# include "base_async.h"
|
#include "base_async.h"
|
||||||
# include "base_state.h"
|
#include "base_state.h"
|
||||||
#elif IsLanguageG
|
#elif IsLanguageG
|
||||||
# include "base_shader.gh"
|
#include "base_shader.gh"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//- Impl
|
//- Impl
|
||||||
#if IsLanguageC
|
#if IsLanguageC
|
||||||
# include "base_memory.c"
|
#include "base_memory.c"
|
||||||
# include "base_arena.c"
|
#include "base_arena.c"
|
||||||
# include "base_sync.c"
|
#include "base_sync.c"
|
||||||
# include "base_uid.c"
|
#include "base_uid.c"
|
||||||
# include "base_string.c"
|
#include "base_string.c"
|
||||||
# include "base_cmdline.c"
|
#include "base_cmdline.c"
|
||||||
# include "base_uni.c"
|
#include "base_uni.c"
|
||||||
# include "base_buddy.c"
|
#include "base_buddy.c"
|
||||||
# include "base_math.c"
|
#include "base_math.c"
|
||||||
# include "base_wave.c"
|
#include "base_wave.c"
|
||||||
# include "base_rand.c"
|
#include "base_rand.c"
|
||||||
# include "base_bitbuff.c"
|
#include "base_bitbuff.c"
|
||||||
# include "base_resource.c"
|
#include "base_resource.c"
|
||||||
# include "base_controller.c"
|
#include "base_controller.c"
|
||||||
# include "base_async.c"
|
#include "base_async.c"
|
||||||
# include "base_state.c"
|
#include "base_state.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//- Include base_win32
|
//- Include base_win32
|
||||||
#if IsLanguageC && IsPlatformWindows
|
#if IsLanguageC && IsPlatformWindows
|
||||||
# include "base_win32/base_win32_inc.h"
|
#include "base_win32/base_win32_inc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -28,11 +28,11 @@ Struct(LogEventsArray)
|
|||||||
|
|
||||||
/* Log level configuration */
|
/* Log level configuration */
|
||||||
#ifndef LogLevel_CompTime
|
#ifndef LogLevel_CompTime
|
||||||
# if IsRtcEnabled
|
#if IsRtcEnabled
|
||||||
# define LogLevel_CompTime LogLevel_Debug
|
#define LogLevel_CompTime LogLevel_Debug
|
||||||
# else
|
#else
|
||||||
# define LogLevel_CompTime LogLevel_Info
|
#define LogLevel_CompTime LogLevel_Info
|
||||||
# endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LogLevel_None -1
|
#define LogLevel_None -1
|
||||||
@ -82,51 +82,51 @@ Global Readonly LogLevelSettings log_settings[LogLevel_Count] = {
|
|||||||
//~ Compile-time logging macros
|
//~ Compile-time logging macros
|
||||||
|
|
||||||
#if LogLevel(LogLevel_Critical)
|
#if LogLevel(LogLevel_Critical)
|
||||||
# define LogCritical(msg) Log_(LogLevel_Critical, msg)
|
#define LogCritical(msg) Log_(LogLevel_Critical, msg)
|
||||||
# define LogCriticalF(fmt_lit, ...) LogF_(LogLevel_Critical, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
#define LogCriticalF(fmt_lit, ...) LogF_(LogLevel_Critical, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||||
#else
|
#else
|
||||||
# define LogCritical(msg)
|
#define LogCritical(msg)
|
||||||
# define LogCriticalF(...)
|
#define LogCriticalF(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LogLevel(LogLevel_Error)
|
#if LogLevel(LogLevel_Error)
|
||||||
# define LogError(msg) Log_(LogLevel_Error, msg)
|
#define LogError(msg) Log_(LogLevel_Error, msg)
|
||||||
# define LogErrorF(fmt_lit, ...) LogF_(LogLevel_Error, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
#define LogErrorF(fmt_lit, ...) LogF_(LogLevel_Error, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||||
#else
|
#else
|
||||||
# define LogError(msg)
|
#define LogError(msg)
|
||||||
# define LogErrorF(...)
|
#define LogErrorF(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LogLevel(LogLevel_Warning)
|
#if LogLevel(LogLevel_Warning)
|
||||||
# define LogWarning(msg) Log_(LogLevel_Warning, msg)
|
#define LogWarning(msg) Log_(LogLevel_Warning, msg)
|
||||||
# define LogWarningF(fmt_lit, ...) LogF_(LogLevel_Warning, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
#define LogWarningF(fmt_lit, ...) LogF_(LogLevel_Warning, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||||
#else
|
#else
|
||||||
# define LogWarning(msg)
|
#define LogWarning(msg)
|
||||||
# define LogWarningF(...)
|
#define LogWarningF(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LogLevel(LogLevel_Success)
|
#if LogLevel(LogLevel_Success)
|
||||||
# define LogSuccess(msg) Log_(LogLevel_Success, msg)
|
#define LogSuccess(msg) Log_(LogLevel_Success, msg)
|
||||||
# define LogSuccessF(fmt_lit, ...) LogF_(LogLevel_Success, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
#define LogSuccessF(fmt_lit, ...) LogF_(LogLevel_Success, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||||
#else
|
#else
|
||||||
# define LogSuccess(msg)
|
#define LogSuccess(msg)
|
||||||
# define LogSuccessF(...)
|
#define LogSuccessF(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LogLevel(LogLevel_Info)
|
#if LogLevel(LogLevel_Info)
|
||||||
# define LogInfo(msg) Log_(LogLevel_Info, msg)
|
#define LogInfo(msg) Log_(LogLevel_Info, msg)
|
||||||
# define LogInfoF(fmt_lit, ...) LogF_(LogLevel_Info, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
#define LogInfoF(fmt_lit, ...) LogF_(LogLevel_Info, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||||
#else
|
#else
|
||||||
# define LogInfo(msg)
|
#define LogInfo(msg)
|
||||||
# define LogInfoF(...)
|
#define LogInfoF(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LogLevel(LogLevel_Debug)
|
#if LogLevel(LogLevel_Debug)
|
||||||
# define LogDebug(msg) Log_(LogLevel_Debug, msg)
|
#define LogDebug(msg) Log_(LogLevel_Debug, msg)
|
||||||
# define LogDebugF(fmt_lit, ...) LogF_(LogLevel_Debug, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
#define LogDebugF(fmt_lit, ...) LogF_(LogLevel_Debug, Lit(fmt_lit) , ## __VA_ARGS__, FmtEnd)
|
||||||
#else
|
#else
|
||||||
# define LogDebug(msg)
|
#define LogDebug(msg)
|
||||||
# define LogDebugF(...)
|
#define LogDebugF(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -34,9 +34,9 @@ void SetMemoryReadWrite(void *address, u64 size);
|
|||||||
//~ Crtlib stubs
|
//~ Crtlib stubs
|
||||||
|
|
||||||
#if IsCrtlibEnabled
|
#if IsCrtlibEnabled
|
||||||
# include <memory.h>
|
#include <memory.h>
|
||||||
#else
|
#else
|
||||||
void *memcpy(void *__restrict dst, const void *__restrict src, u64 n);
|
void *memcpy(void *__restrict dst, const void *__restrict src, u64 n);
|
||||||
void *memset(void *dst, i32 c, u64 n);
|
void *memset(void *dst, i32 c, u64 n);
|
||||||
i32 memcmp(const void *p1, const void *p2, u64 n);
|
i32 memcmp(const void *p1, const void *p2, u64 n);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -783,7 +783,8 @@ String FormatString(Arena *arena, String fmt, FmtArgArray args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if IsRtcEnabled
|
if (IsRtcEnabled)
|
||||||
|
{
|
||||||
if (!no_more_valid_args)
|
if (!no_more_valid_args)
|
||||||
{
|
{
|
||||||
FmtArg last_arg = Zi;
|
FmtArg last_arg = Zi;
|
||||||
@ -794,7 +795,7 @@ String FormatString(Arena *arena, String fmt, FmtArgArray args)
|
|||||||
Assert(last_arg.kind == FmtArgKind_End);
|
Assert(last_arg.kind == FmtArgKind_End);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,9 +55,9 @@ Lock LockSpinE(Mutex *m, i32 spin)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if IsRtcEnabled
|
#if IsRtcEnabled
|
||||||
Atomic32Set(&m->exclusive_thread_id, ThreadId());
|
Atomic32Set(&m->exclusive_thread_id, ThreadId());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Lock lock = Zi;
|
Lock lock = Zi;
|
||||||
lock.exclusive = 1;
|
lock.exclusive = 1;
|
||||||
@ -122,9 +122,9 @@ void Unlock(Lock *l)
|
|||||||
Mutex *m = l->mutex;
|
Mutex *m = l->mutex;
|
||||||
if (l->exclusive)
|
if (l->exclusive)
|
||||||
{
|
{
|
||||||
#if IsRtcEnabled
|
#if IsRtcEnabled
|
||||||
Atomic32Set(&m->exclusive_thread_id, 0);
|
Atomic32Set(&m->exclusive_thread_id, 0);
|
||||||
#endif
|
#endif
|
||||||
Atomic32Set(&m->v, 0);
|
Atomic32Set(&m->v, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -53,11 +53,11 @@ void Unlock(Lock *lock);
|
|||||||
|
|
||||||
//- Lock assertion
|
//- Lock assertion
|
||||||
#if IsRtcEnabled
|
#if IsRtcEnabled
|
||||||
# define AssertLockedE(l, m) Assert((l)->mutex == (m) && (l)->exclusive == 1)
|
#define AssertLockedE(l, m) Assert((l)->mutex == (m) && (l)->exclusive == 1)
|
||||||
# define AssertLockedES(l, m) Assert((l)->mutex == (m))
|
#define AssertLockedES(l, m) Assert((l)->mutex == (m))
|
||||||
#else
|
#else
|
||||||
# define AssertLockedE(l, m)
|
#define AssertLockedE(l, m)
|
||||||
# define AssertLockedES(l, m)
|
#define AssertLockedES(l, m)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -47,8 +47,10 @@ Utf8DecodeResult DecodeUtf8(String str)
|
|||||||
{
|
{
|
||||||
u8 c1 = str.text[1];
|
u8 c1 = str.text[1];
|
||||||
u8 c2 = str.text[2];
|
u8 c2 = str.text[2];
|
||||||
if (lengths[c1 >> 3] == 0 &&
|
if (
|
||||||
lengths[c2 >> 3] == 0)
|
lengths[c1 >> 3] == 0 &&
|
||||||
|
lengths[c2 >> 3] == 0
|
||||||
|
)
|
||||||
{
|
{
|
||||||
codepoint = (c2 & 0x3F) << 0;
|
codepoint = (c2 & 0x3F) << 0;
|
||||||
codepoint |= (c1 & 0x3F) << 6;
|
codepoint |= (c1 & 0x3F) << 6;
|
||||||
@ -65,9 +67,11 @@ Utf8DecodeResult DecodeUtf8(String str)
|
|||||||
u8 c1 = str.text[1];
|
u8 c1 = str.text[1];
|
||||||
u8 c2 = str.text[2];
|
u8 c2 = str.text[2];
|
||||||
u8 c3 = str.text[3];
|
u8 c3 = str.text[3];
|
||||||
if (lengths[c1 >> 3] == 0 &&
|
if (
|
||||||
|
lengths[c1 >> 3] == 0 &&
|
||||||
lengths[c2 >> 3] == 0 &&
|
lengths[c2 >> 3] == 0 &&
|
||||||
lengths[c3 >> 3] == 0)
|
lengths[c3 >> 3] == 0
|
||||||
|
)
|
||||||
{
|
{
|
||||||
codepoint = (c3 & 0x3F) << 0;
|
codepoint = (c3 & 0x3F) << 0;
|
||||||
codepoint |= (c2 & 0x3F) << 6;
|
codepoint |= (c2 & 0x3F) << 6;
|
||||||
|
|||||||
@ -34,12 +34,14 @@ typedef void WaveLaneEntryFunc(WaveLaneCtx *lane);
|
|||||||
//~ Wave sync ops
|
//~ Wave sync ops
|
||||||
|
|
||||||
void WaveSyncEx(WaveLaneCtx *lane, u64 spin_count);
|
void WaveSyncEx(WaveLaneCtx *lane, u64 spin_count);
|
||||||
|
void WaveSyncBroadcastEx_(WaveLaneCtx *lane, u32 broadcast_lane_idx, void *broadcast_ptr, u64 broadcast_size, u64 spin_count);
|
||||||
|
|
||||||
#define WaveSync(lane) \
|
#define WaveSync(lane) \
|
||||||
WaveSyncEx((lane), (lane)->default_spin_count)
|
WaveSyncEx((lane), (lane)->default_spin_count)
|
||||||
|
|
||||||
void WaveSyncBroadcastEx_(WaveLaneCtx *lane, u32 broadcast_lane_idx, void *broadcast_ptr, u64 broadcast_size, u64 spin_count);
|
|
||||||
#define WaveSyncBroadcastEx(lane, broadcast_lane_idx, broadcast_ptr, spin_count) \
|
#define WaveSyncBroadcastEx(lane, broadcast_lane_idx, broadcast_ptr, spin_count) \
|
||||||
WaveSyncBroadcastEx_((lane), (broadcast_lane_idx), (broadcast_ptr), sizeof(*(broadcast_ptr)), (spin_count))
|
WaveSyncBroadcastEx_((lane), (broadcast_lane_idx), (broadcast_ptr), sizeof(*(broadcast_ptr)), (spin_count))
|
||||||
|
|
||||||
#define WaveSyncBroadcast(lane, broadcast_lane_idx, broadcast_ptr) \
|
#define WaveSyncBroadcast(lane, broadcast_lane_idx, broadcast_ptr) \
|
||||||
WaveSyncBroadcastEx_((lane), (broadcast_lane_idx), (broadcast_ptr), sizeof(*(broadcast_ptr)), (lane)->default_spin_count)
|
WaveSyncBroadcastEx_((lane), (broadcast_lane_idx), (broadcast_ptr), sizeof(*(broadcast_ptr)), (lane)->default_spin_count)
|
||||||
|
|
||||||
|
|||||||
@ -516,39 +516,37 @@ i32 W32_Main(void)
|
|||||||
//~ Crt main
|
//~ Crt main
|
||||||
|
|
||||||
#if IsCrtlibEnabled
|
#if IsCrtlibEnabled
|
||||||
# if IsConsoleApp
|
#if IsConsoleApp
|
||||||
int main(char **argc, int argv)
|
int main(char **argc, int argv)
|
||||||
{
|
{
|
||||||
return W32_Main();
|
return W32_Main();
|
||||||
}
|
}
|
||||||
# else
|
#else
|
||||||
int CALLBACK wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev_instance, _In_ LPWSTR cmdline_wstr, _In_ int show_code)
|
int CALLBACK wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev_instance, _In_ LPWSTR cmdline_wstr, _In_ int show_code)
|
||||||
{
|
{
|
||||||
return W32_Main();
|
return W32_Main();
|
||||||
}
|
}
|
||||||
# endif /* IsConsoleApp */
|
#endif /* IsConsoleApp */
|
||||||
#endif /* IsCrtlibEnabled */
|
#endif /* IsCrtlibEnabled */
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Crt stub
|
//~ Crt stub
|
||||||
|
|
||||||
#if !IsCrtlibEnabled
|
#if !IsCrtlibEnabled
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
|
||||||
|
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||||
|
|
||||||
#pragma clang diagnostic push
|
/* Enable floating point */
|
||||||
#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
|
__attribute((used))
|
||||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
int _fltused;
|
||||||
|
|
||||||
/* Enable floating point */
|
__attribute((used))
|
||||||
__attribute((used))
|
void __stdcall wWinMainCRTStartup(void)
|
||||||
int _fltused;
|
{
|
||||||
|
|
||||||
__attribute((used))
|
|
||||||
void __stdcall wWinMainCRTStartup(void)
|
|
||||||
{
|
|
||||||
i32 result = W32_Main();
|
i32 result = W32_Main();
|
||||||
ExitProcess(result);
|
ExitProcess(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
|
|
||||||
|
#pragma clang diagnostic pop
|
||||||
#endif /* !IsCrtlibEnabled */
|
#endif /* !IsCrtlibEnabled */
|
||||||
|
|||||||
@ -7,28 +7,28 @@
|
|||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#define UNICODE
|
#define UNICODE
|
||||||
#pragma warning(push, 0)
|
#pragma warning(push, 0)
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <combaseapi.h>
|
#include <combaseapi.h>
|
||||||
#include <dcommon.h>
|
#include <dcommon.h>
|
||||||
#include <initguid.h>
|
#include <initguid.h>
|
||||||
#include <unknwn.h>
|
#include <unknwn.h>
|
||||||
#include <objbase.h>
|
#include <objbase.h>
|
||||||
#include <uuids.h>
|
#include <uuids.h>
|
||||||
#include <Knownfolders.h>
|
#include <Knownfolders.h>
|
||||||
#include <WinSock2.h>
|
#include <WinSock2.h>
|
||||||
#include <TlHelp32.h>
|
#include <TlHelp32.h>
|
||||||
#include <WS2tcpip.h>
|
#include <WS2tcpip.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
#include <ShlObj_core.h>
|
#include <ShlObj_core.h>
|
||||||
#include <fileapi.h>
|
#include <fileapi.h>
|
||||||
#include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
#include <avrt.h>
|
#include <avrt.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
|
||||||
#ifndef BCRYPT_RNG_ALG_HANDLE
|
#ifndef BCRYPT_RNG_ALG_HANDLE
|
||||||
#define BCRYPT_RNG_ALG_HANDLE ((void *)0x00000081)
|
#define BCRYPT_RNG_ALG_HANDLE ((void *)0x00000081)
|
||||||
u32 BCryptGenRandom(void *algorithm, u8 *buffer, u32 buffer_size, u32 flags);
|
u32 BCryptGenRandom(void *algorithm, u8 *buffer, u32 buffer_size, u32 flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//- Windows libs
|
//- Windows libs
|
||||||
|
|||||||
@ -186,14 +186,16 @@ CLD_GjkData CLD_GjkDataFromShapes(CLD_Shape *shape0, CLD_Shape *shape1, Xform xf
|
|||||||
CLD_DBGSTEP;
|
CLD_DBGSTEP;
|
||||||
m = CLD_MenkowskiPointFromDir(shape0, shape1, xf0, xf1, dir);
|
m = CLD_MenkowskiPointFromDir(shape0, shape1, xf0, xf1, dir);
|
||||||
/* Check that new point is far enough away from existing points */
|
/* Check that new point is far enough away from existing points */
|
||||||
if (Vec2LenSq(SubVec2(m.p, s.a.p)) < min_unique_pt_dist_sq ||
|
if (
|
||||||
Vec2LenSq(SubVec2(m.p, s.b.p)) < min_unique_pt_dist_sq ||
|
Vec2LenSq(SubVec2(m.p, s.a.p)) < min_unique_pt_dist_sq ||
|
||||||
(
|
Vec2LenSq(SubVec2(m.p, s.b.p)) < min_unique_pt_dist_sq || (
|
||||||
(num_removed >= 1) && (
|
(num_removed >= 1) && (
|
||||||
(Vec2LenSq(SubVec2(m.p, removed_a)) < min_unique_pt_dist_sq) ||
|
(Vec2LenSq(SubVec2(m.p, removed_a)) < min_unique_pt_dist_sq) ||
|
||||||
(num_removed >= 2 && Vec2LenSq(SubVec2(m.p, removed_b)) < min_unique_pt_dist_sq))
|
(num_removed >= 2 && Vec2LenSq(SubVec2(m.p, removed_b)) < min_unique_pt_dist_sq)
|
||||||
|
)
|
||||||
) ||
|
) ||
|
||||||
AbsF32(WedgeVec2(SubVec2(s.b.p, s.a.p), SubVec2(m.p, s.a.p))) < min_unique_pt_dist_sq)
|
AbsF32(WedgeVec2(SubVec2(s.b.p, s.a.p), SubVec2(m.p, s.a.p))) < min_unique_pt_dist_sq
|
||||||
|
)
|
||||||
{
|
{
|
||||||
overlapping = 0;
|
overlapping = 0;
|
||||||
break;
|
break;
|
||||||
@ -293,7 +295,7 @@ CLD_GjkData CLD_GjkDataFromShapes(CLD_Shape *shape0, CLD_Shape *shape1, Xform xf
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if COLLIDER_DEBUG
|
#if COLLIDER_DEBUG
|
||||||
abort :
|
abort:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CLD_GjkData result = {
|
CLD_GjkData result = {
|
||||||
@ -382,7 +384,7 @@ CLD_EpaData CLD_EpaDataFromShapes(CLD_Shape *shape0, CLD_Shape *shape1, Xform xf
|
|||||||
Vec2 dir = MulVec2(PerpVec2(vab), winding);
|
Vec2 dir = MulVec2(PerpVec2(vab), winding);
|
||||||
CLD_MenkowskiPoint m = CLD_MenkowskiPointFromDir(shape0, shape1, xf0, xf1, dir);
|
CLD_MenkowskiPoint m = CLD_MenkowskiPointFromDir(shape0, shape1, xf0, xf1, dir);
|
||||||
|
|
||||||
#if COLLIDER_DEBUG
|
#if COLLIDER_DEBUG
|
||||||
{
|
{
|
||||||
/* If debug step count is reached, we still want to inspect the normal at the step */
|
/* If debug step count is reached, we still want to inspect the normal at the step */
|
||||||
normal = NormVec2(dir);
|
normal = NormVec2(dir);
|
||||||
@ -455,7 +457,7 @@ CLD_EpaData CLD_EpaDataFromShapes(CLD_Shape *shape0, CLD_Shape *shape1, Xform xf
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if COLLIDER_DEBUG
|
#if COLLIDER_DEBUG
|
||||||
abort :
|
abort:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CLD_EpaData result = {
|
CLD_EpaData result = {
|
||||||
@ -560,7 +562,7 @@ CLD_CollisionData CLD_CollisionDataFromShapes(CLD_Shape *shape0, CLD_Shape *shap
|
|||||||
#if COLLIDER_DEBUG
|
#if COLLIDER_DEBUG
|
||||||
gjk_result = CLD_GjkDataFromShapes(shape0, shape1, xf0, xf1, min_unique_pt_dist_sq, dbg_step);
|
gjk_result = CLD_GjkDataFromShapes(shape0, shape1, xf0, xf1, min_unique_pt_dist_sq, dbg_step);
|
||||||
dbg_step = gjk_result.dbg_step;
|
dbg_step = gjk_result.dbg_step;
|
||||||
#else
|
#else
|
||||||
gjk_result = CLD_GjkDataFromShapes(shape0, shape1, xf0, xf1, min_unique_pt_dist_sq);
|
gjk_result = CLD_GjkDataFromShapes(shape0, shape1, xf0, xf1, min_unique_pt_dist_sq);
|
||||||
#endif
|
#endif
|
||||||
CLD_DBGSTEP;
|
CLD_DBGSTEP;
|
||||||
@ -569,7 +571,7 @@ CLD_CollisionData CLD_CollisionDataFromShapes(CLD_Shape *shape0, CLD_Shape *shap
|
|||||||
#if COLLIDER_DEBUG
|
#if COLLIDER_DEBUG
|
||||||
epa_result = CLD_EpaDataFromShapes(shape0, shape1, xf0, xf1, gjk_result, min_unique_pt_dist_sq, max_epa_iterations, dbg_step);
|
epa_result = CLD_EpaDataFromShapes(shape0, shape1, xf0, xf1, gjk_result, min_unique_pt_dist_sq, max_epa_iterations, dbg_step);
|
||||||
dbg_step = epa_result.dbg_step;
|
dbg_step = epa_result.dbg_step;
|
||||||
#else
|
#else
|
||||||
epa_result = CLD_EpaDataFromShapes(shape0, shape1, xf0, xf1, gjk_result, min_unique_pt_dist_sq, max_epa_iterations);
|
epa_result = CLD_EpaDataFromShapes(shape0, shape1, xf0, xf1, gjk_result, min_unique_pt_dist_sq, max_epa_iterations);
|
||||||
#endif
|
#endif
|
||||||
normal = epa_result.normal;
|
normal = epa_result.normal;
|
||||||
@ -802,7 +804,7 @@ CLD_CollisionData CLD_CollisionDataFromShapes(CLD_Shape *shape0, CLD_Shape *shap
|
|||||||
|
|
||||||
#if COLLIDER_DEBUG
|
#if COLLIDER_DEBUG
|
||||||
result.solved = 1;
|
result.solved = 1;
|
||||||
abort:
|
abort:
|
||||||
result.simplex = gjk_result.simplex;
|
result.simplex = gjk_result.simplex;
|
||||||
result.prototype.len = epa_result.prototype.len;
|
result.prototype.len = epa_result.prototype.len;
|
||||||
CopyBytes(result.prototype.points, epa_result.prototype.points, sizeof(result.prototype.points[0]) * result.prototype.len);
|
CopyBytes(result.prototype.points, epa_result.prototype.points, sizeof(result.prototype.points[0]) * result.prototype.len);
|
||||||
@ -842,7 +844,7 @@ CLD_ClosestPointData CLD_ClosestPointDataFromShapes(CLD_Shape *shape0, CLD_Shape
|
|||||||
#if COLLIDER_DEBUG
|
#if COLLIDER_DEBUG
|
||||||
gjk_result = CLD_GjkDataFromShapes(shape0, shape1, xf0, xf1, min_unique_pt_dist_sq, dbg_step);
|
gjk_result = CLD_GjkDataFromShapes(shape0, shape1, xf0, xf1, min_unique_pt_dist_sq, dbg_step);
|
||||||
dbg_step = gjk_result.dbg_step;
|
dbg_step = gjk_result.dbg_step;
|
||||||
#else
|
#else
|
||||||
gjk_result = CLD_GjkDataFromShapes(shape0, shape1, xf0, xf1, min_unique_pt_dist_sq);
|
gjk_result = CLD_GjkDataFromShapes(shape0, shape1, xf0, xf1, min_unique_pt_dist_sq);
|
||||||
#endif
|
#endif
|
||||||
CLD_DBGSTEP;
|
CLD_DBGSTEP;
|
||||||
@ -851,7 +853,7 @@ CLD_ClosestPointData CLD_ClosestPointDataFromShapes(CLD_Shape *shape0, CLD_Shape
|
|||||||
#if COLLIDER_DEBUG
|
#if COLLIDER_DEBUG
|
||||||
epa_result = CLD_EpaDataFromShapes(shape0, shape1, xf0, xf1, gjk_result, min_unique_pt_dist_sq, max_epa_iterations, dbg_step);
|
epa_result = CLD_EpaDataFromShapes(shape0, shape1, xf0, xf1, gjk_result, min_unique_pt_dist_sq, max_epa_iterations, dbg_step);
|
||||||
dbg_step = epa_result.dbg_step;
|
dbg_step = epa_result.dbg_step;
|
||||||
#else
|
#else
|
||||||
epa_result = CLD_EpaDataFromShapes(shape0, shape1, xf0, xf1, gjk_result, min_unique_pt_dist_sq, max_epa_iterations);
|
epa_result = CLD_EpaDataFromShapes(shape0, shape1, xf0, xf1, gjk_result, min_unique_pt_dist_sq, max_epa_iterations);
|
||||||
#endif
|
#endif
|
||||||
CLD_DBGSTEP;
|
CLD_DBGSTEP;
|
||||||
@ -889,7 +891,7 @@ CLD_ClosestPointData CLD_ClosestPointDataFromShapes(CLD_Shape *shape0, CLD_Shape
|
|||||||
|
|
||||||
#if COLLIDER_DEBUG
|
#if COLLIDER_DEBUG
|
||||||
result.solved = 1;
|
result.solved = 1;
|
||||||
abort:
|
abort:
|
||||||
result.simplex = gjk_result.simplex;
|
result.simplex = gjk_result.simplex;
|
||||||
result.prototype.len = epa_result.prototype.len;
|
result.prototype.len = epa_result.prototype.len;
|
||||||
CopyBytes(result.prototype.points, epa_result.prototype.points, sizeof(result.prototype.points[0]) * result.prototype.len);
|
CopyBytes(result.prototype.points, epa_result.prototype.points, sizeof(result.prototype.points[0]) * result.prototype.len);
|
||||||
|
|||||||
@ -149,7 +149,7 @@ void CLD_DebugBreakable(void);
|
|||||||
CLD_DebugBreakable(); \
|
CLD_DebugBreakable(); \
|
||||||
} (void)0
|
} (void)0
|
||||||
#else
|
#else
|
||||||
#define CLD_DBGSTEP
|
#define CLD_DBGSTEP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|||||||
30
src/config.h
30
src/config.h
@ -4,17 +4,17 @@
|
|||||||
|
|
||||||
/* Window title */
|
/* Window title */
|
||||||
#if IsRtcEnabled
|
#if IsRtcEnabled
|
||||||
# if IsDeveloperModeEnabled
|
#if IsDeveloperModeEnabled
|
||||||
# define WINDOW_TITLE "Debug (Developer Build)"
|
#define WINDOW_TITLE "Debug (Developer Build)"
|
||||||
# else
|
#else
|
||||||
# define WINDOW_TITLE "Debug"
|
#define WINDOW_TITLE "Debug"
|
||||||
# endif
|
#endif
|
||||||
#else
|
#else
|
||||||
# if IsDeveloperModeEnabled
|
#if IsDeveloperModeEnabled
|
||||||
# define WINDOW_TITLE "Power Play (Developer Build)"
|
#define WINDOW_TITLE "Power Play (Developer Build)"
|
||||||
# else
|
#else
|
||||||
# define WINDOW_TITLE "Power Play"
|
#define WINDOW_TITLE "Power Play"
|
||||||
# endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEFAULT_CAMERA_WIDTH (16)
|
#define DEFAULT_CAMERA_WIDTH (16)
|
||||||
@ -33,7 +33,7 @@
|
|||||||
#define USER_INTERP_RATIO 1.2
|
#define USER_INTERP_RATIO 1.2
|
||||||
#define USER_INTERP_ENABLED 1
|
#define USER_INTERP_ENABLED 1
|
||||||
|
|
||||||
/* 64^2 = 4096 bins */
|
/* 64^2 = 4096 bins */
|
||||||
#define SPACE_CELL_BINS_SQRT (64)
|
#define SPACE_CELL_BINS_SQRT (64)
|
||||||
#define SPACE_CELL_SIZE (1)
|
#define SPACE_CELL_SIZE (1)
|
||||||
|
|
||||||
@ -56,11 +56,11 @@
|
|||||||
#define SIM_PLAYER_AIM 1
|
#define SIM_PLAYER_AIM 1
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
# define SIM_MAX_LINEAR_VELOCITY 500
|
#define SIM_MAX_LINEAR_VELOCITY 500
|
||||||
# define SIM_MAX_ANGULAR_VELOCITY (Tau * 20)
|
#define SIM_MAX_ANGULAR_VELOCITY (Tau * 20)
|
||||||
#else
|
#else
|
||||||
# define SIM_MAX_LINEAR_VELOCITY F32Infinity
|
#define SIM_MAX_LINEAR_VELOCITY F32Infinity
|
||||||
# define SIM_MAX_ANGULAR_VELOCITY F32Infinity
|
#define SIM_MAX_ANGULAR_VELOCITY F32Infinity
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define COLLIDER_DEBUG 0
|
#define COLLIDER_DEBUG 0
|
||||||
|
|||||||
@ -293,7 +293,7 @@ void D_DrawUiRect(GPU_RenderSig *sig, D_UiRectParams params)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Text
|
//~ Text
|
||||||
|
|
||||||
/* Returns the rect of the text area */
|
/* Returns the rect of the text area */
|
||||||
Rect draw_text(GPU_RenderSig *sig, D_TextParams params)
|
Rect draw_text(GPU_RenderSig *sig, D_TextParams params)
|
||||||
{
|
{
|
||||||
TempArena scratch = BeginScratchNoConflict();
|
TempArena scratch = BeginScratchNoConflict();
|
||||||
|
|||||||
@ -610,60 +610,82 @@ void *G_HostPointerFromResource(G_ResourceHandle resource);
|
|||||||
|
|
||||||
u32 G_PushRef(G_ArenaHandle arena, G_ResourceHandle resource, G_RefDesc desc);
|
u32 G_PushRef(G_ArenaHandle arena, G_ResourceHandle resource, G_RefDesc desc);
|
||||||
|
|
||||||
#define G_PushStructuredBufferRef(arena, resource, type, ...) (G_StructuredBufferRef) { \
|
#define G_PushStructuredBufferRef(arena, resource, type, ...)(G_StructuredBufferRef) { \
|
||||||
.v = G_PushRef((arena), (resource), \
|
.v = G_PushRef( \
|
||||||
(G_RefDesc) { .kind = G_RefKind_StructuredBuffer, .element_size = sizeof(type), __VA_ARGS__ }) \
|
(arena), (resource), \
|
||||||
}
|
(G_RefDesc) { .kind = G_RefKind_StructuredBuffer, .element_size = sizeof(type), __VA_ARGS__ } \
|
||||||
|
) \
|
||||||
|
}
|
||||||
|
|
||||||
#define G_PushRWStructuredBufferRef(arena, resource, type, ...) (G_RWStructuredBufferRef) { \
|
#define G_PushRWStructuredBufferRef(arena, resource, type, ...)(G_RWStructuredBufferRef) { \
|
||||||
.v = G_PushRef((arena), (resource), \
|
.v = G_PushRef( \
|
||||||
(G_RefDesc) { .kind = G_RefKind_RWStructuredBuffer, .element_size = sizeof(type), __VA_ARGS__ }) \
|
(arena), (resource), \
|
||||||
}
|
(G_RefDesc) { .kind = G_RefKind_RWStructuredBuffer, .element_size = sizeof(type), __VA_ARGS__ } \
|
||||||
|
) \
|
||||||
|
}
|
||||||
|
|
||||||
#define G_PushByteAddressBufferRef(arena, resource, ...) (G_ByteAddressBufferRef) { \
|
#define G_PushByteAddressBufferRef(arena, resource, ...)(G_ByteAddressBufferRef) { \
|
||||||
.v = G_PushRef((arena), (resource), \
|
.v = G_PushRef( \
|
||||||
(G_RefDesc) { .kind = G_RefKind_ByteAddressBuffer, __VA_ARGS__ }) \
|
(arena), (resource), \
|
||||||
}
|
(G_RefDesc) { .kind = G_RefKind_ByteAddressBuffer, __VA_ARGS__ } \
|
||||||
|
) \
|
||||||
|
}
|
||||||
|
|
||||||
#define G_PushRWByteAddressBufferRef(arena, resource, ...) (G_RWByteAddressBufferRef) { \
|
#define G_PushRWByteAddressBufferRef(arena, resource, ...)(G_RWByteAddressBufferRef) { \
|
||||||
.v = G_PushRef((arena), (resource), \
|
.v = G_PushRef( \
|
||||||
(G_RefDesc) { .kind = G_RefKind_RWByteAddressBuffer, __VA_ARGS__ }) \
|
(arena), (resource), \
|
||||||
}
|
(G_RefDesc) { .kind = G_RefKind_RWByteAddressBuffer, __VA_ARGS__ } \
|
||||||
|
) \
|
||||||
|
}
|
||||||
|
|
||||||
#define G_PushTexture1DRef(arena, resource, ...) (G_Texture1DRef) { \
|
#define G_PushTexture1DRef(arena, resource, ...)(G_Texture1DRef) { \
|
||||||
.v = G_PushRef((arena), (resource), \
|
.v = G_PushRef( \
|
||||||
(G_RefDesc) { .kind = G_RefKind_Texture1D, __VA_ARGS__ }) \
|
(arena), (resource), \
|
||||||
}
|
(G_RefDesc) { .kind = G_RefKind_Texture1D, __VA_ARGS__ } \
|
||||||
|
) \
|
||||||
|
}
|
||||||
|
|
||||||
#define G_PushRWTexture1DRef(arena, resource, ...) (G_RWTexture1DRef) { \
|
#define G_PushRWTexture1DRef(arena, resource, ...)(G_RWTexture1DRef) { \
|
||||||
.v = G_PushRef((arena), (resource), \
|
.v = G_PushRef( \
|
||||||
(G_RefDesc) { .kind = G_RefKind_RWTexture1D, __VA_ARGS__ }) \
|
(arena), (resource), \
|
||||||
}
|
(G_RefDesc) { .kind = G_RefKind_RWTexture1D, __VA_ARGS__ } \
|
||||||
|
) \
|
||||||
|
}
|
||||||
|
|
||||||
#define G_PushTexture2DRef(arena, resource, ...) (G_Texture2DRef) { \
|
#define G_PushTexture2DRef(arena, resource, ...)(G_Texture2DRef) { \
|
||||||
.v = G_PushRef((arena), (resource), \
|
.v = G_PushRef( \
|
||||||
(G_RefDesc) { .kind = G_RefKind_Texture2D, __VA_ARGS__ }) \
|
(arena), (resource), \
|
||||||
}
|
(G_RefDesc) { .kind = G_RefKind_Texture2D, __VA_ARGS__ } \
|
||||||
|
) \
|
||||||
|
}
|
||||||
|
|
||||||
#define G_PushRWTexture2DRef(arena, resource, ...) (G_RWTexture2DRef) { \
|
#define G_PushRWTexture2DRef(arena, resource, ...)(G_RWTexture2DRef) { \
|
||||||
.v = G_PushRef((arena), (resource), \
|
.v = G_PushRef( \
|
||||||
(G_RefDesc) { .kind = G_RefKind_RWTexture2D, __VA_ARGS__ }) \
|
(arena), (resource), \
|
||||||
}
|
(G_RefDesc) { .kind = G_RefKind_RWTexture2D, __VA_ARGS__ } \
|
||||||
|
) \
|
||||||
|
}
|
||||||
|
|
||||||
#define G_PushTexture3DRef(arena, resource, ...) (G_Texture3DRef) { \
|
#define G_PushTexture3DRef(arena, resource, ...)(G_Texture3DRef) { \
|
||||||
.v = G_PushRef((arena), (resource), \
|
.v = G_PushRef( \
|
||||||
(G_RefDesc) { .kind = G_RefKind_Texture3D, __VA_ARGS__ }) \
|
(arena), (resource), \
|
||||||
}
|
(G_RefDesc) { .kind = G_RefKind_Texture3D, __VA_ARGS__ } \
|
||||||
|
) \
|
||||||
|
}
|
||||||
|
|
||||||
#define G_PushRWTexture3DRef(arena, resource, ...) (G_RWTexture3DRef) { \
|
#define G_PushRWTexture3DRef(arena, resource, ...)(G_RWTexture3DRef) { \
|
||||||
.v = G_PushRef((arena), (resource), \
|
.v = G_PushRef( \
|
||||||
(G_RefDesc) { .kind = G_RefKind_RWTexture3D, __VA_ARGS__ }) \
|
(arena), (resource), \
|
||||||
}
|
(G_RefDesc) { .kind = G_RefKind_RWTexture3D, __VA_ARGS__ } \
|
||||||
|
) \
|
||||||
|
}
|
||||||
|
|
||||||
#define G_PushSamplerStateRef(arena, resource, ...) (G_SamplerStateRef) { \
|
#define G_PushSamplerStateRef(arena, resource, ...)(G_SamplerStateRef) { \
|
||||||
.v = G_PushRef((arena), (resource), \
|
.v = G_PushRef( \
|
||||||
(G_RefDesc) { .kind = G_RefKind_SamplerState, __VA_ARGS__ }) \
|
(arena), (resource), \
|
||||||
}
|
(G_RefDesc) { .kind = G_RefKind_SamplerState, __VA_ARGS__ } \
|
||||||
|
) \
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ @hookdecl Command
|
//~ @hookdecl Command
|
||||||
|
|||||||
@ -18,7 +18,7 @@ void G_Bootstrap(void)
|
|||||||
|
|
||||||
/* Enable debug layer */
|
/* Enable debug layer */
|
||||||
u32 dxgi_factory_flags = 0;
|
u32 dxgi_factory_flags = 0;
|
||||||
#if GPU_DEBUG
|
if (GPU_DEBUG)
|
||||||
{
|
{
|
||||||
ID3D12Debug *debug_controller0 = 0;
|
ID3D12Debug *debug_controller0 = 0;
|
||||||
{
|
{
|
||||||
@ -28,7 +28,7 @@ void G_Bootstrap(void)
|
|||||||
Panic(Lit("Failed to create ID3D12Debug0"));
|
Panic(Lit("Failed to create ID3D12Debug0"));
|
||||||
}
|
}
|
||||||
ID3D12Debug_EnableDebugLayer(debug_controller0);
|
ID3D12Debug_EnableDebugLayer(debug_controller0);
|
||||||
#if GPU_DEBUG_VALIDATION
|
if (GPU_DEBUG_VALIDATION)
|
||||||
{
|
{
|
||||||
ID3D12Debug1 *debug_controller1 = 0;
|
ID3D12Debug1 *debug_controller1 = 0;
|
||||||
{
|
{
|
||||||
@ -41,12 +41,10 @@ void G_Bootstrap(void)
|
|||||||
}
|
}
|
||||||
ID3D12Debug_Release(debug_controller1);
|
ID3D12Debug_Release(debug_controller1);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
ID3D12Debug_Release(debug_controller0);
|
ID3D12Debug_Release(debug_controller0);
|
||||||
dxgi_factory_flags |= DXGI_CREATE_FACTORY_DEBUG;
|
dxgi_factory_flags |= DXGI_CREATE_FACTORY_DEBUG;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Create factory */
|
/* Create factory */
|
||||||
{
|
{
|
||||||
@ -119,8 +117,8 @@ void G_Bootstrap(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Enable debug layer breaks */
|
/* Enable debug layer breaks */
|
||||||
|
if (GPU_DEBUG)
|
||||||
{
|
{
|
||||||
#if GPU_DEBUG
|
|
||||||
/* Enable D3D12 Debug break */
|
/* Enable D3D12 Debug break */
|
||||||
{
|
{
|
||||||
ID3D12InfoQueue *info = 0;
|
ID3D12InfoQueue *info = 0;
|
||||||
@ -145,7 +143,6 @@ void G_Bootstrap(void)
|
|||||||
IDXGIInfoQueue_SetBreakOnSeverity(dxgi_info, DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_ERROR, 1);
|
IDXGIInfoQueue_SetBreakOnSeverity(dxgi_info, DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_ERROR, 1);
|
||||||
IDXGIInfoQueue_Release(dxgi_info);
|
IDXGIInfoQueue_Release(dxgi_info);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
//~ DirectX12 libs
|
//~ DirectX12 libs
|
||||||
|
|
||||||
#pragma warning(push, 0)
|
#pragma warning(push, 0)
|
||||||
# include <d3d12.h>
|
#include <d3d12.h>
|
||||||
# include <dxgidebug.h>
|
#include <dxgidebug.h>
|
||||||
# include <dxgi1_6.h>
|
#include <dxgi1_6.h>
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
|
||||||
#pragma comment(lib, "d3d12")
|
#pragma comment(lib, "d3d12")
|
||||||
@ -16,9 +16,10 @@
|
|||||||
#define G_D12_TearingIsAllowed 1
|
#define G_D12_TearingIsAllowed 1
|
||||||
#define G_D12_FrameLatency 1
|
#define G_D12_FrameLatency 1
|
||||||
#define G_D12_SwapchainBufferCount 3
|
#define G_D12_SwapchainBufferCount 3
|
||||||
#define G_D12_SwapchainFlags (((G_D12_TearingIsAllowed != 0) * DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING) \
|
#define G_D12_SwapchainFlags (0 \
|
||||||
| ((G_D12_FrameLatency != 0) * DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT))
|
| ((G_D12_TearingIsAllowed != 0) * DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING) \
|
||||||
|
| ((G_D12_FrameLatency != 0) * DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT) \
|
||||||
|
)
|
||||||
|
|
||||||
#define G_D12_MaxCbvSrvUavDescriptors (1024 * 128)
|
#define G_D12_MaxCbvSrvUavDescriptors (1024 * 128)
|
||||||
#define G_D12_MaxSamplerDescriptors (1024 * 1)
|
#define G_D12_MaxSamplerDescriptors (1024 * 1)
|
||||||
|
|||||||
@ -637,12 +637,10 @@ String interpret_string(Arena *arena, String src, String *error)
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
/* TODO: Unicode escape support */
|
/* TODO: Unicode escape support */
|
||||||
#if 0
|
// case 'u':
|
||||||
case 'u':
|
// {
|
||||||
{
|
// /* TODO */
|
||||||
/* TODO */
|
// } break;
|
||||||
} break;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -898,7 +896,7 @@ void JSON_Parse(Arena *arena, JSON_Parser *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abort:
|
abort:
|
||||||
|
|
||||||
p->at = at;
|
p->at = at;
|
||||||
p->root = root;
|
p->root = root;
|
||||||
|
|||||||
@ -69,10 +69,12 @@ String StringFromMetaErrors(Arena *arena, M_ErrorList errors)
|
|||||||
if (token_file.len > 0)
|
if (token_file.len > 0)
|
||||||
{
|
{
|
||||||
i64 token_pos = -1;
|
i64 token_pos = -1;
|
||||||
if (token->s.len > 0
|
if (
|
||||||
|
token->s.len > 0
|
||||||
&& token_file_data.len > 0
|
&& token_file_data.len > 0
|
||||||
&& token->s.text > token_file_data.text
|
&& token->s.text > token_file_data.text
|
||||||
&& token->s.text < (token_file_data.text + token_file_data.len))
|
&& token->s.text < (token_file_data.text + token_file_data.len)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
token_pos = token->s.text - token_file_data.text;
|
token_pos = token->s.text - token_file_data.text;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,43 +4,43 @@
|
|||||||
//~ Base layer definitions
|
//~ Base layer definitions
|
||||||
|
|
||||||
#ifndef IsConsoleApp
|
#ifndef IsConsoleApp
|
||||||
# define IsConsoleApp 1
|
#define IsConsoleApp 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef IsRtcEnabled
|
#ifndef IsRtcEnabled
|
||||||
# define IsRtcEnabled 1
|
#define IsRtcEnabled 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef IsUnoptimized
|
#ifndef IsUnoptimized
|
||||||
# define IsUnoptimized 1
|
#define IsUnoptimized 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef IsAsanEnabled
|
#ifndef IsAsanEnabled
|
||||||
# define IsAsanEnabled 0
|
#define IsAsanEnabled 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef IsCrtlibEnabled
|
#ifndef IsCrtlibEnabled
|
||||||
# define IsCrtlibEnabled 1
|
#define IsCrtlibEnabled 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef IsDebinfoEnabled
|
#ifndef IsDebinfoEnabled
|
||||||
# define IsDebinfoEnabled 1
|
#define IsDebinfoEnabled 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef IsDeveloperModeEnabled
|
#ifndef IsDeveloperModeEnabled
|
||||||
# define IsDeveloperModeEnabled 1
|
#define IsDeveloperModeEnabled 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef IsUnoptimized
|
#ifndef IsUnoptimized
|
||||||
# define IsUnoptimized 1
|
#define IsUnoptimized 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef IsTestingEnabled
|
#ifndef IsTestingEnabled
|
||||||
# define IsTestingEnabled 0
|
#define IsTestingEnabled 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef IsHotSwappingEnabled
|
#ifndef IsHotSwappingEnabled
|
||||||
# define IsHotSwappingEnabled 0
|
#define IsHotSwappingEnabled 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#include "meta_os.h"
|
#include "meta_os.h"
|
||||||
|
|
||||||
#if IsPlatformWindows
|
#if IsPlatformWindows
|
||||||
# include "meta_os_win32/meta_os_win32_inc.h"
|
#include "meta_os_win32/meta_os_win32_inc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -2,11 +2,11 @@
|
|||||||
//~ Windows headers
|
//~ Windows headers
|
||||||
|
|
||||||
#pragma warning(push, 0)
|
#pragma warning(push, 0)
|
||||||
# include <mfapi.h>
|
#include <mfapi.h>
|
||||||
# include <mfidl.h>
|
#include <mfidl.h>
|
||||||
# include <mfreadwrite.h>
|
#include <mfreadwrite.h>
|
||||||
# include <Shlwapi.h>
|
#include <Shlwapi.h>
|
||||||
# include <objidl.h>
|
#include <objidl.h>
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
|
||||||
#pragma comment(lib, "mfplat")
|
#pragma comment(lib, "mfplat")
|
||||||
|
|||||||
@ -441,9 +441,11 @@ void P_WriteFile(P_File file, String data)
|
|||||||
if (data.len >= 0x7FFF)
|
if (data.len >= 0x7FFF)
|
||||||
{
|
{
|
||||||
TempArena scratch = BeginScratchNoConflict();
|
TempArena scratch = BeginScratchNoConflict();
|
||||||
Panic(StringF(scratch.arena,
|
Panic(StringF(
|
||||||
|
scratch.arena,
|
||||||
"Tried to write too many bytes to disk (%F)",
|
"Tried to write too many bytes to disk (%F)",
|
||||||
FmtUint(data.len)));
|
FmtUint(data.len)
|
||||||
|
));
|
||||||
EndScratch(scratch);
|
EndScratch(scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,15 +600,13 @@ P_Address P_AddressFromIpPortCstr(char *ip_cstr, char *port_cstr)
|
|||||||
else if (ai_result->ai_family == AF_INET6)
|
else if (ai_result->ai_family == AF_INET6)
|
||||||
{
|
{
|
||||||
/* TODO: Enable ipv6 */
|
/* TODO: Enable ipv6 */
|
||||||
#if 0
|
// struct sockaddr_in6 *sockaddr = (struct sockaddr_in6 *)ai_result->ai_addr;
|
||||||
struct sockaddr_in6 *sockaddr = (struct sockaddr_in6 *)ai_result->ai_addr;
|
// result.valid = 1;
|
||||||
result.valid = 1;
|
// result.family = P_AddressFamily_Ipv6;
|
||||||
result.family = P_AddressFamily_Ipv6;
|
// result.portnb = sockaddr->sin6_port;
|
||||||
result.portnb = sockaddr->sin6_port;
|
// StaticAssert(sizeof(sockaddr->sin6_addr) == 16);
|
||||||
StaticAssert(sizeof(sockaddr->sin6_addr) == 16);
|
// CopyBytes(result.ipnb, (void *)&sockaddr->sin6_addr, 16);
|
||||||
CopyBytes(result.ipnb, (void *)&sockaddr->sin6_addr, 16);
|
// break;
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
ai_result = ai_result->ai_next;
|
ai_result = ai_result->ai_next;
|
||||||
}
|
}
|
||||||
@ -850,13 +850,14 @@ P_SockReadResult P_ReadSock(Arena *arena, P_Sock *sock)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if IsRtcEnabled
|
if (IsRtcEnabled)
|
||||||
|
{
|
||||||
i32 err = WSAGetLastError();
|
i32 err = WSAGetLastError();
|
||||||
if (err != WSAEWOULDBLOCK && err != WSAETIMEDOUT && err != WSAECONNRESET)
|
if (err != WSAEWOULDBLOCK && err != WSAETIMEDOUT && err != WSAECONNRESET)
|
||||||
{
|
{
|
||||||
Assert(0);
|
Assert(0);
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -871,13 +872,14 @@ void P_WriteSock(P_Sock *sock, P_Address address, String data)
|
|||||||
{
|
{
|
||||||
AddGstat(SockBytesSent, size);
|
AddGstat(SockBytesSent, size);
|
||||||
}
|
}
|
||||||
#if IsRtcEnabled
|
if (IsRtcEnabled)
|
||||||
|
{
|
||||||
if (size != (i32)data.len)
|
if (size != (i32)data.len)
|
||||||
{
|
{
|
||||||
i32 err = WSAGetLastError();
|
i32 err = WSAGetLastError();
|
||||||
Assert(0);
|
Assert(0);
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -2,15 +2,15 @@
|
|||||||
//~ Win32 libs
|
//~ Win32 libs
|
||||||
|
|
||||||
#pragma warning(push, 0)
|
#pragma warning(push, 0)
|
||||||
# include <WinSock2.h>
|
#include <WinSock2.h>
|
||||||
# include <TlHelp32.h>
|
#include <TlHelp32.h>
|
||||||
# include <WS2tcpip.h>
|
#include <WS2tcpip.h>
|
||||||
# include <windowsx.h>
|
#include <windowsx.h>
|
||||||
# include <ShlObj_core.h>
|
#include <ShlObj_core.h>
|
||||||
# include <fileapi.h>
|
#include <fileapi.h>
|
||||||
# include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
# include <avrt.h>
|
#include <avrt.h>
|
||||||
# include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
|
||||||
#pragma comment(lib, "kernel32")
|
#pragma comment(lib, "kernel32")
|
||||||
|
|||||||
@ -65,7 +65,7 @@ void PB_WSP_InitializeWasapi(void)
|
|||||||
};
|
};
|
||||||
WAVEFORMATEX *wfx = &format_ex.Format;
|
WAVEFORMATEX *wfx = &format_ex.Format;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
b32 client_initialized = 0;
|
b32 client_initialized = 0;
|
||||||
IAudioClient3 *client3;
|
IAudioClient3 *client3;
|
||||||
if (SUCCEEDED(IAudioClient_QueryInterface(g->client, &IID_IAudioClient3, (LPVOID *)&client3)))
|
if (SUCCEEDED(IAudioClient_QueryInterface(g->client, &IID_IAudioClient3, (LPVOID *)&client3)))
|
||||||
@ -85,9 +85,9 @@ void PB_WSP_InitializeWasapi(void)
|
|||||||
|
|
||||||
IAudioClient3_Release(client3);
|
IAudioClient3_Release(client3);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
b32 client_initialized = 0;
|
b32 client_initialized = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!client_initialized)
|
if (!client_initialized)
|
||||||
{
|
{
|
||||||
@ -162,16 +162,17 @@ void PB_WSP_EndUpdate(PB_WSP_Buff *wspbuf, MIX_PcmF32 src)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Submit silence if not enough samples */
|
/* Submit silence if not enough samples */
|
||||||
flags = AUDCLNT_BUFFERFLAGS_SILENT;
|
flags |= AUDCLNT_BUFFERFLAGS_SILENT;
|
||||||
|
|
||||||
/* This shouldn't occur, mixer should be generating samples equivilent
|
/* This shouldn't occur, mixer should be generating samples equivilent
|
||||||
* to value returned from `PB_WSP_BeginUpdate`. */
|
* to value returned from `PB_WSP_BeginUpdate`. */
|
||||||
Assert(0);
|
Assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !AUDIO_ENABLED
|
if (!AUDIO_ENABLED)
|
||||||
flags = AUDCLNT_BUFFERFLAGS_SILENT;
|
{
|
||||||
#endif
|
flags |= AUDCLNT_BUFFERFLAGS_SILENT;
|
||||||
|
}
|
||||||
|
|
||||||
/* Submit output buffer to WASAPI */
|
/* Submit output buffer to WASAPI */
|
||||||
IAudioRenderClient_ReleaseBuffer(g->playback, frames_in_source, flags);
|
IAudioRenderClient_ReleaseBuffer(g->playback, frames_in_source, flags);
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
//~ Win32 libs
|
//~ Win32 libs
|
||||||
|
|
||||||
#pragma warning(push, 0)
|
#pragma warning(push, 0)
|
||||||
# include <Audioclient.h>
|
#include <Audioclient.h>
|
||||||
# include <mmdeviceapi.h>
|
#include <mmdeviceapi.h>
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
|
||||||
DEFINE_GUID(CLSID_MMDeviceEnumerator, 0xbcde0395, 0xe52f, 0x467c, 0x8e, 0x3d, 0xc4, 0x57, 0x92, 0x91, 0x69, 0x2e);
|
DEFINE_GUID(CLSID_MMDeviceEnumerator, 0xbcde0395, 0xe52f, 0x467c, 0x8e, 0x3d, 0xc4, 0x57, 0x92, 0x91, 0x69, 0x2e);
|
||||||
|
|||||||
@ -289,7 +289,6 @@ void V_EndCommandsWidget(V_CommandsWidget *widget)
|
|||||||
UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_Interactable);
|
UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_Interactable);
|
||||||
UI_PushCP(UI_BuildRowEx(hotkey_key));
|
UI_PushCP(UI_BuildRowEx(hotkey_key));
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
UI_PopCP(UI_TopCP());
|
UI_PopCP(UI_TopCP());
|
||||||
}
|
}
|
||||||
@ -839,22 +838,22 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
|
|
||||||
if (frame->is_editing)
|
if (frame->is_editing)
|
||||||
{
|
{
|
||||||
Struct(DfsNode) { DfsNode *next; b32 visited; V_Space *space; UI_Checkpoint cp; };
|
Struct(SpaceDfsNode) { SpaceDfsNode *next; b32 visited; V_Space *space; UI_Checkpoint cp; };
|
||||||
DfsNode *first_dfs = PushStruct(frame->arena, DfsNode);
|
SpaceDfsNode *first_space_dfs = PushStruct(frame->arena, SpaceDfsNode);
|
||||||
first_dfs->space = V.root_space;
|
first_space_dfs->space = V.root_space;
|
||||||
|
|
||||||
while (first_dfs)
|
while (first_space_dfs)
|
||||||
{
|
{
|
||||||
DfsNode *dfs = first_dfs;
|
SpaceDfsNode *space_dfs = first_space_dfs;
|
||||||
V_Space *space = dfs->space;
|
V_Space *space = space_dfs->space;
|
||||||
if (!dfs->visited)
|
if (!space_dfs->visited)
|
||||||
{
|
{
|
||||||
dfs->visited = 1;
|
space_dfs->visited = 1;
|
||||||
for (V_Space *child = space->last; child; child = child->prev)
|
for (V_Space *child = space->last; child; child = child->prev)
|
||||||
{
|
{
|
||||||
DfsNode *n = PushStruct(frame->arena, DfsNode);
|
SpaceDfsNode *n = PushStruct(frame->arena, SpaceDfsNode);
|
||||||
n->space = child;
|
n->space = child;
|
||||||
SllStackPush(first_dfs, n);
|
SllStackPush(first_space_dfs, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_Key space_key = UI_TransKey();
|
UI_Key space_key = UI_TransKey();
|
||||||
@ -866,7 +865,7 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
{
|
{
|
||||||
UI_BuildColumnEx(space_key);
|
UI_BuildColumnEx(space_key);
|
||||||
}
|
}
|
||||||
dfs->cp = UI_PushCP(space_key);
|
space_dfs->cp = UI_PushCP(space_key);
|
||||||
|
|
||||||
for (V_Panel *panel = space->first_panel; panel; panel = panel->next_in_space)
|
for (V_Panel *panel = space->first_panel; panel; panel = panel->next_in_space)
|
||||||
{
|
{
|
||||||
@ -932,8 +931,8 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UI_PopCP(dfs->cp);
|
UI_PopCP(space_dfs->cp);
|
||||||
SllStackPop(first_dfs);
|
SllStackPop(first_space_dfs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
X(toggle_fullscreen, Toggle Fullscreen Mode, V_CmdDescFlag_None, V_HOTKEY( Button_Enter, .alt = 1 ) ) \
|
X(toggle_fullscreen, Toggle Fullscreen Mode, V_CmdDescFlag_None, V_HOTKEY( Button_Enter, .alt = 1 ) ) \
|
||||||
X(toggle_window_topmost, Toggle Window Topmost, V_CmdDescFlag_None, V_HOTKEY( Button_F4 ), ) \
|
X(toggle_window_topmost, Toggle Window Topmost, V_CmdDescFlag_None, V_HOTKEY( Button_F4 ), ) \
|
||||||
X(spawn, Spawn, V_CmdDescFlag_None, V_HOTKEY( Button_S, .ctrl = 1 ), ) \
|
X(spawn, Spawn, V_CmdDescFlag_None, V_HOTKEY( Button_S, .ctrl = 1 ), ) \
|
||||||
/* -------------------------------------------------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Theme types
|
//~ Theme types
|
||||||
|
|||||||
145
src/pp_old/pp.c
145
src/pp_old/pp.c
@ -138,14 +138,6 @@ void PP_DrawDebugXform(Xform xf, u32 color_x, u32 color_y)
|
|||||||
#if 0
|
#if 0
|
||||||
D_DrawArrowRay(g->render_sig, pos, x_ray, thickness, arrowhead_len, color_x);
|
D_DrawArrowRay(g->render_sig, pos, x_ray, thickness, arrowhead_len, color_x);
|
||||||
D_DrawArrowRay(g->render_sig, pos, y_ray, thickness, arrowhead_len, color_y);
|
D_DrawArrowRay(g->render_sig, pos, y_ray, thickness, arrowhead_len, color_y);
|
||||||
#else
|
|
||||||
LAX x_ray;
|
|
||||||
LAX y_ray;
|
|
||||||
LAX thickness;
|
|
||||||
LAX arrowhead_len;
|
|
||||||
LAX pos;
|
|
||||||
LAX color_x;
|
|
||||||
LAX color_y;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//u32 color_quad = Rgba32F(0, 1, 1, 0.3);
|
//u32 color_quad = Rgba32F(0, 1, 1, 0.3);
|
||||||
@ -172,17 +164,7 @@ void PP_DrawDebugMovement(PP_Ent *ent)
|
|||||||
if (Vec2Len(vel_ray) > 0.00001)
|
if (Vec2Len(vel_ray) > 0.00001)
|
||||||
{
|
{
|
||||||
/* FIXME: Enable this */
|
/* FIXME: Enable this */
|
||||||
#if 0
|
|
||||||
D_DrawArrowRay(g->render_sig, pos, vel_ray, thickness, arrow_len, color_vel);
|
D_DrawArrowRay(g->render_sig, pos, vel_ray, thickness, arrow_len, color_vel);
|
||||||
#else
|
|
||||||
LAX thickness;
|
|
||||||
LAX arrow_len;
|
|
||||||
LAX color_vel;
|
|
||||||
LAX xf;
|
|
||||||
LAX velocity;
|
|
||||||
LAX pos;
|
|
||||||
LAX vel_ray;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -963,113 +945,6 @@ void PP_UpdateUser(void)
|
|||||||
mat->xf = XformFromRect(RectFromVec2(pos, size));
|
mat->xf = XformFromRect(RectFromVec2(pos, size));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
//- Acquire / release tile cache entries
|
|
||||||
|
|
||||||
/* Acquire entries from new sim chunks */
|
|
||||||
|
|
||||||
for (u64 ent_index = 0; ent_index < g->ss_blended->num_ents_reserved; ++ent_index)
|
|
||||||
{
|
|
||||||
PP_Ent *chunk_ent = &g->ss_blended->ents[ent_index];
|
|
||||||
if (PP_IsValidAndActive(chunk_ent) && PP_HasProp(chunk_ent, PP_Prop_TileChunk))
|
|
||||||
{
|
|
||||||
struct user_tile_cache_entry *entry = user_tile_cache_entry_from_chunk_pos(chunk_ent->tile_chunk_pos);
|
|
||||||
if (!entry->valid)
|
|
||||||
{
|
|
||||||
entry = user_tile_cache_entry_acquire(chunk_ent->tile_chunk_pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Release entries with invalid sim chunks */
|
|
||||||
|
|
||||||
for (u64 entry_index = 0; entry_index < g->tile_cache.num_reserved_entries; ++entry_index)
|
|
||||||
{
|
|
||||||
struct tile_cache_entry *entry = &g->tile_cache.entries[entry_index];
|
|
||||||
if (entry->valid)
|
|
||||||
{
|
|
||||||
PP_Ent *chunk_ent = sim_ent_from_chunk_pos(entry->pos);
|
|
||||||
if (!chunk_ent->valid)
|
|
||||||
{
|
|
||||||
user_tile_cache_entry_release(entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Draw dirty tile cache entries
|
|
||||||
|
|
||||||
for (u64 entry_index = 0; entry_index < g->tile_cache.num_reserved_entries; ++entry_index)
|
|
||||||
{
|
|
||||||
struct tile_cache_entry *entry = &g->tile_cache.entries[entry_index];
|
|
||||||
if (entry->valid)
|
|
||||||
{
|
|
||||||
Vec2I32 chunk_pos = entry->pos;
|
|
||||||
PP_Ent *chunk_ent = sim_ent_from_chunk_pos(chunk_pos);
|
|
||||||
if (entry->applied_dirty_gen != chunk_ent->dirty_gen)
|
|
||||||
{
|
|
||||||
entry->applied_dirty_gen = chunk_ent->dirty_gen;
|
|
||||||
/* TODO: Autotiling */
|
|
||||||
|
|
||||||
String data = sim_ent_get_chunk_tile_data(chunk_ent);
|
|
||||||
u64 tile_count = data.len;
|
|
||||||
if (tile_count == SIM_TILES_PER_CHUNK_SQRT * SIM_TILES_PER_CHUNK_SQRT)
|
|
||||||
{
|
|
||||||
for (u64 y_in_chunk = 0; y_in_chunk < SIM_TILES_PER_CHUNK_SQRT; ++y_in_chunk)
|
|
||||||
{
|
|
||||||
for (u64 x_in_chunk = 0; x_in_chunk < SIM_TILES_PER_CHUNK_SQRT; ++x_in_chunk)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* TODO: Clear gpu buffer if it exists */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
for (u64 entry_index = 0; entry_index < g->tile_cache.num_reserved_entries; ++entry_index)
|
|
||||||
{
|
|
||||||
struct tile_cache_entry *entry = &g->tile_cache.entries[entry_index];
|
|
||||||
if (entry->valid)
|
|
||||||
{
|
|
||||||
Vec2I32 chunk_pos = entry->pos;
|
|
||||||
PP_Ent *chunk_ent = sim_ent_from_chunk_pos(chunk_pos);
|
|
||||||
if (entry->applied_dirty_gen != chunk_ent->dirty_gen)
|
|
||||||
{
|
|
||||||
entry->applied_dirty_gen = chunk_ent->dirty_gen;
|
|
||||||
|
|
||||||
/* Retreive surrounding chunk info since we're auto-tiling
|
|
||||||
* [TL] [T] [TR]
|
|
||||||
* [L ] X [R ]
|
|
||||||
* [BL] [B] [BR]
|
|
||||||
*/
|
|
||||||
Vec2I32 chunk_pos_tl = VEC2I32(chunk_pos.x - 1, chunk_pos.y - 1);
|
|
||||||
Vec2I32 chunk_pos_t = VEC2I32(chunk_pos.x, chunk_pos.y - 1);
|
|
||||||
Vec2I32 chunk_pos_tr = VEC2I32(chunk_pos.x + 1, chunk_pos.y - 1);
|
|
||||||
Vec2I32 chunk_pos_l = VEC2I32(chunk_pos.x - 1, chunk_pos.y);
|
|
||||||
Vec2I32 chunk_pos_r = VEC2I32(chunk_pos.x + 1, chunk_pos.y);
|
|
||||||
Vec2I32 chunk_pos_bl = VEC2I32(chunk_pos.x - 1, chunk_pos.y + 1);
|
|
||||||
Vec2I32 chunk_pos_b = VEC2I32(chunk_pos.x, chunk_pos.y + 1);
|
|
||||||
Vec2I32 chunk_pos_br = VEC2I32(chunk_pos.x + 1, chunk_pos.y + 1);
|
|
||||||
PP_Ent *chunk_ent_tl = sim_ent_from_chunk_pos(chunk_pos_tl);
|
|
||||||
PP_Ent *chunk_ent_t = sim_ent_from_chunk_pos(chunk_pos_t);
|
|
||||||
PP_Ent *chunk_ent_tr = sim_ent_from_chunk_pos(chunk_pos_tr);
|
|
||||||
PP_Ent *chunk_ent_l = sim_ent_from_chunk_pos(chunk_pos_l);
|
|
||||||
PP_Ent *chunk_ent_r = sim_ent_from_chunk_pos(chunk_pos_r);
|
|
||||||
PP_Ent *chunk_ent_bl = sim_ent_from_chunk_pos(chunk_pos_bl);
|
|
||||||
PP_Ent *chunk_ent_b = sim_ent_from_chunk_pos(chunk_pos_b);
|
|
||||||
PP_Ent *chunk_ent_br = sim_ent_from_chunk_pos(chunk_pos_br);
|
|
||||||
|
|
||||||
String data = sim_ent_get_chunk_tile_data(chunk_ent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//- Sort drawable entities
|
//- Sort drawable entities
|
||||||
PP_Ent **sorted = PushDry(scratch.arena, PP_Ent *);
|
PP_Ent **sorted = PushDry(scratch.arena, PP_Ent *);
|
||||||
u64 sorted_count = 0;
|
u64 sorted_count = 0;
|
||||||
@ -1660,9 +1535,9 @@ void PP_UpdateUser(void)
|
|||||||
D_DrawArrowLine(g->render_sig, start, end, arrow_thickness, arrowhead_height, color);
|
D_DrawArrowLine(g->render_sig, start, end, arrow_thickness, arrowhead_height, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Draw hierarchy */
|
/* Draw hierarchy */
|
||||||
/* FIXME: Enable this */
|
/* FIXME: Enable this */
|
||||||
@ -1699,7 +1574,7 @@ void PP_UpdateUser(void)
|
|||||||
|
|
||||||
/* Draw crosshair or show cursor */
|
/* Draw crosshair or show cursor */
|
||||||
/* FIXME: Enable this */
|
/* FIXME: Enable this */
|
||||||
#if 0
|
#if 0
|
||||||
if (!g->debug_camera)
|
if (!g->debug_camera)
|
||||||
{
|
{
|
||||||
__profn("Draw crosshair");
|
__profn("Draw crosshair");
|
||||||
@ -1710,10 +1585,10 @@ void PP_UpdateUser(void)
|
|||||||
Xform xf = XformFromTrs(TRS(.t = crosshair_pos, .s = size));
|
Xform xf = XformFromTrs(TRS(.t = crosshair_pos, .s = size));
|
||||||
D_DrawUiRect(g->render_sig, D_UIRECTPARAMS(.xf = xf, .texture = t->gpu_resource));
|
D_DrawUiRect(g->render_sig, D_UIRECTPARAMS(.xf = xf, .texture = t->gpu_resource));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* FIXME: Enable this */
|
/* FIXME: Enable this */
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
__profn("Update window cursor");
|
__profn("Update window cursor");
|
||||||
if (g->debug_camera)
|
if (g->debug_camera)
|
||||||
@ -1733,7 +1608,7 @@ void PP_UpdateUser(void)
|
|||||||
P_EnableWindoweCursorClip(g->window, cursor_clip);
|
P_EnableWindoweCursorClip(g->window, cursor_clip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//- Create user sim cmd
|
//- Create user sim cmd
|
||||||
|
|
||||||
@ -2481,14 +2356,14 @@ void PP_GenerateuserInputCmds(PP_Client *user_input_client, u64 tick)
|
|||||||
JobImpl(PP_UpdateSim, UNUSED sig, UNUSED key)
|
JobImpl(PP_UpdateSim, UNUSED sig, UNUSED key)
|
||||||
{
|
{
|
||||||
PP_SharedUserState *g = &PP_shared_user_state;
|
PP_SharedUserState *g = &PP_shared_user_state;
|
||||||
#if 0
|
#if 0
|
||||||
struct host_listen_address local_listen_addr = host_listen_address_from_local_name(Lit("LOCAL_SIM"));
|
struct host_listen_address local_listen_addr = host_listen_address_from_local_name(Lit("LOCAL_SIM"));
|
||||||
struct host_listen_address net_listen_addr = host_listen_address_from_net_port(12345);
|
struct host_listen_address net_listen_addr = host_listen_address_from_net_port(12345);
|
||||||
//N_Host *host = N_AcquireHost();
|
//N_Host *host = N_AcquireHost();
|
||||||
/* TODO: Host system should allocate & copy string stored in local_listen_addr */
|
/* TODO: Host system should allocate & copy string stored in local_listen_addr */
|
||||||
//host_listen(host, local_listen_addr);
|
//host_listen(host, local_listen_addr);
|
||||||
//host_listen(host, net_listen_addr);
|
//host_listen(host, net_listen_addr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
b32 is_master = 0;
|
b32 is_master = 0;
|
||||||
N_Host *host;
|
N_Host *host;
|
||||||
@ -2521,7 +2396,7 @@ JobImpl(PP_UpdateSim, UNUSED sig, UNUSED key)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (IsSwappedIn())
|
if (IsSwappedIn())
|
||||||
{
|
{
|
||||||
TempArena scratch = BeginScratchNoConflict();
|
TempArena scratch = BeginScratchNoConflict();
|
||||||
@ -2542,7 +2417,7 @@ JobImpl(PP_UpdateSim, UNUSED sig, UNUSED key)
|
|||||||
|
|
||||||
EndScratch(scratch);
|
EndScratch(scratch);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -236,13 +236,12 @@ void PP_SetEntKey(PP_Ent *ent, PP_EntKey key)
|
|||||||
/* Insert new key into lookup */
|
/* Insert new key into lookup */
|
||||||
if (!PP_IsNilEntKey(key))
|
if (!PP_IsNilEntKey(key))
|
||||||
{
|
{
|
||||||
#if IsRtcEnabled
|
if (IsRtcEnabled)
|
||||||
{
|
{
|
||||||
PP_Ent *existing = PP_EntFromKey(ss, key);
|
PP_Ent *existing = PP_EntFromKey(ss, key);
|
||||||
/* Collision should be extremely unlikely under normal circumstances, there's probably a logic error somewhere. */
|
/* Collision should be extremely unlikely under normal circumstances, there's probably a logic error somewhere. */
|
||||||
Assert(!existing->valid);
|
Assert(!existing->valid);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
PP_EntBin *bin = PP_EntBinFromKey(ss, key);
|
PP_EntBin *bin = PP_EntBinFromKey(ss, key);
|
||||||
u32 ent_index = PP_IndexFromEnt(ss, ent);
|
u32 ent_index = PP_IndexFromEnt(ss, ent);
|
||||||
@ -742,8 +741,6 @@ void PP_SyncEnt(PP_Ent *local, PP_Ent *remote)
|
|||||||
PP_EnableProp(local, PP_Prop_SyncDst);
|
PP_EnableProp(local, PP_Prop_SyncDst);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Encode
|
//~ Encode
|
||||||
|
|
||||||
@ -795,74 +792,3 @@ void PP_DecodeEnt(BB_Reader *br, PP_Ent *e)
|
|||||||
e->ss = old_ss;
|
e->ss = old_ss;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
//~ Encode
|
|
||||||
|
|
||||||
void PP_EncodeEnt(BB_Writer *bw, PP_Ent *e0, PP_Ent *e1)
|
|
||||||
{
|
|
||||||
PP_Snapshot *ss = e1->ss;
|
|
||||||
|
|
||||||
|
|
||||||
/* FIXME: Things like xforms need to be retreived manually rather than memcopied.
|
|
||||||
* This will also be true for things like ent keys once uids are implemented. */
|
|
||||||
|
|
||||||
/* TODO: Granular delta encoding */
|
|
||||||
|
|
||||||
u64 pos = 0;
|
|
||||||
e1->ss = e0->ss;
|
|
||||||
while (pos < sizeof(*e1))
|
|
||||||
{
|
|
||||||
u64 chunk_size = MinU64(pos + 8, sizeof(*e1)) - pos;
|
|
||||||
u8 *chunk0 = (u8 *)e0 + pos;
|
|
||||||
u8 *chunk1 = (u8 *)e1 + pos;
|
|
||||||
if (EqBytes(chunk0, chunk1, chunk_size))
|
|
||||||
{
|
|
||||||
BB_WriteBit(bw, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BB_WriteBit(bw, 1);
|
|
||||||
u64 bits = 0;
|
|
||||||
CopyBytes(&bits, chunk1, chunk_size);
|
|
||||||
BB_WriteUBits(bw, bits, 64);
|
|
||||||
}
|
|
||||||
pos += 8;
|
|
||||||
}
|
|
||||||
e1->ss = ss;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
//~ Decode
|
|
||||||
|
|
||||||
void PP_DecodeEnt(BB_Reader *br, PP_Ent *e)
|
|
||||||
{
|
|
||||||
PP_Ent decoded = *e;
|
|
||||||
{
|
|
||||||
u64 pos = 0;
|
|
||||||
while (pos < sizeof(decoded))
|
|
||||||
{
|
|
||||||
u8 *chunk = (u8 *)&decoded + pos;
|
|
||||||
if (BB_ReadBit(br))
|
|
||||||
{
|
|
||||||
u64 chunk_size = MinU64(pos + 8, sizeof(decoded)) - pos;
|
|
||||||
u64 bits = BB_ReadUBits(br, 64);
|
|
||||||
CopyBytes(chunk, &bits, chunk_size);
|
|
||||||
}
|
|
||||||
pos += 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
decoded.ss = e->ss;
|
|
||||||
|
|
||||||
PP_EntKey old_id = e->key;
|
|
||||||
PP_EntKey new_id = decoded.key;
|
|
||||||
CopyStruct(e, &decoded);
|
|
||||||
e->key = old_id;
|
|
||||||
if (!PP_EqEntKey(old_id, new_id))
|
|
||||||
{
|
|
||||||
PP_SetEntKey(e, new_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|||||||
@ -384,8 +384,8 @@ void PP_PrepareContacts(PP_PhysStepCtx *ctx, u64 phys_iteration)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#if COLLIDER_DEBUG
|
#if COLLIDER_DEBUG
|
||||||
/* Remove collision debug ents */
|
/* Remove collision debug ents */
|
||||||
for (u64 sim_ent_index = 0; sim_ent_index < ss->num_ents_reserved; ++sim_ent_index)
|
for (u64 sim_ent_index = 0; sim_ent_index < ss->num_ents_reserved; ++sim_ent_index)
|
||||||
{
|
{
|
||||||
@ -397,17 +397,19 @@ void PP_PrepareContacts(PP_PhysStepCtx *ctx, u64 phys_iteration)
|
|||||||
PP_Ent *e0 = PP_EntFromKey(ss, dbg->e0);
|
PP_Ent *e0 = PP_EntFromKey(ss, dbg->e0);
|
||||||
PP_Ent *e1 = PP_EntFromKey(ss, dbg->e1);
|
PP_Ent *e1 = PP_EntFromKey(ss, dbg->e1);
|
||||||
|
|
||||||
if (!(PP_ShouldSimulate(e0) && PP_ShouldSimulate(e1)) ||
|
if (
|
||||||
|
!(PP_ShouldSimulate(e0) && PP_ShouldSimulate(e1)) ||
|
||||||
!(PP_HasProp(e0, PP_Prop_Solid) || PP_HasProp(e0, PP_Prop_Sensor)) ||
|
!(PP_HasProp(e0, PP_Prop_Solid) || PP_HasProp(e0, PP_Prop_Sensor)) ||
|
||||||
!(PP_HasProp(e1, PP_Prop_Solid) || PP_HasProp(e1, PP_Prop_Sensor)))
|
!(PP_HasProp(e1, PP_Prop_Solid) || PP_HasProp(e1, PP_Prop_Sensor))
|
||||||
|
)
|
||||||
{
|
{
|
||||||
/* Mark dbg ent for removal */
|
/* Mark dbg ent for removal */
|
||||||
PP_DisableProp(dbg_ent, PP_Prop_Active);
|
PP_DisableProp(dbg_ent, PP_Prop_Active);
|
||||||
PP_EnableProp(dbg_ent, PP_Prop_Release);
|
PP_EnableProp(dbg_ent, PP_Prop_Release);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void PP_WarmStartContacts(PP_PhysStepCtx *ctx)
|
void PP_WarmStartContacts(PP_PhysStepCtx *ctx)
|
||||||
@ -1066,7 +1068,6 @@ void PP_WarmStartWeldJoints(PP_PhysStepCtx *ctx)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1
|
|
||||||
PP_Ent *e1 = PP_EntFromKey(ss, joint->e1);
|
PP_Ent *e1 = PP_EntFromKey(ss, joint->e1);
|
||||||
if (PP_ShouldSimulate(e1))
|
if (PP_ShouldSimulate(e1))
|
||||||
{
|
{
|
||||||
@ -1075,9 +1076,6 @@ void PP_WarmStartWeldJoints(PP_PhysStepCtx *ctx)
|
|||||||
PP_SetLinearVelocity(e1, AddVec2(e1->linear_velocity, MulVec2(joint->linear_impulse1, inv_m)));
|
PP_SetLinearVelocity(e1, AddVec2(e1->linear_velocity, MulVec2(joint->linear_impulse1, inv_m)));
|
||||||
PP_SetAngularVelocity(e1, e1->angular_velocity + joint->angular_impulse1 * inv_i);
|
PP_SetAngularVelocity(e1, e1->angular_velocity + joint->angular_impulse1 * inv_i);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
LAX joint;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1331,8 +1329,6 @@ void PP_StepPhys(PP_PhysStepCtx *ctx, f32 timestep)
|
|||||||
const u32 max_iterations = 16;
|
const u32 max_iterations = 16;
|
||||||
f32 earliest_toi = MaxF32(PP_DetermineEarliestToi(ctx, step_dt, tolerance, max_iterations), min_toi);
|
f32 earliest_toi = MaxF32(PP_DetermineEarliestToi(ctx, step_dt, tolerance, max_iterations), min_toi);
|
||||||
step_dt = remaining_dt * earliest_toi;
|
step_dt = remaining_dt * earliest_toi;
|
||||||
#else
|
|
||||||
LAX PP_DetermineEarliestToi;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
remaining_dt -= step_dt;
|
remaining_dt -= step_dt;
|
||||||
|
|||||||
@ -41,7 +41,8 @@ Struct(PP_ContactPoint)
|
|||||||
* rather than points fully in local space because contact manifolds
|
* rather than points fully in local space because contact manifolds
|
||||||
* shouldn't really be affected by rotation accross substeps
|
* shouldn't really be affected by rotation accross substeps
|
||||||
* (imagine re-building the manifold of a rotated shape, it would still be
|
* (imagine re-building the manifold of a rotated shape, it would still be
|
||||||
* on the same side of the shape that it originally occured on) */
|
* on the same side of the shape that it originally occured on)
|
||||||
|
*/
|
||||||
Vec2 vcp0;
|
Vec2 vcp0;
|
||||||
Vec2 vcp1;
|
Vec2 vcp1;
|
||||||
|
|
||||||
|
|||||||
@ -265,7 +265,7 @@ PP_Client *PP_ClientFromKey(PP_ClientStore *store, PP_ClientKey key)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Acquire snapshot
|
//~ Acquire snapshot
|
||||||
|
|
||||||
/* Produces a new snapshot at `tick` with data copied from `src` snapshot. */
|
/* Produces a new snapshot at `tick` with data copied from `src` snapshot. */
|
||||||
PP_Snapshot *PP_AcquireSnapshot(PP_Client *client, PP_Snapshot *src, u64 tick)
|
PP_Snapshot *PP_AcquireSnapshot(PP_Client *client, PP_Snapshot *src, u64 tick)
|
||||||
{
|
{
|
||||||
if (tick == 0)
|
if (tick == 0)
|
||||||
@ -768,20 +768,6 @@ void PP_SyncSnapshotEnts(PP_Snapshot *local_ss, PP_Snapshot *remote_ss, PP_EntKe
|
|||||||
PP_ReleaseAllWithProp(local_ss, PP_Prop_Release);
|
PP_ReleaseAllWithProp(local_ss, PP_Prop_Release);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Snapshot encode
|
//~ Snapshot encode
|
||||||
|
|
||||||
@ -947,296 +933,3 @@ void PP_DecodeSnapshot(BB_Reader *br, PP_Snapshot *ss)
|
|||||||
|
|
||||||
BB_ReadDebugMarker(br, Lit("SNAPSHOT END"));
|
BB_ReadDebugMarker(br, Lit("SNAPSHOT END"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
//~ Snapshot encode
|
|
||||||
|
|
||||||
void PP_EncodeSnapshot(BB_Writer *bw, PP_Client *receiver, PP_Snapshot *ss0, PP_Snapshot *ss1)
|
|
||||||
{
|
|
||||||
__prof;
|
|
||||||
|
|
||||||
BB_WriteIV(bw, ss1->sim_dt_ns);
|
|
||||||
BB_WriteIV(bw, ss1->sim_time_ns);
|
|
||||||
|
|
||||||
BB_WriteUV(bw, ss1->continuity_gen);
|
|
||||||
BB_WriteUV(bw, ss1->phys_iteration);
|
|
||||||
|
|
||||||
BB_WriteUid(bw, receiver->player_id.uid);
|
|
||||||
|
|
||||||
/* Ents */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (ss1->num_ents_allocated == ss0->num_ents_allocated)
|
|
||||||
{
|
|
||||||
BB_WriteBit(bw, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BB_WriteBit(bw, 1);
|
|
||||||
BB_WriteUV(bw, ss1->num_ents_allocated);
|
|
||||||
}
|
|
||||||
if (ss1->num_ents_reserved == ss0->num_ents_reserved)
|
|
||||||
{
|
|
||||||
BB_WriteBit(bw, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BB_WriteBit(bw, 1);
|
|
||||||
BB_WriteUV(bw, ss1->num_ents_reserved);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BB_AlignWriter(bw);
|
|
||||||
for (u64 i = 0; i < ss1->num_ents_reserved; ++i)
|
|
||||||
{
|
|
||||||
PP_Ent *e0 = PP_NilEnt();
|
|
||||||
if (i < ss0->num_ents_reserved)
|
|
||||||
{
|
|
||||||
e0 = &ss0->ents[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e0->valid != e1->valid)
|
|
||||||
{
|
|
||||||
BB_WriteBit(1);
|
|
||||||
BB_WriteBit(e1->valid);
|
|
||||||
if (e1->valid)
|
|
||||||
{
|
|
||||||
BB_WriteUid(bw, e1->key.uid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BB_WriteBit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e1->valid)
|
|
||||||
{
|
|
||||||
PP_Ent *e1 = &ss1->ents[i];
|
|
||||||
PP_EncodeEnt(bw, e0, e1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
//~ Snapshot decode
|
|
||||||
|
|
||||||
struct sim_ent_decode_node
|
|
||||||
{
|
|
||||||
String tmp_encoded;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sim_ent_decode_queue
|
|
||||||
{
|
|
||||||
struct sim_ent_decode_node *first;
|
|
||||||
struct sim_ent_decode_node *last;
|
|
||||||
};
|
|
||||||
|
|
||||||
void PP_DecodeSnapshot(BB_Reader *br, PP_Snapshot *ss)
|
|
||||||
{
|
|
||||||
__prof;
|
|
||||||
TempArena scratch = BeginScratchNoConflict();
|
|
||||||
|
|
||||||
ss->sim_dt_ns = BB_ReadIV(br);
|
|
||||||
ss->sim_time_ns = BB_ReadIV(br);
|
|
||||||
|
|
||||||
ss->continuity_gen = BB_ReadUV(br);
|
|
||||||
ss->phys_iteration = BB_ReadUV(br);
|
|
||||||
|
|
||||||
ss->local_player = (PP_EntKey){ .uid = BB_ReadUid(br) };
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
|
|
||||||
if (BB_ReadBit(br))
|
|
||||||
{
|
|
||||||
ss->num_ents_allocated = BB_ReadUV(br);
|
|
||||||
}
|
|
||||||
if (BB_ReadBit(br))
|
|
||||||
{
|
|
||||||
u64 old_num_ents_reserved = ss->num_ents_reserved;
|
|
||||||
ss->num_ents_reserved = BB_ReadUV(br);
|
|
||||||
i64 reserve_diff = (i64)ss->num_ents_reserved - (i64)old_num_ents_reserved;
|
|
||||||
if (reserve_diff > 0)
|
|
||||||
{
|
|
||||||
PushStructsNoZero(ss->ents_arena, PP_Ent, reserve_diff);
|
|
||||||
for (u64 i = old_num_ents_reserved; i < ss->num_ents_reserved; ++i)
|
|
||||||
{
|
|
||||||
PP_Ent *e = &ss->ents[i];
|
|
||||||
*e = *PP_NilEnt();
|
|
||||||
e->ss = ss;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Build decode queue */
|
|
||||||
struct sim_ent_decode_queue queue;
|
|
||||||
b32 should_read_ent = BB_ReadBit(br);
|
|
||||||
while (should_read_ent)
|
|
||||||
{
|
|
||||||
/* TODO: Delta decode index based on last read index */
|
|
||||||
u32 index = BB_ReadUV(br);
|
|
||||||
b32 allocation_changed = BB_ReadBit(br);
|
|
||||||
b32 released = 0;
|
|
||||||
|
|
||||||
u32 alloc_parent_index = ZI;
|
|
||||||
PP_EntKey alloc_ent_id = ZI;
|
|
||||||
if (allocation_changed)
|
|
||||||
{
|
|
||||||
released = BB_ReadBit(br);
|
|
||||||
if (released)
|
|
||||||
{
|
|
||||||
PP_Ent *e = sim_ent_from_index(ss, e);
|
|
||||||
Assert(e->valid); /* An entity that we don't have allocated should never have been marked for release */
|
|
||||||
if (e->valid)
|
|
||||||
{
|
|
||||||
PP_EnableProp(e, PP_Prop_Release);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
alloc_parent_index = BB_ReadUV();
|
|
||||||
alloc_ent_id = sim_ent_id_from_uid(BB_ReadUid(br));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!released)
|
|
||||||
{
|
|
||||||
u64 num_ent_bits = BB_ReadUV(br);
|
|
||||||
BB_Reader ent_br = br_from_seek_bits(br, num_ent_bits);
|
|
||||||
if (BB_NumBitsRemaining(&ent_br) > 0)
|
|
||||||
{
|
|
||||||
struct sim_ent_decode_node *n = PushStruct(scratch.arena, struct sim_ent_decode_node);
|
|
||||||
n->is_new = allocation_changed && !released;
|
|
||||||
n->index = index;
|
|
||||||
n->alloc_parent_ndex = alloc_parent_index;
|
|
||||||
n->alloc_ent_id = alloc_ent_id;
|
|
||||||
n->br = ent_br;
|
|
||||||
if (queue.last)
|
|
||||||
{
|
|
||||||
queue.last->next = n;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
queue.first = n;
|
|
||||||
}
|
|
||||||
queue.last = n;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
should_read_ent = BB_ReadBit(br);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Acquire new ents from decode queue */
|
|
||||||
for (struct sim_ent_decode_node *n = queue.first; n; n = n->next)
|
|
||||||
{
|
|
||||||
if (n->is_new)
|
|
||||||
{
|
|
||||||
u32 index = n->index;
|
|
||||||
PP_Ent *parent = sim_ent_from_index(ss, n->alloc_parent_index);
|
|
||||||
Assert(!sim_ent_from_index(ss, index)->valid && !PP_EntFromKey(ss, alloc_ent_id)->valid); /* An entity that we have allocated already should never be marked for allocation */
|
|
||||||
Assert(parent->valid); /* Parent for new entity allocation should always be valid */
|
|
||||||
if (parent->valid && index < ss->num_ents_reserved)
|
|
||||||
{
|
|
||||||
PP_Ent *ent = &ss->ents[index];
|
|
||||||
ent->valid = 1;
|
|
||||||
PP_SetEntKey(ent, n->alloc_ent_id);
|
|
||||||
Link(parent, ent);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Received an invalid entity allocation */
|
|
||||||
Assert(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Decode ent data from decode queue */
|
|
||||||
for (struct sim_ent_decode_node *n = queue.first; n; n = n->next)
|
|
||||||
{
|
|
||||||
BB_Reader ent_br = n->br;
|
|
||||||
u32 index = n->index;
|
|
||||||
PP_Ent *e = sim_ent_from_index(ss, index);
|
|
||||||
if (e->valid)
|
|
||||||
{
|
|
||||||
PP_DecodeEnt(&ent_br, e);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Received delta for unallocated ent */
|
|
||||||
Assert(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
/* Ents */
|
|
||||||
if (BB_ReadBit(br))
|
|
||||||
{
|
|
||||||
ss->num_ents_allocated = BB_ReadUV(br);
|
|
||||||
}
|
|
||||||
if (BB_ReadBit(br))
|
|
||||||
{
|
|
||||||
u64 old_num_ents_reserved = ss->num_ents_reserved;
|
|
||||||
ss->num_ents_reserved = BB_ReadUV(br);
|
|
||||||
i64 reserve_diff = (i64)ss->num_ents_reserved - (i64)old_num_ents_reserved;
|
|
||||||
if (reserve_diff > 0)
|
|
||||||
{
|
|
||||||
PushStructsNoZero(ss->ents_arena, PP_Ent, reserve_diff);
|
|
||||||
for (u64 i = old_num_ents_reserved; i < ss->num_ents_reserved; ++i)
|
|
||||||
{
|
|
||||||
PP_Ent *e = &ss->ents[i];
|
|
||||||
*e = *PP_NilEnt();
|
|
||||||
e->ss = ss;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (u64 i = 0; i < ss->num_ents_reserved; ++i)
|
|
||||||
{
|
|
||||||
b32 allocation_changed = BB_ReadBit(br);
|
|
||||||
if (allocation_changed)
|
|
||||||
{
|
|
||||||
if (BB_ReadBit(br))
|
|
||||||
{
|
|
||||||
struct sim_ent_decode_node *n = PushStruct(scratch.arena, struct sim_ent_decode_node)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PP_EnableProp(e, PP_Prop_Release);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (u64 i = 0; i < ss->num_ents_reserved; ++i)
|
|
||||||
{
|
|
||||||
PP_Ent *e = &ss->ents[i];
|
|
||||||
e->ss = ss;
|
|
||||||
|
|
||||||
b32 valid_changed = BB_ReadBit(br);
|
|
||||||
b32 allocated = 1;
|
|
||||||
if (valid_changed)
|
|
||||||
{
|
|
||||||
allocated = BB_ReadBit(br);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!allocated)
|
|
||||||
{
|
|
||||||
/* Why is an already released ent being marked as released? */
|
|
||||||
Assert(e->valid);
|
|
||||||
if (e->valid)
|
|
||||||
{
|
|
||||||
PP_EnableProp(e, PP_Prop_Release);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PP_DecodeEnt(br, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PP_ReleaseAllWithProp(ss, PP_Prop_Release);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
EndScratch(scratch);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|||||||
@ -1312,42 +1312,6 @@ void PP_StepSim(PP_SimStepCtx *ctx)
|
|||||||
SPR_Slice slice = SPR_SliceFromKey(sheet, ent->sprite_collider_slice_key, ent->animation_frame);
|
SPR_Slice slice = SPR_SliceFromKey(sheet, ent->sprite_collider_slice_key, ent->animation_frame);
|
||||||
ent->local_collider = CLD_ShapeFromQuad(MulXformQuad(cxf, QuadFromRect(slice.rect)));
|
ent->local_collider = CLD_ShapeFromQuad(MulXformQuad(cxf, QuadFromRect(slice.rect)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test collider */
|
|
||||||
#if 0
|
|
||||||
if (PP_HasProp(ent, PP_Prop_Test))
|
|
||||||
{
|
|
||||||
//if ((1)) {
|
|
||||||
#if 0
|
|
||||||
ent->local_collider.points[0] = VEC2(0, 0);
|
|
||||||
ent->local_collider.count = 1;
|
|
||||||
ent->local_collider.radius = 0.5;
|
|
||||||
#elif 0
|
|
||||||
ent->local_collider.points[0] = Vec2WithLen(VEC2(0.08f, 0.17f), 0.15f);
|
|
||||||
ent->local_collider.points[1] = Vec2WithLen(VEC2(-0.07f, -0.2f), 0.15f);
|
|
||||||
ent->local_collider.count = 2;
|
|
||||||
ent->local_collider.radius = 0.075f;
|
|
||||||
#elif 1
|
|
||||||
#if 0
|
|
||||||
/* "Bad" winding order */
|
|
||||||
ent->local_collider.points[0] = VEC2(-0.15, 0.15);
|
|
||||||
ent->local_collider.points[1] = VEC2(0.15, 0.15);
|
|
||||||
ent->local_collider.points[2] = VEC2(0, -0.15);
|
|
||||||
#else
|
|
||||||
ent->local_collider.points[0] = VEC2(0, -0.15);
|
|
||||||
ent->local_collider.points[1] = VEC2(0.15, 0.15);
|
|
||||||
ent->local_collider.points[2] = VEC2(-0.15, 0.15);
|
|
||||||
#endif
|
|
||||||
ent->local_collider.count = 3;
|
|
||||||
ent->local_collider.radius = 0.25;
|
|
||||||
//ent->local_collider.radius = AbsF32(SinF32(ctx->tick.time) / 3);
|
|
||||||
#else
|
|
||||||
//ent->local_collider.radius = 0.5;
|
|
||||||
ent->local_collider.radius = 0.25;
|
|
||||||
//ent->local_collider.radius = 0.;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Update attachments
|
//- Update attachments
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Acceleration structure types
|
//~ Acceleration structure types
|
||||||
|
|
||||||
/* Structure used to accelerate up entity lookup (rebuilt every step) */
|
/* Structure used to accelerate up entity lookup (rebuilt every step) */
|
||||||
/* TODO: Remove this and do something better. Just a hack to de-couple old sim ctx from step. */
|
/* TODO: Remove this and do something better. Just a hack to de-couple old sim ctx from step. */
|
||||||
|
|
||||||
Struct(PP_Accel)
|
Struct(PP_Accel)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -8,8 +8,7 @@ void PT_RunForever(WaveLaneCtx *lane)
|
|||||||
for (u64 cev_idx = 0; cev_idx < window_frame.controller_events.count; ++cev_idx)
|
for (u64 cev_idx = 0; cev_idx < window_frame.controller_events.count; ++cev_idx)
|
||||||
{
|
{
|
||||||
ControllerEvent *cev = &window_frame.controller_events.events[cev_idx];
|
ControllerEvent *cev = &window_frame.controller_events.events[cev_idx];
|
||||||
if (cev->kind == ControllerEventKind_Quit ||
|
if (cev->kind == ControllerEventKind_Quit || (cev->kind == ControllerEventKind_ButtonDown && cev->button == Button_Escape))
|
||||||
(cev->kind == ControllerEventKind_ButtonDown && cev->button == Button_Escape))
|
|
||||||
{
|
{
|
||||||
SignalExit(0);
|
SignalExit(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -158,7 +158,7 @@ P_WindowSettings *SETTINGS_WindowSettingsFromString(Arena *arena, String src, St
|
|||||||
if (!found_width) { error = Lit("Missing \"width\""); goto abort; }
|
if (!found_width) { error = Lit("Missing \"width\""); goto abort; }
|
||||||
if (!found_height) { error = Lit("Missing \"height\""); goto abort; }
|
if (!found_height) { error = Lit("Missing \"height\""); goto abort; }
|
||||||
|
|
||||||
abort:
|
abort:
|
||||||
|
|
||||||
if (error_out && (error.len > 0 || json_error.msg.len > 0))
|
if (error_out && (error.len > 0 || json_error.msg.len > 0))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -61,8 +61,7 @@ TAR_Archive TAR_ArchiveFromString(Arena *arena, String data, String prefix)
|
|||||||
if (!is_dir && header.file_type != TAR_FileKind_File)
|
if (!is_dir && header.file_type != TAR_FileKind_File)
|
||||||
{
|
{
|
||||||
/* Unsupported type */
|
/* Unsupported type */
|
||||||
Assert(header.file_type == TAR_FileKind_PaxHeaderX ||
|
Assert(header.file_type == TAR_FileKind_PaxHeaderX || header.file_type == TAR_FileKind_PaxHeaderG);
|
||||||
header.file_type == TAR_FileKind_PaxHeaderG);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -487,10 +487,12 @@ WND_Frame WND_BeginFrame(G_Format backbuffer_format, WND_BackbufferSizeMode back
|
|||||||
{
|
{
|
||||||
result.minimized = 1;
|
result.minimized = 1;
|
||||||
}
|
}
|
||||||
if (screen_rect.left == monitor_rect.left &&
|
if (
|
||||||
|
screen_rect.left == monitor_rect.left &&
|
||||||
screen_rect.top == monitor_rect.top &&
|
screen_rect.top == monitor_rect.top &&
|
||||||
screen_rect.right == monitor_rect.right &&
|
screen_rect.right == monitor_rect.right &&
|
||||||
screen_rect.bottom == monitor_rect.bottom)
|
screen_rect.bottom == monitor_rect.bottom
|
||||||
|
)
|
||||||
{
|
{
|
||||||
result.fullscreen = 1;
|
result.fullscreen = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user