The engine is lacking a good way of utilizing several threads. After the software rendering is optimized for single-threaded execution in part 3, it will switch to this job system so pixel shading, etc. can run 5-20x faster.
Off the top of my head, the job system needs a private thread pool and some kind of addJob(), isRunning(), and wait() functions. Maybe it could have a queue of std::function<void()> and worker threads would check if the queue is not empty. Later, wait() could take a category tag so it only waits for certain jobs to finish. Basically the job system exists so we don't have to use condition variables directly.
I am a bit shy of threading due to how easily bugs can show up, but the gains in the renderer and elsewhere would be massive.
The engine is lacking a good way of utilizing several threads. After the software rendering is optimized for single-threaded execution in part 3, it will switch to this job system so pixel shading, etc. can run 5-20x faster.
Off the top of my head, the job system needs a private thread pool and some kind of
addJob()
,isRunning()
, andwait()
functions. Maybe it could have a queue ofstd::function<void()>
and worker threads would check if the queue is not empty. Later,wait()
could take a category tag so it only waits for certain jobs to finish. Basically the job system exists so we don't have to use condition variables directly.I am a bit shy of threading due to how easily bugs can show up, but the gains in the renderer and elsewhere would be massive.