feat: Job dispatcher hooked up*

The job dispatcher has been hooked up and four threads are rendering the
scene. There's a super important caveat, though: The job submission is
blocking and will prevent the main thread from continuing to the result
collection. The threads will be unable to contiinue without having
output space, though. Since the buffers are only size 1, this will cause
4 scanlines to be rendered, and then nothing else to be done. Deadlock.
Bumping the input buffer to 100 lets the submission loop fill up the
workload and then move on to collecting.

There's also no scanline sorting, so everything gets <<wiggly>>.
This commit is contained in:
2023-06-24 20:56:28 -05:00
parent d77655af12
commit a4a389c10d
2 changed files with 23 additions and 42 deletions

View File

@@ -42,7 +42,7 @@ impl Dispatcher {
for _ in 0..4 {
// create new command tx/rx pairs. Store tx in the list, give rx to the thread.
let (command_tx, command_rx) = mpsc::sync_channel::<RenderCommand>(1);
let (command_tx, command_rx) = mpsc::sync_channel::<RenderCommand>(100);
// TODO: Pick appropriate command queue depth (or make it controllable, even)
@@ -92,7 +92,7 @@ impl Dispatcher {
}
match self.command_transmitters.get(self.next_to_feed){
Some(target) => target.send(command),
Some(target) => target.send(command).unwrap(),
None => panic!("oh god oh fuck"),
}
self.next_to_feed += 1;