[Bf-blender-cvs] [b024ccd] master: Fix T45929: OpenSubdiv was doing extra object recalc tags

Sergey Sharybin noreply at git.blender.org
Fri Aug 28 14:57:56 CEST 2015


Commit: b024ccd61992e33c62485a80c903a0f284d42dc5
Author: Sergey Sharybin
Date:   Fri Aug 28 14:54:27 2015 +0200
Branches: master
https://developer.blender.org/rBb024ccd61992e33c62485a80c903a0f284d42dc5

Fix T45929: OpenSubdiv was doing extra object recalc tags

===================================================================

M	source/blender/blenkernel/intern/depsgraph.c
M	source/blender/blenkernel/intern/scene.c
M	source/blender/depsgraph/intern/depsgraph.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 1e286b3..0d74c35 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -1143,9 +1143,12 @@ void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel
 	if ((rel & DAG_RL_DATA_DATA) != 0) {
 		if (fob1->type == ID_OB) {
 			if ((fob1->eval_flags & DAG_EVAL_NEED_CPU) == 0) {
-				Object *object = fob1->ob;
-				/* Make sure object has all the data on CPU. */
-				object->recalc |= OB_RECALC_DATA;
+				Object *ob2 = fob2->ob;
+				if (ob2->recalc & OB_RECALC_ALL) {
+					/* Make sure object has all the data on CPU. */
+					Object *ob1 = fob1->ob;
+					ob1->recalc |= OB_RECALC_DATA;
+				}
 				fob1->eval_flags |= DAG_EVAL_NEED_CPU;
 			}
 		}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index cccdbff..f114856 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1587,7 +1587,9 @@ static void scene_free_unused_opensubdiv_cache(Scene *scene)
 			if (md != NULL && md->type == eModifierType_Subsurf) {
 				SubsurfModifierData *smd = (SubsurfModifierData *) md;
 				bool object_in_editmode = object->mode == OB_MODE_EDIT;
-				if (!smd->use_opensubdiv) {
+				if (!smd->use_opensubdiv ||
+				    DAG_get_eval_flags_for_object(scene, object) & DAG_EVAL_NEED_CPU)
+				{
 					if (smd->mCache != NULL) {
 						ccgSubSurf_free_osd_mesh(smd->mCache);
 					}
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index a2c17b0..d9d94d6 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -356,13 +356,15 @@ DepsRelation *Depsgraph::add_new_relation(OperationDepsNode *from,
 	DepsRelation *rel = OBJECT_GUARDED_NEW(DepsRelation, from, to, type, description);
 	/* TODO(sergey): Find a better place for this. */
 #ifdef WITH_OPENSUBDIV
-	if (type == DEPSREL_TYPE_GEOMETRY_EVAL) {
+	ComponentDepsNode *comp_node = from->owner;
+	if (comp_node->type == DEPSNODE_TYPE_GEOMETRY) {
 		IDDepsNode *id_to = to->owner->owner;
-		IDDepsNode *id_from = to->owner->owner;
-		if (id_to != id_from) {
-			if ((id_to->eval_flags & DAG_EVAL_NEED_CPU) == 0) {
-				id_to->tag_update(this);
-				id_to->eval_flags |= DAG_EVAL_NEED_CPU;
+		IDDepsNode *id_from = from->owner->owner;
+		Object *object_to = (Object *)id_to->id;
+		if (id_to != id_from && (object_to->recalc & OB_RECALC_ALL)) {
+			if ((id_from->eval_flags & DAG_EVAL_NEED_CPU) == 0) {
+				id_from->tag_update(this);
+				id_from->eval_flags |= DAG_EVAL_NEED_CPU;
 			}
 		}
 	}




More information about the Bf-blender-cvs mailing list