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>2020-11-23 18:26:54 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2020-11-25 22:31:47 +0300
commit02a0f6b04a648b62150a310e67628efc1c0773e8 (patch)
treec28a8cd2636c2b8d6c9aaec444af62f238ba0b04 /source/blender/blenlib/BLI_buffer.h
parent8330e19cb2e7faca9884e34a8f46564250c8c29a (diff)
Fluid Particles: fix viscoelastic spring threading crash again after D7394.
Since D6133 fluid particle code uses thread local storage to collect springs created during a time step before adding them to the actual spring array. Prior to the switch to TBB there was a single finalize callback which was called on the main thread, so it could use psys_sph_flush_springs and insert the new entries into the final buffer. However in D7394 it was replaced with a reduce callback, which is supposed to be thread safe and have no side effects. This means that the only thing it can safely do is copy entries to the other temporary buffer. In addition, careful checking reveals that the 'classical' solver doesn't actually add springs, so reduce isn't needed there. Differential Revision: https://developer.blender.org/D9632
Diffstat (limited to 'source/blender/blenlib/BLI_buffer.h')
-rw-r--r--source/blender/blenlib/BLI_buffer.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_buffer.h b/source/blender/blenlib/BLI_buffer.h
index fc348c25c46..f641c89e53b 100644
--- a/source/blender/blenlib/BLI_buffer.h
+++ b/source/blender/blenlib/BLI_buffer.h
@@ -77,6 +77,16 @@ void BLI_buffer_resize(BLI_Buffer *buffer, const size_t new_count);
/* Ensure size, throwing away old data, respecting BLI_BUFFER_USE_CALLOC */
void BLI_buffer_reinit(BLI_Buffer *buffer, const size_t new_count);
+/* Append an array of elements. */
+void _bli_buffer_append_array(BLI_Buffer *buffer, void *data, size_t count);
+#define BLI_buffer_append_array(buffer_, type_, data_, count_) \
+ { \
+ type_ *__tmp = (data_); \
+ BLI_assert(sizeof(type_) == (buffer_)->elem_size); \
+ _bli_buffer_append_array(buffer_, __tmp, count_); \
+ } \
+ (void)0
+
/* Does not free the buffer structure itself */
void _bli_buffer_free(BLI_Buffer *buffer);
#define BLI_buffer_free(name_) \