fix fence signedness
This commit is contained in:
parent
1abf58d45b
commit
64dad2457c
@ -196,14 +196,14 @@ void YieldOnCounter(Counter *counter)
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Fence
|
//~ Fence
|
||||||
|
|
||||||
u64 FetchFence(Fence *fence)
|
i64 FetchFence(Fence *fence)
|
||||||
{
|
{
|
||||||
return Atomic64Fetch(&fence->v.v);
|
return Atomic64Fetch(&fence->v.v);
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 FetchSetFence(Fence *fence, u64 x)
|
i64 FetchSetFence(Fence *fence, i64 x)
|
||||||
{
|
{
|
||||||
u64 fetch = Atomic64FetchSet(&fence->v.v, x);
|
i64 fetch = Atomic64FetchSet(&fence->v.v, x);
|
||||||
if (x > fetch)
|
if (x > fetch)
|
||||||
{
|
{
|
||||||
FutexWakeGte(&fence->v.v);
|
FutexWakeGte(&fence->v.v);
|
||||||
@ -211,16 +211,16 @@ u64 FetchSetFence(Fence *fence, u64 x)
|
|||||||
return fetch;
|
return fetch;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 FetchAddFence(Fence *fence, u64 x)
|
i64 FetchAddFence(Fence *fence, i64 x)
|
||||||
{
|
{
|
||||||
u64 fetch = Atomic64FetchAdd(&fence->v.v, x);
|
i64 fetch = Atomic64FetchAdd(&fence->v.v, x);
|
||||||
FutexWakeGte(&fence->v.v);
|
FutexWakeGte(&fence->v.v);
|
||||||
return fetch;
|
return fetch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void YieldOnFence(Fence *fence, u64 target)
|
void YieldOnFence(Fence *fence, i64 target)
|
||||||
{
|
{
|
||||||
u64 v = Atomic64Fetch(&fence->v.v);
|
i64 v = Atomic64Fetch(&fence->v.v);
|
||||||
while (v < target)
|
while (v < target)
|
||||||
{
|
{
|
||||||
FutexYieldGte(&fence->v.v, &v, sizeof(v));
|
FutexYieldGte(&fence->v.v, &v, sizeof(v));
|
||||||
|
|||||||
@ -85,8 +85,8 @@ void YieldOnCounter(Counter *counter);
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Fence operations
|
//~ Fence operations
|
||||||
|
|
||||||
u64 FetchFence(Fence *fence);
|
i64 FetchFence(Fence *fence);
|
||||||
u64 FetchSetFence(Fence *fence, u64 x);
|
i64 FetchSetFence(Fence *fence, i64 x);
|
||||||
u64 FetchAddFence(Fence *fence, u64 x);
|
i64 FetchAddFence(Fence *fence, i64 x);
|
||||||
|
|
||||||
void YieldOnFence(Fence *fence, u64 target);
|
void YieldOnFence(Fence *fence, i64 target);
|
||||||
|
|||||||
@ -47,10 +47,18 @@ StringList GetCommandLineArgs(void)
|
|||||||
void Echo(String msg)
|
void Echo(String msg)
|
||||||
{
|
{
|
||||||
HANDLE console_handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
HANDLE console_handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
if (console_handle != INVALID_HANDLE_VALUE)
|
if (console_handle && console_handle != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
WriteFile(console_handle, msg.text, msg.len, 0, 0);
|
WriteFile(console_handle, msg.text, msg.len, 0, 0);
|
||||||
}
|
}
|
||||||
|
else if (IsRunningInDebugger())
|
||||||
|
{
|
||||||
|
char msg_cstr[16384];
|
||||||
|
u64 len = MinU64(countof(msg_cstr) - 1, msg.len);
|
||||||
|
CopyBytes(msg_cstr, msg.text, len);
|
||||||
|
msg_cstr[len] = 0;
|
||||||
|
OutputDebugStringA(msg_cstr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
b32 Panic(String msg)
|
b32 Panic(String msg)
|
||||||
@ -127,7 +135,7 @@ void ExitNow(i32 code)
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Startup / shutdown jobs
|
//~ Startup / shutdown jobs
|
||||||
|
|
||||||
JobDef(W32_StartupLayersJob, UNUSED sig, UNUSED id)
|
JobDef(W32_StartupLayers, UNUSED sig, UNUSED id)
|
||||||
{
|
{
|
||||||
W32_SharedState *g = &W32_shared_state;
|
W32_SharedState *g = &W32_shared_state;
|
||||||
TempArena scratch = BeginScratchNoConflict();
|
TempArena scratch = BeginScratchNoConflict();
|
||||||
@ -138,7 +146,7 @@ JobDef(W32_StartupLayersJob, UNUSED sig, UNUSED id)
|
|||||||
EndScratch(scratch);
|
EndScratch(scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
JobDef(W32_ShutdownLayersJob, UNUSED sig, UNUSED id)
|
JobDef(W32_ShutdownLayers, UNUSED sig, UNUSED id)
|
||||||
{
|
{
|
||||||
__prof;
|
__prof;
|
||||||
W32_SharedState *g = &W32_shared_state;
|
W32_SharedState *g = &W32_shared_state;
|
||||||
@ -275,7 +283,7 @@ i32 W32_Main(void)
|
|||||||
/* Startup layers */
|
/* Startup layers */
|
||||||
if (!Atomic32Fetch(&g->panicking))
|
if (!Atomic32Fetch(&g->panicking))
|
||||||
{
|
{
|
||||||
RunJob(W32_StartupLayersJob);
|
RunJob(W32_StartupLayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait for startup end or panic */
|
/* Wait for startup end or panic */
|
||||||
@ -303,7 +311,7 @@ i32 W32_Main(void)
|
|||||||
/* Run exit callbacks job */
|
/* Run exit callbacks job */
|
||||||
if (!Atomic32Fetch(&g->panicking))
|
if (!Atomic32Fetch(&g->panicking))
|
||||||
{
|
{
|
||||||
RunJob(W32_ShutdownLayersJob);
|
RunJob(W32_ShutdownLayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait for exit end or panic */
|
/* Wait for exit end or panic */
|
||||||
|
|||||||
@ -56,8 +56,8 @@ BOOL W32_FindEmbeddedRcData(HMODULE module, LPCWSTR type, LPWSTR wstr_entry_name
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Startup / shutdown jobs
|
//~ Startup / shutdown jobs
|
||||||
|
|
||||||
JobDecl(W32_StartupLayersJob, EmptySig);
|
JobDecl(W32_StartupLayers, EmptySig);
|
||||||
JobDecl(W32_ShutdownLayersJob, EmptySig);
|
JobDecl(W32_ShutdownLayers, EmptySig);
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Main
|
//~ Main
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Load job
|
//~ Load job
|
||||||
|
|
||||||
JobDef(F_LoadJob, sig, _)
|
JobDef(F_Load, sig, _)
|
||||||
{
|
{
|
||||||
__prof;
|
__prof;
|
||||||
TempArena scratch = BeginScratchNoConflict();
|
TempArena scratch = BeginScratchNoConflict();
|
||||||
@ -123,8 +123,8 @@ AC_Asset *F_LoadAsset(Resource resource, f32 point_size, b32 wait)
|
|||||||
{
|
{
|
||||||
AC_MarkLoading(asset);
|
AC_MarkLoading(asset);
|
||||||
{
|
{
|
||||||
Job *job = OpenJob(F_LoadJob, JobPool_Background);
|
Job *job = OpenJob(F_Load, JobPool_Background);
|
||||||
F_LoadJob_Sig *sig = PushStruct(job->arena, F_LoadJob_Sig);
|
F_Load_Sig *sig = PushStruct(job->arena, F_Load_Sig);
|
||||||
sig->asset = asset;
|
sig->asset = asset;
|
||||||
sig->resource = resource;
|
sig->resource = resource;
|
||||||
sig->point_size = point_size;
|
sig->point_size = point_size;
|
||||||
|
|||||||
@ -27,7 +27,7 @@ Struct(F_Font)
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Font load job
|
//~ Font load job
|
||||||
|
|
||||||
JobDecl(F_LoadJob, { AC_Asset *asset; f32 point_size; Resource resource; });
|
JobDecl(F_Load, { AC_Asset *asset; f32 point_size; Resource resource; });
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Font load operations
|
//~ Font load operations
|
||||||
|
|||||||
@ -105,8 +105,8 @@ Struct(RunCommandResult)
|
|||||||
i64 elapsed_ns;
|
i64 elapsed_ns;
|
||||||
};
|
};
|
||||||
|
|
||||||
JobDecl(RunCommandJob, { String *cmds; RunCommandResult *results; });
|
JobDecl(RunCommand, { String *cmds; RunCommandResult *results; });
|
||||||
JobDef(RunCommandJob, sig, id)
|
JobDef(RunCommand, sig, id)
|
||||||
{
|
{
|
||||||
i64 start_ns = TimeNs();
|
i64 start_ns = TimeNs();
|
||||||
Arena *arena = PermArena();
|
Arena *arena = PermArena();
|
||||||
@ -192,8 +192,8 @@ void InheritStepResults(Arena *arena, StepResult *dst, u64 srcs_count, StepResul
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JobDecl(StepJob, { StepParams *params; StepResult *results; });
|
JobDecl(Step, { StepParams *params; StepResult *results; });
|
||||||
JobDef(StepJob, sig, id)
|
JobDef(Step, sig, id)
|
||||||
{
|
{
|
||||||
StepParams *params = &sig->params[id];
|
StepParams *params = &sig->params[id];
|
||||||
StepParamsFlag flags = params->flags;
|
StepParamsFlag flags = params->flags;
|
||||||
@ -530,7 +530,7 @@ JobDef(StepJob, sig, id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
JobCounter counter = ZI;
|
JobCounter counter = ZI;
|
||||||
RunJob(RunCommandJob,
|
RunJob(RunCommand,
|
||||||
.count = shader_entries_count,
|
.count = shader_entries_count,
|
||||||
.counter = &counter,
|
.counter = &counter,
|
||||||
.sig = { .cmds = compile_cmds, .results = compile_results });
|
.sig = { .cmds = compile_cmds, .results = compile_results });
|
||||||
@ -567,7 +567,7 @@ JobDef(StepJob, sig, id)
|
|||||||
arc_params.arc_dir = shader_store_name;
|
arc_params.arc_dir = shader_store_name;
|
||||||
|
|
||||||
JobCounter counter = ZI;
|
JobCounter counter = ZI;
|
||||||
RunJob(StepJob, .counter = &counter, .sig.params = &arc_params, .sig.results = &arc_results);
|
RunJob(Step, .counter = &counter, .sig.params = &arc_params, .sig.results = &arc_results);
|
||||||
YieldOnJobs(&counter);
|
YieldOnJobs(&counter);
|
||||||
InheritStepResults(arena, result, 1, &arc_results);
|
InheritStepResults(arena, result, 1, &arc_results);
|
||||||
}
|
}
|
||||||
@ -643,7 +643,7 @@ JobDef(StepJob, sig, id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
JobCounter counter = ZI;
|
JobCounter counter = ZI;
|
||||||
RunJob(StepJob,
|
RunJob(Step,
|
||||||
.counter = &counter,
|
.counter = &counter,
|
||||||
.count = dir_embeds_count,
|
.count = dir_embeds_count,
|
||||||
.sig.params = arc_params_array,
|
.sig.params = arc_params_array,
|
||||||
@ -805,8 +805,8 @@ JobDef(StepJob, sig, id)
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Startup
|
//~ Startup
|
||||||
|
|
||||||
JobDecl(BuildJob, EmptySig);
|
JobDecl(Build, EmptySig);
|
||||||
JobDef(BuildJob, _, __)
|
JobDef(Build, _, __)
|
||||||
{
|
{
|
||||||
Arena *arena = PermArena();
|
Arena *arena = PermArena();
|
||||||
M_ErrorList errors = ZI;
|
M_ErrorList errors = ZI;
|
||||||
@ -994,7 +994,7 @@ JobDef(BuildJob, _, __)
|
|||||||
resource_params->flattened = flattened;
|
resource_params->flattened = flattened;
|
||||||
|
|
||||||
JobCounter step_counter = ZI;
|
JobCounter step_counter = ZI;
|
||||||
RunJob(StepJob, .count = countof(params_array), .counter = &step_counter, .sig.params = params_array, .sig.results = results_array);
|
RunJob(Step, .count = countof(params_array), .counter = &step_counter, .sig.params = params_array, .sig.results = results_array);
|
||||||
YieldOnJobs(&step_counter);
|
YieldOnJobs(&step_counter);
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
@ -1108,5 +1108,5 @@ JobDef(BuildJob, _, __)
|
|||||||
void StartupLayers(void)
|
void StartupLayers(void)
|
||||||
{
|
{
|
||||||
OS_Startup();
|
OS_Startup();
|
||||||
RunJob(BuildJob, .pool = JobPool_Hyper);
|
RunJob(Build, .pool = JobPool_Hyper);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,7 +101,7 @@ void P_Startup(void)
|
|||||||
g->socks_arena = AcquireArena(Gibi(64));
|
g->socks_arena = AcquireArena(Gibi(64));
|
||||||
|
|
||||||
//- Init timer
|
//- Init timer
|
||||||
RunJob(P_W32_TimerJob);
|
RunJob(P_W32_UpdateTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
@ -868,7 +868,7 @@ P_Address P_W32_PlatformAddressFromWin32Address(P_W32_Address ws_addr)
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Timer job
|
//~ Timer job
|
||||||
|
|
||||||
JobDef(P_W32_TimerJob, _, __)
|
JobDef(P_W32_UpdateTimer, _, __)
|
||||||
{
|
{
|
||||||
P_W32_SharedState *g = &P_W32_shared_state;
|
P_W32_SharedState *g = &P_W32_shared_state;
|
||||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
||||||
@ -887,6 +887,8 @@ JobDef(P_W32_TimerJob, _, __)
|
|||||||
periods[i] = P_W32_DefaultTimerPeriodNs;
|
periods[i] = P_W32_DefaultTimerPeriodNs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Echo(Lit("Starting timer\n"));
|
||||||
|
|
||||||
i64 last_cycle_ns = 0;
|
i64 last_cycle_ns = 0;
|
||||||
/* FIXME: shutdown */
|
/* FIXME: shutdown */
|
||||||
for (;;)
|
for (;;)
|
||||||
|
|||||||
@ -180,4 +180,4 @@ P_Address P_W32_PlatformAddressFromWin32Address(P_W32_Address ws_addr);
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Timer job
|
//~ Timer job
|
||||||
|
|
||||||
JobDecl(P_W32_TimerJob, EmptySig);
|
JobDecl(P_W32_UpdateTimer, EmptySig);
|
||||||
|
|||||||
@ -15,7 +15,7 @@ void PB_Startup(void)
|
|||||||
PB_WSP_SharedState *g = &PB_WSP_shared_state;
|
PB_WSP_SharedState *g = &PB_WSP_shared_state;
|
||||||
PB_WSP_InitializeWasapi();
|
PB_WSP_InitializeWasapi();
|
||||||
/* Start playback job */
|
/* Start playback job */
|
||||||
RunJob(PB_WSP_PlaybackJob, .pool = JobPool_Audio, .counter = &g->shutdown_job_counter);
|
RunJob(PB_WSP_Playback, .pool = JobPool_Audio, .counter = &g->shutdown_job_counter);
|
||||||
OnExit(&PB_WSP_Shutdown);
|
OnExit(&PB_WSP_Shutdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ void PB_WSP_EndUpdate(PB_WSP_Buff *wspbuf, MIX_PcmF32 src)
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Playback job
|
//~ Playback job
|
||||||
|
|
||||||
JobDef(PB_WSP_PlaybackJob, UNUSED sig, UNUSED id)
|
JobDef(PB_WSP_Playback, UNUSED sig, UNUSED id)
|
||||||
{
|
{
|
||||||
__prof;
|
__prof;
|
||||||
PB_WSP_SharedState *g = &PB_WSP_shared_state;
|
PB_WSP_SharedState *g = &PB_WSP_shared_state;
|
||||||
|
|||||||
@ -50,4 +50,4 @@ void PB_WSP_EndUpdate(PB_WSP_Buff *wspbuf, MIX_PcmF32 src);
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Playback job
|
//~ Playback job
|
||||||
|
|
||||||
JobDecl(PB_WSP_PlaybackJob, EmptySig);
|
JobDecl(PB_WSP_Playback, EmptySig);
|
||||||
|
|||||||
10
src/pp/pp.c
10
src/pp/pp.c
@ -48,8 +48,8 @@ void StartupUser(void)
|
|||||||
P_ShowWindow(g->window);
|
P_ShowWindow(g->window);
|
||||||
|
|
||||||
/* Start jobs */
|
/* Start jobs */
|
||||||
RunJob(UpdateUserJob, .pool = JobPool_User, .counter = &g->shutdown_job_counter);
|
RunJob(UpdateUserOrSleep, .pool = JobPool_User, .counter = &g->shutdown_job_counter);
|
||||||
RunJob(SimJob, .pool = JobPool_Sim, .counter = &g->shutdown_job_counter);
|
RunJob(UpdateSim, .pool = JobPool_Sim, .counter = &g->shutdown_job_counter);
|
||||||
OnExit(&ShutdownUser);
|
OnExit(&ShutdownUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2445,7 +2445,7 @@ void UpdateUser(P_Window *window)
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ User update job
|
//~ User update job
|
||||||
|
|
||||||
JobDef(UpdateUserJob, UNUSED sig, UNUSED id)
|
JobDef(UpdateUserOrSleep, UNUSED sig, UNUSED id)
|
||||||
{
|
{
|
||||||
SharedUserState *g = &shared_user_state;
|
SharedUserState *g = &shared_user_state;
|
||||||
i64 time_ns = TimeNs();
|
i64 time_ns = TimeNs();
|
||||||
@ -2459,7 +2459,7 @@ JobDef(UpdateUserJob, UNUSED sig, UNUSED id)
|
|||||||
GPU_WaitOnSwapchain(g->swapchain);
|
GPU_WaitOnSwapchain(g->swapchain);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
__profn("Frame limiter wait");
|
__profn("Frame limiter wait");;
|
||||||
P_SleepFrame(time_ns, 1000000000 / FPS_LIMIT);
|
P_SleepFrame(time_ns, 1000000000 / FPS_LIMIT);
|
||||||
time_ns = TimeNs();
|
time_ns = TimeNs();
|
||||||
}
|
}
|
||||||
@ -2511,7 +2511,7 @@ void GenerateuserInputCmds(Client *user_input_client, u64 tick)
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Sim update
|
//~ Sim update
|
||||||
|
|
||||||
JobDef(SimJob, UNUSED sig, UNUSED id)
|
JobDef(UpdateSim, UNUSED sig, UNUSED id)
|
||||||
{
|
{
|
||||||
SharedUserState *g = &shared_user_state;
|
SharedUserState *g = &shared_user_state;
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
@ -311,7 +311,7 @@ void UpdateUser(P_Window *window);
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ User update job
|
//~ User update job
|
||||||
|
|
||||||
JobDecl(UpdateUserJob, EmptySig);
|
JobDecl(UpdateUserOrSleep, EmptySig);
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ User input cmds
|
//~ User input cmds
|
||||||
@ -319,6 +319,6 @@ JobDecl(UpdateUserJob, EmptySig);
|
|||||||
void GenerateuserInputCmds(Client *user_input_client, u64 tick);
|
void GenerateuserInputCmds(Client *user_input_client, u64 tick);
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Sim update
|
//~ Sim update job
|
||||||
|
|
||||||
JobDecl(SimJob, EmptySig);
|
JobDecl(UpdateSim, EmptySig);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Load job
|
//~ Load job
|
||||||
|
|
||||||
JobDef(SND_LoadJob, sig, UNUSED id)
|
JobDef(SND_Load, sig, UNUSED id)
|
||||||
{
|
{
|
||||||
__prof;
|
__prof;
|
||||||
TempArena scratch = BeginScratchNoConflict();
|
TempArena scratch = BeginScratchNoConflict();
|
||||||
@ -99,8 +99,8 @@ AC_Asset *SND_LoadAsset(Resource resource, SND_SoundFlag flags, b32 wait)
|
|||||||
{
|
{
|
||||||
AC_MarkLoading(asset);
|
AC_MarkLoading(asset);
|
||||||
{
|
{
|
||||||
Job *job = OpenJob(SND_LoadJob, JobPool_Background);
|
Job *job = OpenJob(SND_Load, JobPool_Background);
|
||||||
SND_LoadJob_Sig *sig = PushStruct(job->arena, SND_LoadJob_Sig);
|
SND_Load_Sig *sig = PushStruct(job->arena, SND_Load_Sig);
|
||||||
sig->resource = resource;
|
sig->resource = resource;
|
||||||
sig->asset = asset;
|
sig->asset = asset;
|
||||||
sig->flags = flags;
|
sig->flags = flags;
|
||||||
|
|||||||
@ -19,7 +19,7 @@ Struct(SND_Sound)
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Sound load operations
|
//~ Sound load operations
|
||||||
|
|
||||||
JobDecl(SND_LoadJob, { SND_SoundFlag flags; AC_Asset *asset; Resource resource; });
|
JobDecl(SND_Load, { SND_SoundFlag flags; AC_Asset *asset; Resource resource; });
|
||||||
AC_Asset *SND_LoadAsset(Resource resource, SND_SoundFlag flags, b32 wait);
|
AC_Asset *SND_LoadAsset(Resource resource, SND_SoundFlag flags, b32 wait);
|
||||||
SND_Sound *SND_LoadSoundAsync(Resource resource, SND_SoundFlag flags);
|
SND_Sound *SND_LoadSoundAsync(Resource resource, SND_SoundFlag flags);
|
||||||
SND_Sound *SND_LoadSoundWait(Resource resource, SND_SoundFlag flags);
|
SND_Sound *SND_LoadSoundWait(Resource resource, SND_SoundFlag flags);
|
||||||
|
|||||||
@ -5,7 +5,7 @@ S_SharedState S_shared_state = ZI;
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Load jobs
|
//~ Load jobs
|
||||||
|
|
||||||
JobDef(S_LoadTextureJob, sig, _)
|
JobDef(S_LoadTexture, sig, _)
|
||||||
{
|
{
|
||||||
TempArena scratch = BeginScratchNoConflict();
|
TempArena scratch = BeginScratchNoConflict();
|
||||||
S_Entry *entry = sig->entry;
|
S_Entry *entry = sig->entry;
|
||||||
@ -40,7 +40,7 @@ JobDef(S_LoadTextureJob, sig, _)
|
|||||||
EndScratch(scratch);
|
EndScratch(scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
JobDef(S_LoadSheetJob, sig, _)
|
JobDef(S_LoadSheet, sig, _)
|
||||||
{
|
{
|
||||||
TempArena scratch = BeginScratchNoConflict();
|
TempArena scratch = BeginScratchNoConflict();
|
||||||
Arena *perm = PermArena();
|
Arena *perm = PermArena();
|
||||||
@ -286,13 +286,13 @@ S_Entry *S_FetchEntry(Resource resource, JobPool pool, S_FetchFlag flags)
|
|||||||
&& !Atomic32Fetch(&entry->texture_touched)
|
&& !Atomic32Fetch(&entry->texture_touched)
|
||||||
&& !Atomic32FetchTestSet(&entry->texture_touched, 0, 1))
|
&& !Atomic32FetchTestSet(&entry->texture_touched, 0, 1))
|
||||||
{
|
{
|
||||||
RunJob(S_LoadTextureJob, .pool = pool, .sig.entry = entry);
|
RunJob(S_LoadTexture, .pool = pool, .sig.entry = entry);
|
||||||
}
|
}
|
||||||
if ((flags & S_FetchFlag_Sheet)
|
if ((flags & S_FetchFlag_Sheet)
|
||||||
&& !Atomic32Fetch(&entry->sheet_touched)
|
&& !Atomic32Fetch(&entry->sheet_touched)
|
||||||
&& !Atomic32FetchTestSet(&entry->sheet_touched, 0, 1))
|
&& !Atomic32FetchTestSet(&entry->sheet_touched, 0, 1))
|
||||||
{
|
{
|
||||||
RunJob(S_LoadSheetJob, .pool = pool, .sig.entry = entry);
|
RunJob(S_LoadSheet, .pool = pool, .sig.entry = entry);
|
||||||
}
|
}
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -133,8 +133,8 @@ Struct(S_SharedState)
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Load jobs
|
//~ Load jobs
|
||||||
|
|
||||||
JobDecl(S_LoadTextureJob, { S_Entry *entry; });
|
JobDecl(S_LoadTexture, { S_Entry *entry; });
|
||||||
JobDecl(S_LoadSheetJob, { S_Entry *entry; });
|
JobDecl(S_LoadSheet, { S_Entry *entry; });
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Cache operations
|
//~ Cache operations
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user