diff options
author | Hans Goudey <h.goudey@me.com> | 2022-05-20 10:49:29 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-05-20 10:49:29 +0300 |
commit | b8bd20d7e0238df9a7f558892377f6b304d5ca75 (patch) | |
tree | 483a19894d92a721d7db31a48b3aeb6b15ad2153 /source/blender/nodes | |
parent | d27f4e84931798b4366a8058904dd967420a999c (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/nodes')
0 files changed, 0 insertions, 0 deletions