Add workaroud to make threaded object update stable

Added threading lock around unsafe part of do_makeDispListCurveTypes
(parts which touches Curve->bev and Curve->path). Namely it means
pre-tesselation modifiers, bevel, path and non-modified display
list will be calculated inside a locked thread.

Post-tessellation modifiers will eb calculated outside of locked
thread, which means heavy constructive or deformation modifiers
applying on tesselated spline will be nicely threaded.

This makes it possible to use threaded object update by default
in the branch, so everyone could start testing it.
This commit is contained in:
Sergey Sharybin
2013-07-02 19:23:03 +00:00
parent 41f0c137ba
commit d50ff36d3d
2 changed files with 8 additions and 8 deletions

View File

@@ -45,6 +45,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_scanfill.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "BKE_global.h"
@@ -1394,6 +1395,9 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
nubase = BKE_curve_nurbs_get(cu);
/* XXX: Temp workaround for depsgraph_mt branch. */
BLI_lock_thread(LOCK_CUSTOM1);
BLI_freelistN(&(cu->bev));
if (cu->path) free_path(cu->path);
@@ -1594,6 +1598,10 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
if (cu->bb == NULL) {
cu->bb = MEM_callocN(sizeof(BoundBox), "boundbox");
}
/* XXX: Temp workaround for depsgraph_mt branch. */
BLI_unlock_thread(LOCK_CUSTOM1);
boundbox_dispbase(cu->bb, dispbase);
if (!forRender) {

View File

@@ -1164,8 +1164,6 @@ static void scene_do_rb_simulation_recursive(Scene *scene, float ctime)
BKE_rigidbody_do_simulation(scene, ctime);
}
#undef USE_THREADED_UPDATE
typedef struct ThreadedObjectUpdateState {
Scene *scene;
Scene *scene_parent;
@@ -1329,12 +1327,6 @@ static void scene_update_objects(Scene *scene, Scene *scene_parent)
}
}
#ifndef USE_THREADED_UPDATE
if (true) {
scene_update_all_bases(scene, scene_parent);
}
else
#endif
if (update_count > 1) {
scene_update_objects_threaded(scene, scene_parent);
}