[Bf-blender-cvs] [a8eea18] depsgraph_refactor: Depsgraph: Move task callback to the depsgraph_eval file
Sergey Sharybin
noreply at git.blender.org
Thu Dec 18 16:34:43 CET 2014
Commit: a8eea18edfe497e42dbb5cb924f413da94f19d92
Author: Sergey Sharybin
Date: Thu Dec 18 20:33:25 2014 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rBa8eea18edfe497e42dbb5cb924f413da94f19d92
Depsgraph: Move task callback to the depsgraph_eval file
It's just more a hassle of having separate file and some public-ish
API to pass all the data around. Easier just have single file with
all evaluation.
===================================================================
M source/blender/depsgraph/CMakeLists.txt
M source/blender/depsgraph/intern/depsgraph_debug.cpp
M source/blender/depsgraph/intern/depsgraph_eval.cpp
M source/blender/depsgraph/intern/depsgraph_eval.h
D source/blender/depsgraph/util/depsgraph_util_task.cpp
D source/blender/depsgraph/util/depsgraph_util_task.h
===================================================================
diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt
index bd23b6c..a9d8774 100644
--- a/source/blender/depsgraph/CMakeLists.txt
+++ b/source/blender/depsgraph/CMakeLists.txt
@@ -79,8 +79,6 @@ set(SRC
util/depsgraph_util_id.h
util/depsgraph_util_map.h
util/depsgraph_util_set.h
- util/depsgraph_util_task.h
- util/depsgraph_util_task.cpp
)
TEST_UNORDERED_MAP_SUPPORT()
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cpp b/source/blender/depsgraph/intern/depsgraph_debug.cpp
index c9bafda..b7e1c52 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_debug.cpp
@@ -61,7 +61,6 @@ extern "C" {
#include "depsgraph_types.h"
#include "depsgraph_intern.h"
#include "depsgraph_queue.h"
-#include "depsgraph_util_task.h"
/* ************************************************ */
/* Graphviz Debugging */
diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cpp b/source/blender/depsgraph/intern/depsgraph_eval.cpp
index 738be88..36680e4 100644
--- a/source/blender/depsgraph/intern/depsgraph_eval.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_eval.cpp
@@ -26,36 +26,17 @@
* Evaluation engine entrypoints for Depsgraph Engine
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "MEM_guardedalloc.h"
+#include "PIL_time.h"
+
extern "C" {
-#include "BLI_blenlib.h"
-#include "BLI_string.h"
#include "BLI_task.h"
-#include "BLI_threads.h"
#include "BLI_utildefines.h"
-#include "DNA_anim_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-
-#include "BKE_action.h"
-#include "BKE_animsys.h"
-#include "BKE_constraint.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_main.h"
-#include "BKE_object.h"
-#include "BKE_scene.h"
-#include "BKE_global.h" /* XXX only for debug value, remove eventually */
+#include "DNA_ID.h"
-#include "DEG_depsgraph.h"
-
-#include "RNA_access.h"
-#include "RNA_types.h"
+#include "BKE_global.h" /* XXX only for debug value, remove eventually */
} /* extern "C" */
#include "atomic_ops.h"
@@ -89,6 +70,44 @@ void DEG_set_eval_mode(eDEG_EvalMode mode)
/* ********************** */
/* Evaluation Entrypoints */
+struct DepsgraphEvalState {
+ EvaluationContext *eval_ctx;
+ Depsgraph *graph;
+};
+
+static void deg_task_run_func(TaskPool *pool,
+ void *taskdata,
+ int UNUSED(threadid))
+{
+ DepsgraphEvalState *state = (DepsgraphEvalState *)BLI_task_pool_userdata(pool);
+ OperationDepsNode *node = (OperationDepsNode *)taskdata;
+ if (node->is_noop()) {
+ deg_schedule_children(pool, state->eval_ctx, state->graph, node);
+ return;
+ }
+
+ /* Get context. */
+ // TODO: who initialises this? "Init" operations aren't able to initialise it!!!
+ ComponentDepsNode *comp = node->owner;
+ BLI_assert(comp != NULL);
+
+ /* Take note of current time. */
+ double start_time = PIL_check_seconds_timer();
+ DepsgraphDebug::task_started(node);
+
+ /* Should only be the case for NOOPs, which never get to this point. */
+ BLI_assert(node->evaluate != NULL);
+
+ /* Perform operation. */
+ node->evaluate(state->eval_ctx);
+
+ /* Note how long this took. */
+ double end_time = PIL_check_seconds_timer();
+ DepsgraphDebug::task_completed(node, end_time - start_time);
+
+ deg_schedule_children(pool, state->eval_ctx, state->graph, node);
+}
+
static void calculate_pending_parents(Depsgraph *graph)
{
for (Depsgraph::OperationNodes::const_iterator it_op = graph->operations.begin();
@@ -156,7 +175,7 @@ static void schedule_graph(TaskPool *pool, EvaluationContext *eval_ctx, Depsgrap
{
OperationDepsNode *node = *it;
if ((node->flag & DEPSOP_FLAG_NEEDS_UPDATE) && node->num_links_pending == 0) {
- BLI_task_pool_push(pool, DEG_task_run_func, node, false, TASK_PRIORITY_LOW);
+ BLI_task_pool_push(pool, deg_task_run_func, node, false, TASK_PRIORITY_LOW);
node->scheduled = true;
}
}
@@ -185,14 +204,13 @@ void deg_schedule_children(TaskPool *pool, EvaluationContext *eval_ctx,
BLI_spin_unlock(&graph->lock);
if (need_schedule) {
- BLI_task_pool_push(pool, DEG_task_run_func, child, false, TASK_PRIORITY_LOW);
+ BLI_task_pool_push(pool, deg_task_run_func, child, false, TASK_PRIORITY_LOW);
}
}
}
}
}
-
/* Evaluate all nodes tagged for updating,
* ! This is usually done as part of main loop, but may also be
* called from frame-change update.
diff --git a/source/blender/depsgraph/intern/depsgraph_eval.h b/source/blender/depsgraph/intern/depsgraph_eval.h
index ad5b733..8223b89 100644
--- a/source/blender/depsgraph/intern/depsgraph_eval.h
+++ b/source/blender/depsgraph/intern/depsgraph_eval.h
@@ -35,8 +35,6 @@
#include "DEG_depsgraph.h"
-#include "depsgraph_util_task.h"
-
struct Depsgraph;
struct OperationDepsNode;
@@ -136,7 +134,7 @@ typedef struct DEG_PoseContext {
struct Depsgraph;
struct OperationDepsNode;
-struct Taskpool;
+struct TaskPool;
void deg_schedule_children(TaskPool *pool, EvaluationContext *eval_ctx, Depsgraph *graph, OperationDepsNode *node);
#endif // __DEPSGRAPH_EVAL_TYPES_H__
diff --git a/source/blender/depsgraph/util/depsgraph_util_task.cpp b/source/blender/depsgraph/util/depsgraph_util_task.cpp
deleted file mode 100644
index 39e6d88..0000000
--- a/source/blender/depsgraph/util/depsgraph_util_task.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Brecht van Lommel
- * Contributor(s): Lukas Toenne
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include "BLI_utildefines.h"
-#include "BLI_compiler_attrs.h"
-#include "PIL_time.h"
-
-extern "C" {
-#include "BLI_task.h"
-}
-
-#include "depsgraph_debug.h"
-#include "depsgraph_eval.h"
-
-#include "depsgraph_util_task.h"
-
-/* Task */
-
-void DEG_task_run_func(TaskPool *pool, void *taskdata, int UNUSED(threadid))
-{
- DepsgraphEvalState *state = (DepsgraphEvalState *)BLI_task_pool_userdata(pool);
- OperationDepsNode *node = (OperationDepsNode *)taskdata;
- if (node->is_noop()) {
- deg_schedule_children(pool, state->eval_ctx, state->graph, node);
- return;
- }
-
- /* get context */
- // TODO: who initialises this? "Init" operations aren't able to initialise it!!!
- ComponentDepsNode *comp = node->owner;
- BLI_assert(comp != NULL);
-
- /* take note of current time */
- double start_time = PIL_check_seconds_timer();
- DepsgraphDebug::task_started(node);
-
- /* should only be the case for NOOPs, which never get to this point */
- BLI_assert(node->evaluate);
-
- /* perform operation */
- node->evaluate(state->eval_ctx);
-
- /* note how long this took */
- double end_time = PIL_check_seconds_timer();
- DepsgraphDebug::task_completed(node, end_time - start_time);
-
- deg_schedule_children(pool, state->eval_ctx, state->graph, node);
-}
diff --git a/source/blender/depsgraph/util/depsgraph_util_task.h b/source/blender/depsgraph/util/depsgraph_util_task.h
deleted file mode 100644
index 858adc1..0000000
--- a/source/blender/depsgraph/util/depsgraph_util_task.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Brecht van Lommel
- * Contributor(s): Lukas Toenne
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#ifndef __DEPSGRAPH_UTIL_TASK_H__
-#define __DEPSGRAPH_UTIL_TASK_H__
-
-#include "depsnode_operation.h"
-
-struct Depsgraph;
-struct EvaluationContext;
-struct TaskPool;
-
-struct DepsgraphEvalState {
- EvaluationContext *eval_ctx;
- Depsgraph *graph;
-};
-
-void DEG_task_run_func(TaskPool *pool, void *taskdata, int threadid);
-
-#endif /* __DEPSGRAPH_UTIL_TASK_H__ */
More information about the Bf-blender-cvs
mailing list