diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-01-30 16:06:48 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2014-01-30 16:09:32 +0400 |
commit | 2b55d7895ced2c737e827e6a808634f730d275fc (patch) | |
tree | 093b89da72bde8905281b5259168ccea7bf29b14 /source/blender/modifiers/intern/MOD_util.h | |
parent | 810c6d1880b9cb2944ab2bcb5eb60d8dedd97a64 (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.h')
-rw-r--r-- | source/blender/modifiers/intern/MOD_util.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h index 72077b5c000..cb851a51c64 100644 --- a/source/blender/modifiers/intern/MOD_util.h +++ b/source/blender/modifiers/intern/MOD_util.h @@ -52,4 +52,21 @@ struct DerivedMesh *get_dm_for_modifier(struct Object *ob, ModifierApplyFlag fla void modifier_get_vgroup(struct Object *ob, struct DerivedMesh *dm, const char *name, struct MDeformVert **dvert, int *defgrp_index); +/* XXX workaround for non-threadsafe context in OpenNL (T38403) + * OpenNL uses global pointer for "current context", which causes + * conflict when multiple modifiers get evaluated in threaded depgraph. + * This is just a stupid hack to prevent assert failure / crash, + * otherwise we'd have to modify OpenNL on a large scale. + * OpenNL should be replaced eventually, there are other options (eigen, ceres). + * - lukas_t + */ +#ifdef WITH_OPENNL +#define OPENNL_THREADING_HACK +#endif + +#ifdef OPENNL_THREADING_HACK +void modifier_opennl_lock(void); +void modifier_opennl_unlock(void); +#endif + #endif /* __MOD_UTIL_H__ */ |