Blender Git Loki
Git Commits -> Revision ded22d7
Revision ded22d7 by Sergey Sharybin (master) July 1, 2013, 21:23 (GMT) |
Replace stupid static balancing with task-based one Initially i wanted to have some really simple and basic threading scheduler and wrote one based on traversing depsgraph in advance. But it ended up in some issues with the single-pass traverse i did which didn't gather all the dependencies actually. That was for sure solvable, but it ended up in a bit of time consuming thing and with huge help of Brecht's patch it was faster just to write proper balancing. But it's again really basic thing, which could be easily changed depending on feedback and design decisions from Joshua, So for now it works in the following way: - Currently DagNode is used for threaded evaluaiton, meaning traversing actually happens for DagNodes. This is easier than converting DAG to a graph where only objects are stored, but required adding one int field to DagNode for faster runtime checks. We could change this later when it'll be clear how and where we'll store evaluation data, but for now it work pretty ok. - The new field is called "valency" and it's basically number of node parents which needs to be evaluated before the node itself could be evaluated. - Nodes' valency is getting initialized before threading, and when node finished to update valency of it's childs is getting decreased by one. And if it happens so child's valency became zero, it's adding to task pool. - There's thread lock around valency update, it'll be replaced with spinlock in nearest future. - Another update runtime data is node color. White nodes represents objects, gray one non-objects. Currently it's needed to distinguish whether we need to call object_handle_update on node->ob or not. In the future it could be replaced with node->type to support granularity, meaning we then could update object data separately from object itself. - Needed to add some public depsgraph functions to make it possible to traverse depsgraph without including depsgraph private header to other files. This change doesn't make code anyhow more stable, but solves update order issues noticed while working on fixing underlying bugs. Threaded update is still ifdef-ed for until curves and armatures are considered thread-safe, which is next step to be done. |
Commit Details:
Full Hash: ded22d7060ea1c07d28a95c42cdd04a4b1123467
SVN Revision: 57913
Parent Commit: e00f5d1
Lines Changed: +185, -391
5 Modified Paths:
/source/blender/blenkernel/BKE_depsgraph.h (+17, -47) (Diff)
/source/blender/blenkernel/depsgraph_private.h (+7, -0) (Diff)
/source/blender/blenkernel/intern/depsgraph.c (+80, -138) (Diff)
/source/blender/blenkernel/intern/scene.c (+81, -187) (Diff)
/source/blender/windowmanager/intern/wm_operators.c (+0, -19) (Diff)
/source/blender/blenkernel/depsgraph_private.h (+7, -0) (Diff)
/source/blender/blenkernel/intern/depsgraph.c (+80, -138) (Diff)
/source/blender/blenkernel/intern/scene.c (+81, -187) (Diff)
/source/blender/windowmanager/intern/wm_operators.c (+0, -19) (Diff)