diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-05-20 13:45:43 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-05-20 13:48:29 +0300 |
commit | eb6bab25ba9b71352769621b7e2f0a2df3dd0a4f (patch) | |
tree | 362ede0967b9bd0a62b8c70adcb7778fabf1f8c7 | |
parent | 8c6a9b9edcd0cdfe00b5d20f3f4d1918467edea8 (diff) |
Add dedicated command argument to switch depsgraph to a single-threaded evaluation
This way it is possible to have single threaded depsgraph but threaded other areas
which is handy for torubleshooting.
he argument is: --debug-depsgraph-no-threads
-rw-r--r-- | source/blender/blenkernel/BKE_global.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 3 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_eval.cc | 4 | ||||
-rw-r--r-- | source/creator/creator.c | 2 |
4 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 22ddae88b28..7585dc23342 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -127,6 +127,7 @@ enum { G_DEBUG_DEPSGRAPH = (1 << 8), /* depsgraph messages */ G_DEBUG_SIMDATA = (1 << 9), /* sim debug data display */ G_DEBUG_GPU_MEM = (1 << 10), /* gpu memory in status bar */ + G_DEBUG_DEPSGRAPH_NO_THREADS = (1 << 11), /* sinle threaded depsgraph */ }; #define G_DEBUG_ALL (G_DEBUG | G_DEBUG_FFMPEG | G_DEBUG_PYTHON | G_DEBUG_EVENTS | G_DEBUG_WM | G_DEBUG_JOBS | \ diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index d3337f02f11..31ae672f318 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1579,6 +1579,9 @@ static void scene_update_objects(EvaluationContext *eval_ctx, Main *bmain, Scene #endif task_pool = BLI_task_pool_create(task_scheduler, &state); + if (G.debug & G_DEBUG_DEPSGRAPH_NO_THREADS) { + BLI_pool_set_num_threads(task_pool, 1); + } DAG_threaded_update_begin(scene, scene_update_object_add_task, task_pool); BLI_task_pool_work_and_wait(task_pool); diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cc b/source/blender/depsgraph/intern/depsgraph_eval.cc index 74fa003821a..17096931e57 100644 --- a/source/blender/depsgraph/intern/depsgraph_eval.cc +++ b/source/blender/depsgraph/intern/depsgraph_eval.cc @@ -325,6 +325,10 @@ void DEG_evaluate_on_refresh_ex(EvaluationContext *eval_ctx, TaskScheduler *task_scheduler = BLI_task_scheduler_get(); TaskPool *task_pool = BLI_task_pool_create(task_scheduler, &state); + if (G.debug & G_DEBUG_DEPSGRAPH_NO_THREADS) { + BLI_pool_set_num_threads(task_pool, 1); + } + calculate_pending_parents(graph, layers); /* Clear tags. */ diff --git a/source/creator/creator.c b/source/creator/creator.c index e2d7bda3a21..3ad804517fc 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -322,6 +322,7 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data) BLI_argsPrintArgDoc(ba, "--debug-jobs"); BLI_argsPrintArgDoc(ba, "--debug-python"); BLI_argsPrintArgDoc(ba, "--debug-depsgraph"); + BLI_argsPrintArgDoc(ba, "--debug-depsgraph-no-threads"); BLI_argsPrintArgDoc(ba, "--debug-wm"); BLI_argsPrintArgDoc(ba, "--debug-all"); @@ -1504,6 +1505,7 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle) BLI_argsAdd(ba, 1, NULL, "--debug-value", "<value>\n\tSet debug value of <value> on startup\n", set_debug_value, NULL); BLI_argsAdd(ba, 1, NULL, "--debug-jobs", "\n\tEnable time profiling for background jobs.", debug_mode_generic, (void *)G_DEBUG_JOBS); BLI_argsAdd(ba, 1, NULL, "--debug-depsgraph", "\n\tEnable debug messages from dependency graph", debug_mode_generic, (void *)G_DEBUG_DEPSGRAPH); + BLI_argsAdd(ba, 1, NULL, "--debug-depsgraph-no-threads", "\n\tSwitch dependency graph to a single threaded evlauation", debug_mode_generic, (void *)G_DEBUG_DEPSGRAPH_NO_THREADS); BLI_argsAdd(ba, 1, NULL, "--debug-gpumem", "\n\tEnable GPU memory stats in status bar", debug_mode_generic, (void *)G_DEBUG_GPU_MEM); BLI_argsAdd(ba, 1, NULL, "--enable-new-depsgraph", "\n\tUse new dependency graph", depsgraph_use_new, NULL); |