Fix multithreading in corner normal calculation

This commit is contained in:
Hans Goudey 2022-12-07 14:37:28 -06:00
parent c63e758010
commit 868d885b6d
1 changed files with 8 additions and 1 deletions

View File

@ -1266,7 +1266,10 @@ static void loop_split_worker(TaskPool *__restrict pool, void *taskdata)
nullptr;
for (int i = 0; i < LOOP_SPLIT_TASK_BLOCK_SIZE; i++, data++) {
BLI_assert(data->ml_curr_index > 0);
/* A -1 ml_curr_index is used to tag ended data! */
if (data->ml_curr_index == -1) {
break;
}
loop_split_worker_do(common_data, data, edge_vectors);
}
@ -1432,6 +1435,10 @@ static void loop_split_generator(TaskPool *pool, LoopSplitTaskDataCommon *common
data_buff = (LoopSplitTaskData *)MEM_calloc_arrayN(
LOOP_SPLIT_TASK_BLOCK_SIZE, sizeof(*data_buff), __func__);
}
for (const int i : blender::IndexRange(LOOP_SPLIT_TASK_BLOCK_SIZE)) {
/* Used to tag the end of the buffer. */
data_buff[i].ml_curr_index = -1;
}
data = &data_buff[data_idx];
}
else {