[Bf-blender-cvs] [58d537a] depsgraph_refactor: Depsgraph: Remove simulation API

Sergey Sharybin noreply at git.blender.org
Wed Dec 3 14:08:16 CET 2014


Commit: 58d537a22f4d5d66d1359f7e25c77f095a08ca58
Author: Sergey Sharybin
Date:   Wed Dec 3 18:05:56 2014 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rB58d537a22f4d5d66d1359f7e25c77f095a08ca58

Depsgraph: Remove simulation API

It was only needed for the time being no callbacks were filled up,
and this API was only running dummy operations which i basically
sleep for random number of milliseconds.

Now we've got real callbacks and don't need simulation any more.

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

M	source/blender/depsgraph/DEG_depsgraph.h
M	source/blender/depsgraph/DEG_depsgraph_debug.h
M	source/blender/depsgraph/intern/depsgraph_debug.cpp
M	source/blender/depsgraph/intern/depsgraph_eval.cpp
M	source/blender/depsgraph/util/depsgraph_util_task.cpp
M	source/blender/makesrna/intern/rna_depsgraph.c

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

diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h
index d3041f9..987315a 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -70,7 +70,6 @@ extern "C" {
 typedef enum eDEG_EvalMode {
 	DEG_EVAL_MODE_OLD = 0, /* also works with any other debug_value, if not used below */
 	DEG_EVAL_MODE_NEW = 14228,
-	DEG_EVAL_MODE_SIM = 12345,
 } eDEG_EvalMode;
 
 eDEG_EvalMode DEG_get_eval_mode(void);
diff --git a/source/blender/depsgraph/DEG_depsgraph_debug.h b/source/blender/depsgraph/DEG_depsgraph_debug.h
index 45f14b9..33efe77 100644
--- a/source/blender/depsgraph/DEG_depsgraph_debug.h
+++ b/source/blender/depsgraph/DEG_depsgraph_debug.h
@@ -81,11 +81,6 @@ struct DepsgraphStatsID *DEG_stats_id(struct ID *id);
 
 void DEG_debug_graphviz(const struct Depsgraph *graph, FILE *stream, const char *label, bool show_eval);
 
-typedef void (*DEG_DebugEvalCb)(void *userdata, const char *message);
-
-void DEG_debug_eval_init(void *userdata, DEG_DebugEvalCb cb);
-void DEG_debug_eval_end(void);
-
 /* ************************************************ */
 
 #ifdef __cplusplus
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cpp b/source/blender/depsgraph/intern/depsgraph_debug.cpp
index cf61068..aedae9a 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_debug.cpp
@@ -698,34 +698,6 @@ void DEG_debug_graphviz(const Depsgraph *graph, FILE *f, const char *label, bool
 
 #undef NL
 
-#ifndef NDEBUG
-#define DEG_DEBUG_BUILD
-#endif
-
-#ifdef DEG_DEBUG_BUILD
-
-static void *deg_debug_eval_userdata;
-DEG_DebugEvalCb deg_debug_eval_cb;
-
-void DEG_debug_eval_init(void *userdata, DEG_DebugEvalCb cb)
-{
-	deg_debug_eval_userdata = userdata;
-	deg_debug_eval_cb = cb;
-}
-
-void DEG_debug_eval_end(void)
-{
-	deg_debug_eval_userdata = NULL;
-	deg_debug_eval_cb = NULL;
-}
-
-#else /* DEG_DEBUG_BUILD */
-
-void DEG_debug_eval_init(void *userdata, DEG_DebugEvalCb cb) {}
-void DEG_debug_eval_end(void) {}
-
-#endif /* DEG_DEBUG_BUILD */
-
 /* ************************************************ */
 
 static string get_component_name(eDepsNode_Type type, const string &name = "")
diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cpp b/source/blender/depsgraph/intern/depsgraph_eval.cpp
index 88dd744..9e4740b 100644
--- a/source/blender/depsgraph/intern/depsgraph_eval.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_eval.cpp
@@ -74,7 +74,6 @@ eDEG_EvalMode DEG_get_eval_mode(void)
 {
 	switch (G.debug_value) {
 		case DEG_EVAL_MODE_NEW: return DEG_EVAL_MODE_NEW;
-		case DEG_EVAL_MODE_SIM: return DEG_EVAL_MODE_SIM;
 		default: return DEG_EVAL_MODE_OLD;
 	}
 }
@@ -83,7 +82,6 @@ void DEG_set_eval_mode(eDEG_EvalMode mode)
 {
 	switch (mode) {
 		case DEG_EVAL_MODE_NEW: G.debug_value = DEG_EVAL_MODE_NEW;
-		case DEG_EVAL_MODE_SIM: G.debug_value = DEG_EVAL_MODE_SIM;
 		default: G.debug_value = DEG_EVAL_MODE_OLD;
 	}
 }
diff --git a/source/blender/depsgraph/util/depsgraph_util_task.cpp b/source/blender/depsgraph/util/depsgraph_util_task.cpp
index 612c445..883b9ef 100644
--- a/source/blender/depsgraph/util/depsgraph_util_task.cpp
+++ b/source/blender/depsgraph/util/depsgraph_util_task.cpp
@@ -74,21 +74,11 @@ void DEG_task_run_func(TaskPool *pool, void *taskdata, int UNUSED(threadid))
 	double start_time = PIL_check_seconds_timer();
 	DepsgraphDebug::task_started(node);
 
-	if (DEG_get_eval_mode() == DEG_EVAL_MODE_SIM) {
-		/* simulate work, but actually just take a nap here ... */
+	/* should only be the case for NOOPs, which never get to this point */
+	BLI_assert(node->evaluate);
 
-		int min = 20, max = 30; /* default siesta duration in milliseconds */
-
-		int r = BLI_rng_get_int(deg_eval_sim_rng);
-		int ms = (int)(min) + r % ((int)(max) - (int)(min));
-		PIL_sleep_ms(ms);
-	}
-	else {
-		/* should only be the case for NOOPs, which never get to this point */
-		BLI_assert(node->evaluate);
-		/* perform operation */
-		node->evaluate(state->eval_ctx);
-	}
+	/* perform operation */
+	node->evaluate(state->eval_ctx);
 
 	/* note how long this took */
 	double end_time = PIL_check_seconds_timer();
diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c
index c421653..6d6914a 100644
--- a/source/blender/makesrna/intern/rna_depsgraph.c
+++ b/source/blender/makesrna/intern/rna_depsgraph.c
@@ -53,49 +53,6 @@ static void rna_Depsgraph_debug_graphviz(Depsgraph *graph, const char *filename)
 	fclose(f);
 }
 
-typedef struct DepsgraphEvalDebugInfo {
-	const char *filename;
-	int step;
-	const Depsgraph *graph;
-} DepsgraphEvalDebugInfo;
-
-/* generic debug output function */
-static void rna_Depsgraph_debug_simulate_cb(DepsgraphEvalDebugInfo *info, const char *message)
-{
-	char filename[FILE_MAX];
-	FILE *f;
-	
-	BLI_snprintf(filename, sizeof(filename), "%s_%04d", info->filename, info->step);
-	f = fopen(filename, "w");
-	if (f == NULL)
-		return;
-	
-	DEG_debug_graphviz(info->graph, f, message, true);
-	
-	fclose(f);
-	
-	++info->step;
-}
-
-static void rna_Depsgraph_debug_simulate(Depsgraph *graph, const char *filename, int context_type)
-{
-	EvaluationContext eval_ctx;
-	DepsgraphEvalDebugInfo debug_info;
-	debug_info.filename = filename;
-	debug_info.step = 0;
-	debug_info.graph = graph;
-	
-	DEG_debug_eval_init(&debug_info,
-	                    (DEG_DebugEvalCb)rna_Depsgraph_debug_simulate_cb);
-	
-	DEG_graph_flush_updates(graph);
-
-	eval_ctx.mode = context_type;
-	DEG_evaluate_on_refresh(&eval_ctx, graph);
-	
-	DEG_debug_eval_end();
-}
-
 #else
 
 static void rna_def_depsgraph(BlenderRNA *brna)
@@ -103,14 +60,7 @@ static void rna_def_depsgraph(BlenderRNA *brna)
 	StructRNA *srna;
 	FunctionRNA *func;
 	PropertyRNA *parm;
-	
-	static EnumPropertyItem context_type_items[] = {
-		{DAG_EVAL_VIEWPORT, "VIEWPORT", 0, "Viewport", "Viewport Display"},
-		{DAG_EVAL_RENDER, "RENDER", 0, "Render", "Render Engine DB Conversion"},
-		{DAG_EVAL_PREVIEW, "PREVIEW", 0, "Preview", "Preview rendering"},
-		{0, NULL, 0, NULL, NULL}
-	};
-	
+
 	srna = RNA_def_struct(brna, "Depsgraph", NULL);
 	RNA_def_struct_ui_text(srna, "Dependency Graph", "");
 	
@@ -118,12 +68,6 @@ static void rna_def_depsgraph(BlenderRNA *brna)
 	parm = RNA_def_string_file_path(func, "filename", NULL, FILE_MAX, "File Name",
 	                                "File in which to store graphviz debug output");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	
-	func = RNA_def_function(srna, "debug_simulate", "rna_Depsgraph_debug_simulate");
-	parm = RNA_def_string_file_path(func, "filename", NULL, FILE_MAX, "File Name",
-	                                "File in which to store graphviz debug output");
-	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm = RNA_def_enum(func, "context_type", context_type_items, DAG_EVAL_VIEWPORT, "Context Type", "");
 }
 
 void RNA_def_depsgraph(BlenderRNA *brna)




More information about the Bf-blender-cvs mailing list