[Bf-blender-cvs] [eb6bab2] master: Add dedicated command argument to switch depsgraph to a single-threaded evaluation

Sergey Sharybin noreply at git.blender.org
Wed May 20 12:48:36 CEST 2015


Commit: eb6bab25ba9b71352769621b7e2f0a2df3dd0a4f
Author: Sergey Sharybin
Date:   Wed May 20 15:45:43 2015 +0500
Branches: master
https://developer.blender.org/rBeb6bab25ba9b71352769621b7e2f0a2df3dd0a4f

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

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

M	source/blender/blenkernel/BKE_global.h
M	source/blender/blenkernel/intern/scene.c
M	source/blender/depsgraph/intern/depsgraph_eval.cc
M	source/creator/creator.c

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

diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index 22ddae8..7585dc2 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 d3337f0..31ae672 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 74fa003..1709693 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 e2d7bda..3ad8045 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);




More information about the Bf-blender-cvs mailing list