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:
authorAlexander Gavrilov <angavrilov@gmail.com>2019-10-26 11:06:19 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2019-11-09 13:44:43 +0300
commitdca32f2b4f290bcf8c110c21d2cdecc04d390934 (patch)
tree903724013134314afa083259b5f9a69de292774a /source/blender/blenkernel/BKE_particle.h
parent6f1237b2ebda5c55414851d5c227fb819c3bc75b (diff)
Fluid Particles: fix threading crash with viscoelastic springs.
As correctly pointed out by a comment in the code, adding new springs wasn't thread safe, and caused crashes. Fix by buffering new springs in intermediate thread-local arrays, which are flushed on the main thread. This is valid because the new springs are not used until the next sim step. Differential Revision: https://developer.blender.org/D6133
Diffstat (limited to 'source/blender/blenkernel/BKE_particle.h')
-rw-r--r--source/blender/blenkernel/BKE_particle.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index e9b4c2b5a66..857ed607dd8 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -28,6 +28,7 @@
*/
#include "BLI_utildefines.h"
+#include "BLI_buffer.h"
#include "DNA_particle_types.h"
#include "DNA_object_types.h"
@@ -108,6 +109,9 @@ typedef struct SPHData {
float element_size;
float flow[3];
+ /* Temporary thread-local buffer for springs created during this step. */
+ BLI_Buffer new_springs;
+
/* Integrator callbacks. This allows different SPH implementations. */
void (*force_cb)(void *sphdata_v, ParticleKey *state, float *force, float *impulse);
void (*density_cb)(void *rangedata_v, int index, const float co[3], float squared_dist);