Blender Git Loki

Git Commits -> Revision e618d82

Revision e618d82 by Sergey Sharybin (master)
January 13, 2014, 09:57 (GMT)
Fix T38054: High CPU usage with many objects

This is a regression since threaded dependency graph landed to master.
Root of the issue goes to the loads of graph preparation being done
even if there's nothing to be updated.

The idea of this change is to use ID type recalc bits to determine
whether there're objects to be updated. Generally speaking, we now
check object and object data datablocks with DAG_id_type_tagged()
and if there's no such IDs tagged we skip the whole task pool creation
and so,

The only difficult aspect was that in some circumstances it was possible
that there are tagged objects but nothing in ID recalc bit fields.

There were several different circumstances when it was possible:

* When one assigns object->recalc flag directly DAG flush didn't
set corresponding bits to ID recalc bits. Partially it is fixed
by making it so flush will set bitfield, but also for object
types there's no reason to assign recalc flag directly. Using
generic DAG_id_type_tag works almost the same fast as direct
assignment, ensures all the bitflags are set properly and for the
long run it seems it's what we would actually want to.

* DAG_on_visible_update() didn't set recalc bits at all.

* Some areas were checking for object->recalc != 0, however it is was
possible that object recalc flag contains PSYS_RECALC_CHILD which
was never cleaned from there.

No idea why would we need to assign such a flag when enabling
scene simplification, this is to be investigated separately.

* It is possible that scene_update_post and frame_update_post handlers
will modify objects. The issue is that DAG_ids_clear_recalc is called
just after callbacks, which leaves objects with recalc flags but no
corresponding bit in ID recalc bitfield. This leads to some kind of
regression when using ID type tag fields to check whether there objects
to be updated internally comparing threaded DAG with legacy one.

For now let's have a workaround which will preserve tag for ID_OB
if there're objects with OB_RECALC_ALL bits. This keeps behavior
unchanged comparing with 2.69 release.

Commit Details:

Full Hash: e618d8238e0e065bdfd2d9332ba7231e870a7e7d
Parent Commit: ac077f0
Lines Changed: +140, -18

8 Modified Paths:

/source/blender/blenkernel/intern/depsgraph.c (+58, -5) (Diff)
/source/blender/blenkernel/intern/library.c (+2, -0) (Diff)
/source/blender/blenkernel/intern/scene.c (+67, -5) (Diff)
/source/blender/editors/mesh/editmesh_utils.c (+4, -1) (Diff)
/source/blender/editors/transform/transform_conversions.c (+3, -5) (Diff)
/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp (+2, -1) (Diff)
/source/blender/makesrna/intern/rna_scene.c (+1, -0) (Diff)
/source/blender/render/intern/source/convertblender.c (+3, -1) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021