diff options
-rw-r--r-- | source/blender/blenkernel/BKE_depsgraph.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 7 | ||||
-rw-r--r-- | source/blender/depsgraph/CMakeLists.txt | 4 | ||||
-rw-r--r-- | source/blender/depsgraph/SConscript | 3 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph.cc | 9 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_subsurf.c | 5 |
6 files changed, 31 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h index 862f91f567e..7d7db332dd2 100644 --- a/source/blender/blenkernel/BKE_depsgraph.h +++ b/source/blender/blenkernel/BKE_depsgraph.h @@ -72,6 +72,10 @@ enum { * who're using curve deform, where_on_path and so. */ DAG_EVAL_NEED_CURVE_PATH = 1, + /* Scene evaluation would need to have object's data on CPU, + * meaning no GPU shortcuts is allowed. + */ + DAG_EVAL_NEED_CPU = 2, }; /* Global initialization/deinitialization */ diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 2fd53045e29..b7ad43869b7 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1138,6 +1138,13 @@ void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel /* parent relation is for cycle checking */ dag_add_parent_relation(forest, fob1, fob2, rel, name); + /* TODO(sergey): Find a better place for this. */ +#ifdef WITH_OPENSUBDIV + if ((rel & DAG_RL_DATA_DATA) != 0) { + fob1->eval_flags |= DAG_EVAL_NEED_CPU; + } +#endif + while (itA) { /* search if relation exist already */ if (itA->node == fob2) { itA->type |= rel; diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt index dcdb14d0ba0..f3ff709e98b 100644 --- a/source/blender/depsgraph/CMakeLists.txt +++ b/source/blender/depsgraph/CMakeLists.txt @@ -115,4 +115,8 @@ if(WITH_BOOST) add_definitions(-DHAVE_BOOST_FUNCTION_BINDINGS) endif() +if(WITH_OPENSUBDIV) + add_definitions(-DWITH_OPENSUBDIV) +endif() + blender_add_lib(bf_depsgraph "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/depsgraph/SConscript b/source/blender/depsgraph/SConscript index dd0552e19a2..7f49e8f4643 100644 --- a/source/blender/depsgraph/SConscript +++ b/source/blender/depsgraph/SConscript @@ -69,6 +69,9 @@ else: if env['WITH_BF_LEGACY_DEPSGRAPH']: defs.append('WITH_LEGACY_DEPSGRAPH') +if env['WITH_BF_OPENSUBDIV']: + defs.append('WITH_OPENSUBDIV') + env.BlenderLib(libname='bf_depsgraph', sources=sources, includes=incs, defines=defs, libtype=['core', 'player'], priority=[200, 40]) diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc index e9b2a06cf7b..94c01f362be 100644 --- a/source/blender/depsgraph/intern/depsgraph.cc +++ b/source/blender/depsgraph/intern/depsgraph.cc @@ -44,6 +44,8 @@ extern "C" { #include "DNA_object_types.h" #include "DNA_sequence_types.h" +#include "BKE_depsgraph.h" + #include "RNA_access.h" } @@ -351,6 +353,13 @@ DepsRelation *Depsgraph::add_new_relation(OperationDepsNode *from, { /* Create new relation, and add it to the graph. */ 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) { + IDDepsNode *id_to = to->owner->owner; + id_to->eval_flags |= DAG_EVAL_NEED_CPU; + } +#endif return rel; } diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index 5a03da91b2d..ff778e62507 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -42,6 +42,7 @@ #include "BKE_cdderivedmesh.h" +#include "BKE_depsgraph.h" #include "BKE_scene.h" #include "BKE_subsurf.h" @@ -120,7 +121,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, * could be disabled. */ if (md->next == NULL && allow_gpu && do_cddm_convert == false) { - subsurf_flags |= SUBSURF_USE_GPU_BACKEND; + if ((DAG_get_eval_flags_for_object(md->scene, ob) & DAG_EVAL_NEED_CPU) == 0) { + subsurf_flags |= SUBSURF_USE_GPU_BACKEND; + } } #endif |