Handmade Hero » Forums » Code » High vs. Low Priority Thread Queues
alexkelbo
Alex
1 posts
#11865 High vs. Low Priority Thread Queues
2 weeks, 2 days ago

Around day 123, Casey introduced threads into the game to speed up the software renderer. We implemented a high and a low priority queue, where the low queue was used to draw the ground tiles.

I can't figure out why the high queue would actually run faster or more frequently. Seems we just created to equally prioritised queues and merely named them "high" and "low" priority. Can someone clarify? What am I missing?
mmozeiko
Mārtiņš Možeiko
1313 posts
1 project
#11866 High vs. Low Priority Thread Queues
2 weeks, 2 days ago

If I remember correctly then high vs low is only about how you will use them. He crated two queues so he can use them differently. One which is high priority and must do tasks quickly (render current frame). And low priority one that can be used to submit tasks that can executes very long (even multiple frames).

So when you are submitting task to queue, you must decide how fast this task should execute and submit to correct queue to not bother other important tasks - basically you don't want to submit all of tasks to same queue, otherwise task that (potentially) executes slowly like ground chunk rendering, or file loading.

That said, ground chunks were removed completely later, so just ignore everything in videos and code that is about ground chunks :)