Optimize scenes loading with Job System

This commit is contained in:
Wojtek Figat
2023-10-01 10:55:01 +02:00
parent f77198c7ca
commit b960600102
11 changed files with 162 additions and 69 deletions

View File

@@ -228,6 +228,7 @@ int32 JobSystemThread::Run()
void JobSystem::Execute(const Function<void(int32)>& job, int32 jobCount)
{
#if JOB_SYSTEM_ENABLED
// TODO: disable async if called on job thread? or maybe Wait should handle waiting in job thread to do the processing?
if (jobCount > 1)
{
@@ -235,7 +236,8 @@ void JobSystem::Execute(const Function<void(int32)>& job, int32 jobCount)
const int64 jobWaitHandle = Dispatch(job, jobCount);
Wait(jobWaitHandle);
}
else if (jobCount > 0)
else
#endif
{
// Sync
for (int32 i = 0; i < jobCount; i++)