Blender Git Commit Log
Git Commits -> Revision 11972c0
Revision 11972c0 by Sergey Sharybin (master) June 28, 2013, 21:58 (GMT) |
Towards threaded object update This commit contains changes related on running function BKE_object_handle_update_ex from multiple threads in order to increase scene update time when having multiple independent groups of objects. Currently this required changes to two areas: - scene.c, where scene_update_tagged_recursive is now using threads for updating the object There're some tricks to prevent threads from being spawned when it's not needed: * Threading will only happen if there're more than one CPU core. * Threading will happen only if there're more than single object which needed to be updated. There's currently one crappy part of the change: which is freeing object caches (derivedFinal, derivedDeform and so) from main thread. This is so because in case VBO are used freeing DM is not thread safe. This is because DrawObject used global array. Would look into possibility of making that code safe later. There're also currently some ifdef-ed debug-only code, which helps a lot troubleshooting whether everything is working fine. This code looks a bit ugly now, will either drop it later or make it more cleat. And one more thing: threaded update is CURRENTLY DISABLED. This is because of some thread-unsafe issues discovered while was working on this patch. Namely: * I have once a crash in Curve module. Wasn't been able to reproduce the crash, but could thing about some unsafe code there. * Virtual modifier list is not thread-safe (it uses static variables). * Armature modifier is also doesn't seem to be thread safe because of storing some temporary runtime data in actual armature. All this issues are to be solved next. - depsgraph.c, where i've added a function which gives list of groups, each group contains objects and dependency is only allowed between objects inside one group. This is needed to make scheduling of objects easier, which means update threads will operate on groups, and will handle objects one-by-one inside group. Different threads will operate on different groups. Currently such groups will be generated on every update. Actually, on every run of scene_update_objects_threaded which only happens if there're objects marked for update. In the future we could consider storing such groups in graph itself, which will help saving CPU power on building such groups. But this is something to be discussed with Joshua first. P.S. If you really want to test threaded update, you'll need to replace: #undef USE_THREADED_UPDATE with: #define USE_THREADED_UPDATE |
Commit Details:
Full Hash: 11972c0d829abd7d3fa86341610060f9e39e94da
SVN Revision: 57864
Parent Commit: f934825
Lines Changed: +526, -17
5 Modified Paths:
/source/blender/blenkernel/BKE_depsgraph.h (+49, -0) (Diff)
/source/blender/blenkernel/intern/depsgraph.c (+174, -0) (Diff)
/source/blender/blenkernel/intern/DerivedMesh.c (+1, -0) (Diff)
/source/blender/blenkernel/intern/scene.c (+283, -17) (Diff)
/source/blender/windowmanager/intern/wm_operators.c (+19, -0) (Diff)
/source/blender/blenkernel/intern/depsgraph.c (+174, -0) (Diff)
/source/blender/blenkernel/intern/DerivedMesh.c (+1, -0) (Diff)
/source/blender/blenkernel/intern/scene.c (+283, -17) (Diff)
/source/blender/windowmanager/intern/wm_operators.c (+19, -0) (Diff)