Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-05-20 10:49:29 +0300
committerHans Goudey <h.goudey@me.com>2022-05-20 10:49:29 +0300
commitb8bd20d7e0238df9a7f558892377f6b304d5ca75 (patch)
tree483a19894d92a721d7db31a48b3aeb6b15ad2153 /source/blender/blenkernel/intern/pbvh_intern.h
parentd27f4e84931798b4366a8058904dd967420a999c (diff)
Fix T96810: Bitmap race condition in PBVH normal calculation
The final normalization step of sculpt normal calculation iterates over all unique vertices in each node and marks them as done. However, storing the done mask in a bitmap meant that multiple threads could write to a single byte at the same time, because the bits for separate threads could be stored in the same byte. This is not threadsafe Fixing this issue seems to improve performance as well. First I tested just clearing the entire bitmap after the normal calculation. Then I tested using an array of booleans instead, which turned out to be slightly better, and simplifies code a bit. I tested on a Ryzen 3800x, on an 8 million polygon subdivided Suzanne by using the grab brush with a radius large enough to affect most of the mesh. | Original | Clear Entire Bitmap | Boolean Array | | --------- | ------------------- | ------------- | | 67.9 ms | 59.1 ms | 57.9 ms | | 1.0x | 1.15x | 1.17x | Differential Revision: https://developer.blender.org/D14985
Diffstat (limited to 'source/blender/blenkernel/intern/pbvh_intern.h')
-rw-r--r--source/blender/blenkernel/intern/pbvh_intern.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/pbvh_intern.h b/source/blender/blenkernel/intern/pbvh_intern.h
index b5480673653..c7c8fbe8bce 100644
--- a/source/blender/blenkernel/intern/pbvh_intern.h
+++ b/source/blender/blenkernel/intern/pbvh_intern.h
@@ -165,7 +165,7 @@ struct PBVH {
/* Used during BVH build and later to mark that a vertex needs to update
* (its normal must be recalculated). */
- BLI_bitmap *vert_bitmap;
+ bool *vert_bitmap;
#ifdef PERFCNTRS
int perf_modified;