[Bf-blender-cvs] [868d885b6d4] refactor-mesh-corners-generic: Fix multithreading in corner normal calculation
Hans Goudey
noreply at git.blender.org
Wed Dec 7 23:23:30 CET 2022
Commit: 868d885b6d48e2ca3a5121f5a6e174fd49174243
Author: Hans Goudey
Date: Wed Dec 7 14:37:28 2022 -0600
Branches: refactor-mesh-corners-generic
https://developer.blender.org/rB868d885b6d48e2ca3a5121f5a6e174fd49174243
Fix multithreading in corner normal calculation
===================================================================
M source/blender/blenkernel/intern/mesh_normals.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/mesh_normals.cc b/source/blender/blenkernel/intern/mesh_normals.cc
index 2b3981971dc..866d49d4a60 100644
--- a/source/blender/blenkernel/intern/mesh_normals.cc
+++ b/source/blender/blenkernel/intern/mesh_normals.cc
@@ -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 {
More information about the Bf-blender-cvs
mailing list