Skip to content

Commit

Permalink
Fix master node thread setup
Browse files Browse the repository at this point in the history
There was a bug where a local -j 0 setting to disable local rendering
would cause a local render thread to be started anyway, which is no
good, since we don't have a bvh populated in that case.
  • Loading branch information
vkoskiv committed Nov 4, 2023
1 parent 32162ee commit 427dc92
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/renderer/renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,20 @@ struct texture *renderFrame(struct renderer *r) {
r->state.workers = calloc(total_thread_count, sizeof(*r->state.workers));

//Create & boot workers (Nonblocking)
for (size_t t = 0; t < total_thread_count; ++t) {
for (int t = 0; t < (int)total_thread_count; ++t) {
r->state.workers[t] = (struct worker){
.client = t > r->prefs.threads - 1? &r->state.clients[t - r->prefs.threads] : NULL,
.client = t > (int)r->prefs.threads - 1 ? &r->state.clients[t - r->prefs.threads] : NULL,
.thread_complete = false,
.renderer = r,
.output = output,
.cam = &camera,
.thread = (struct cr_thread){
.thread_fn = t > r->prefs.threads - 1 ? networkRenderThread : localRenderThread,
.thread_fn = t > (int)r->prefs.threads - 1 ? networkRenderThread : localRenderThread,
.user_data = &r->state.workers[t]
}
};
if (thread_start(&r->state.workers[t].thread)) {
logr(error, "Failed to start worker %zu\n", t);
logr(error, "Failed to start worker %d\n", t);
} else {
r->state.activeThreads++;
}
Expand Down

0 comments on commit 427dc92

Please sign in to comment.