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:
authorLukas Tönne <lukas.toenne@gmail.com>2014-01-30 16:06:48 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2014-01-30 16:09:32 +0400
commit2b55d7895ced2c737e827e6a808634f730d275fc (patch)
tree093b89da72bde8905281b5259168ccea7bf29b14 /source/blender/modifiers/intern/MOD_util.c
parent810c6d1880b9cb2944ab2bcb5eb60d8dedd97a64 (diff)
Fix T38403: Laplacian smooth on instanced objects leads to crash.
The laplacian modifiers (smooth and deform) use the OpenNL library, which is not threadsafe due to the use of a global context variable. Ideally this would be changed so that an explicit context can be created for every caller of the OpenNL functions, but since OpenNL's most recent version is from 2010 this is unlikely to happen. As a workaround for now just use a mutex to prevent conflicting OpenNL calls. Eventually OpenNL can be replaced by eigen or ceres.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_util.c')
-rw-r--r--source/blender/modifiers/intern/MOD_util.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index feae95bf777..0cc9b8bb77b 100644
--- a/source/blender/modifiers/intern/MOD_util.c
+++ b/source/blender/modifiers/intern/MOD_util.c
@@ -61,6 +61,10 @@
#include "RE_shader_ext.h"
+#ifdef OPENNL_THREADING_HACK
+#include "BLI_threads.h"
+#endif
+
void modifier_init_texture(Scene *scene, Tex *tex)
{
if (!tex)
@@ -235,6 +239,24 @@ void modifier_get_vgroup(Object *ob, DerivedMesh *dm, const char *name, MDeformV
}
}
+
+#ifdef OPENNL_THREADING_HACK
+
+static ThreadMutex opennl_context_mutex = BLI_MUTEX_INITIALIZER;
+
+void modifier_opennl_lock(void)
+{
+ BLI_mutex_lock(&opennl_context_mutex);
+}
+
+void modifier_opennl_unlock(void)
+{
+ BLI_mutex_unlock(&opennl_context_mutex);
+}
+
+#endif
+
+
/* only called by BKE_modifier.h/modifier.c */
void modifier_type_init(ModifierTypeInfo *types[])
{