Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/depsgraph/intern/eval')
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval.cc78
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc87
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h8
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_flush.cc83
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_stats.cc25
5 files changed, 123 insertions, 158 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc
index 02d286c3bd1..0425407d1cd 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval.cc
@@ -38,6 +38,8 @@
#include "BLI_task.h"
#include "BLI_ghash.h"
+#include "BKE_global.h"
+
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -49,15 +51,12 @@
#include "intern/eval/deg_eval_copy_on_write.h"
#include "intern/eval/deg_eval_flush.h"
#include "intern/eval/deg_eval_stats.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_operation.h"
-#include "intern/nodes/deg_node_time.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
+#include "intern/node/deg_node_time.h"
#include "intern/depsgraph.h"
-#include "intern/depsgraph_intern.h"
-
-#include "util/deg_util_foreach.h"
namespace DEG {
@@ -67,7 +66,7 @@ namespace DEG {
/* Forward declarations. */
static void schedule_children(TaskPool *pool,
Depsgraph *graph,
- OperationDepsNode *node,
+ OperationNode *node,
const int thread_id);
struct DepsgraphEvalState {
@@ -82,7 +81,7 @@ static void deg_task_run_func(TaskPool *pool,
{
void *userdata_v = BLI_task_pool_userdata(pool);
DepsgraphEvalState *state = (DepsgraphEvalState *)userdata_v;
- OperationDepsNode *node = (OperationDepsNode *)taskdata;
+ OperationNode *node = (OperationNode *)taskdata;
/* Sanity checks. */
BLI_assert(!node->is_noop() && "NOOP nodes should not actually be scheduled");
/* Perform operation. */
@@ -104,13 +103,12 @@ typedef struct CalculatePendingData {
Depsgraph *graph;
} CalculatePendingData;
-static bool check_operation_node_visible(OperationDepsNode *op_node)
+static bool check_operation_node_visible(OperationNode *op_node)
{
- const ComponentDepsNode *comp_node = op_node->owner;
+ const ComponentNode *comp_node = op_node->owner;
/* Special exception, copy on write component is to be always evaluated,
- * to keep copied "database" in a consistent state.
- */
- if (comp_node->type == DEG_NODE_TYPE_COPY_ON_WRITE) {
+ * to keep copied "database" in a consistent state. */
+ if (comp_node->type == NodeType::COPY_ON_WRITE) {
return true;
}
return comp_node->affects_directly_visible;
@@ -123,7 +121,7 @@ static void calculate_pending_func(
{
CalculatePendingData *data = (CalculatePendingData *)data_v;
Depsgraph *graph = data->graph;
- OperationDepsNode *node = graph->operations[i];
+ OperationNode *node = graph->operations[i];
/* Update counters, applies for both visible and invisible IDs. */
node->num_links_pending = 0;
node->scheduled = false;
@@ -135,16 +133,15 @@ static void calculate_pending_func(
if ((node->flag & DEPSOP_FLAG_NEEDS_UPDATE) == 0) {
return;
}
- foreach (DepsRelation *rel, node->inlinks) {
- if (rel->from->type == DEG_NODE_TYPE_OPERATION &&
- (rel->flag & DEPSREL_FLAG_CYCLIC) == 0)
+ for (Relation *rel : node->inlinks) {
+ if (rel->from->type == NodeType::OPERATION &&
+ (rel->flag & RELATION_FLAG_CYCLIC) == 0)
{
- OperationDepsNode *from = (OperationDepsNode *)rel->from;
+ OperationNode *from = (OperationNode *)rel->from;
/* TODO(sergey): This is how old layer system was checking for the
* calculation, but how is it possible that visible object depends
* on an invisible? This is something what is prohibited after
- * deg_graph_build_flush_layers().
- */
+ * deg_graph_build_flush_layers(). */
if (!check_operation_node_visible(from)) {
continue;
}
@@ -177,7 +174,7 @@ static void initialize_execution(DepsgraphEvalState *state, Depsgraph *graph)
const bool do_stats = state->do_stats;
calculate_pending_parents(graph);
/* Clear tags and other things which needs to be clear. */
- foreach (OperationDepsNode *node, graph->operations) {
+ for (OperationNode *node : graph->operations) {
if (do_stats) {
node->stats.reset_current();
}
@@ -189,7 +186,7 @@ static void initialize_execution(DepsgraphEvalState *state, Depsgraph *graph)
* scheduled after a task has been completed.
*/
static void schedule_node(TaskPool *pool, Depsgraph *graph,
- OperationDepsNode *node, bool dec_parents,
+ OperationNode *node, bool dec_parents,
const int thread_id)
{
/* No need to schedule nodes of invisible ID. */
@@ -197,33 +194,30 @@ static void schedule_node(TaskPool *pool, Depsgraph *graph,
return;
}
/* No need to schedule operations which are not tagged for update, they are
- * considered to be up to date.
- */
+ * considered to be up to date. */
if ((node->flag & DEPSOP_FLAG_NEEDS_UPDATE) == 0) {
return;
}
/* TODO(sergey): This is not strictly speaking safe to read
- * num_links_pending.
- */
+ * num_links_pending. */
if (dec_parents) {
BLI_assert(node->num_links_pending > 0);
atomic_sub_and_fetch_uint32(&node->num_links_pending, 1);
}
/* Cal not schedule operation while its dependencies are not yet
- * evaluated.
- */
+ * evaluated. */
if (node->num_links_pending != 0) {
return;
}
/* During the COW stage only schedule COW nodes. */
DepsgraphEvalState *state = (DepsgraphEvalState *)BLI_task_pool_userdata(pool);
if (state->is_cow_stage) {
- if (node->owner->type != DEG_NODE_TYPE_COPY_ON_WRITE) {
+ if (node->owner->type != NodeType::COPY_ON_WRITE) {
return;
}
}
else {
- BLI_assert(node->scheduled || node->owner->type != DEG_NODE_TYPE_COPY_ON_WRITE);
+ BLI_assert(node->scheduled || node->owner->type != NodeType::COPY_ON_WRITE);
}
/* Actually schedule the node. */
bool is_scheduled = atomic_fetch_and_or_uint8(
@@ -247,19 +241,19 @@ static void schedule_node(TaskPool *pool, Depsgraph *graph,
static void schedule_graph(TaskPool *pool, Depsgraph *graph)
{
- foreach (OperationDepsNode *node, graph->operations) {
+ for (OperationNode *node : graph->operations) {
schedule_node(pool, graph, node, false, 0);
}
}
static void schedule_children(TaskPool *pool,
Depsgraph *graph,
- OperationDepsNode *node,
+ OperationNode *node,
const int thread_id)
{
- foreach (DepsRelation *rel, node->outlinks) {
- OperationDepsNode *child = (OperationDepsNode *)rel->to;
- BLI_assert(child->type == DEG_NODE_TYPE_OPERATION);
+ for (Relation *rel : node->outlinks) {
+ OperationNode *child = (OperationNode *)rel->to;
+ BLI_assert(child->type == NodeType::OPERATION);
if (child->scheduled) {
/* Happens when having cyclic dependencies. */
continue;
@@ -267,7 +261,7 @@ static void schedule_children(TaskPool *pool,
schedule_node(pool,
graph,
child,
- (rel->flag & DEPSREL_FLAG_CYCLIC) == 0,
+ (rel->flag & RELATION_FLAG_CYCLIC) == 0,
thread_id);
}
}
@@ -277,13 +271,12 @@ static void depsgraph_ensure_view_layer(Depsgraph *graph)
/* We update copy-on-write scene in the following cases:
* - It was not expanded yet.
* - It was tagged for update of CoW component.
- * This allows us to have proper view layer pointer.
- */
+ * This allows us to have proper view layer pointer. */
Scene *scene_cow = graph->scene_cow;
if (!deg_copy_on_write_is_expanded(&scene_cow->id) ||
scene_cow->id.recalc & ID_RECALC_COPY_ON_WRITE)
{
- const IDDepsNode *id_node = graph->find_id_node(&graph->scene->id);
+ const IDNode *id_node = graph->find_id_node(&graph->scene->id);
deg_update_copy_on_write_datablock(graph, id_node);
}
}
@@ -335,8 +328,7 @@ void deg_evaluate_on_refresh(Depsgraph *graph)
BLI_task_pool_free(task_pool);
/* Finalize statistics gathering. This is because we only gather single
* operation timing here, without aggregating anything to avoid any extra
- * synchronization.
- */
+ * synchronization. */
if (state.do_stats) {
deg_eval_stats_aggregate(graph);
}
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index aa028629093..47affdd1bf9 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -95,8 +95,8 @@ extern "C" {
#include "intern/depsgraph.h"
#include "intern/builder/deg_builder_nodes.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_id.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_id.h"
namespace DEG {
@@ -446,8 +446,7 @@ struct RemapCallbackUserData {
/* Create placeholder for ID nodes for cases when we need to remap original
* ID to it[s CoW version but we don't have required ID node yet.
*
- * This happens when expansion happens a ta construction time.
- */
+ * This happens when expansion happens a ta construction time. */
DepsgraphNodeBuilder *node_builder;
bool create_placeholders;
};
@@ -472,12 +471,11 @@ int foreach_libblock_remap_callback(void *user_data_v,
*
* TODO(sergey): Ideally we need to tell ID looper to ignore
* those or at least make it more reliable check where the
- * pointer is coming from.
- */
+ * pointer is coming from. */
const ID_Type id_type = GS(id_orig->name);
const ID_Type id_type_self = GS(id_self->name);
if (id_type == ID_OB && id_type_self == ID_SCE) {
- IDDepsNode *id_node = depsgraph->find_id_node(id_orig);
+ IDNode *id_node = depsgraph->find_id_node(id_orig);
if (id_node == NULL) {
id_cow = id_orig;
}
@@ -541,8 +539,7 @@ void update_mesh_edit_mode_pointers(const Depsgraph *depsgraph,
*
* This is kind of confusing, because actual bmesh is not owned by
* the CoW object, so need to be accurate about using link from
- * edit_btmesh to object.
- */
+ * edit_btmesh to object. */
const Mesh *mesh_orig = (const Mesh *)id_orig;
Mesh *mesh_cow = (Mesh *)id_cow;
if (mesh_orig->edit_btmesh == NULL) {
@@ -621,8 +618,7 @@ void update_special_pointers(const Depsgraph *depsgraph,
case ID_OB:
{
/* Ensure we don't drag someone's else derived mesh to the
- * new copy of the object.
- */
+ * new copy of the object. */
Object *object_cow = (Object *)id_cow;
const Object *object_orig = (const Object *)id_orig;
object_cow->mode = object_orig->mode;
@@ -683,7 +679,7 @@ int foreach_libblock_validate_callback(void *user_data,
* NOTE: Expects that CoW datablock is empty.
*/
ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
- const IDDepsNode *id_node,
+ const IDNode *id_node,
DepsgraphNodeBuilder *node_builder,
bool create_placeholders)
{
@@ -691,8 +687,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
ID *id_cow = id_node->id_cow;
const int id_cow_recalc = id_cow->recalc;
/* No need to expand such datablocks, their copied ID is same as original
- * one already.
- */
+ * one already. */
if (!deg_copy_on_write_is_needed(id_orig)) {
return id_cow;
}
@@ -700,29 +695,25 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
id_orig->name, id_orig, id_cow);
/* Sanity checks. */
/* NOTE: Disabled for now, conflicts when re-using evaluated datablock when
- * rebuilding dependencies.
- */
+ * rebuilding dependencies. */
if (check_datablock_expanded(id_cow) && create_placeholders) {
deg_free_copy_on_write_datablock(id_cow);
}
// BLI_assert(check_datablock_expanded(id_cow) == false);
/* Copy data from original ID to a copied version. */
/* TODO(sergey): Avoid doing full ID copy somehow, make Mesh to reference
- * original geometry arrays for until those are modified.
- */
+ * original geometry arrays for until those are modified. */
/* TODO(sergey): We do some trickery with temp bmain and extra ID pointer
* just to be able to use existing API. Ideally we need to replace this with
* in-place copy from existing datablock to a prepared memory.
*
* NOTE: We don't use BKE_main_{new,free} because:
* - We don't want heap-allocations here.
- * - We don't want bmain's content to be freed when main is freed.
- */
+ * - We don't want bmain's content to be freed when main is freed. */
bool done = false;
/* First we handle special cases which are not covered by id_copy() yet.
* or cases where we want to do something smarter than simple datablock
- * copy.
- */
+ * copy. */
const ID_Type id_type = GS(id_orig->name);
switch (id_type) {
case ID_SCE:
@@ -736,8 +727,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
case ID_ME:
{
/* TODO(sergey): Ideally we want to handle meshes in a special
- * manner here to avoid initial copy of all the geometry arrays.
- */
+ * manner here to avoid initial copy of all the geometry arrays. */
break;
}
default:
@@ -757,8 +747,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
ntree_hack_remap_pointers(depsgraph, id_cow);
#endif
/* Do it now, so remapping will understand that possibly remapped self ID
- * is not to be remapped again.
- */
+ * is not to be remapped again. */
deg_tag_copy_on_write_id(id_cow, id_orig);
/* Perform remapping of the nodes. */
RemapCallbackUserData user_data = {NULL};
@@ -771,8 +760,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
(void *)&user_data,
IDWALK_NOP);
/* Correct or tweak some pointers which are not taken care by foreach
- * from above.
- */
+ * from above. */
update_special_pointers(depsgraph, id_orig, id_cow);
id_cow->recalc = id_orig->recalc | id_cow_recalc;
return id_cow;
@@ -784,7 +772,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
DepsgraphNodeBuilder *node_builder,
bool create_placeholders)
{
- DEG::IDDepsNode *id_node = depsgraph->find_id_node(id_orig);
+ DEG::IDNode *id_node = depsgraph->find_id_node(id_orig);
BLI_assert(id_node != NULL);
return deg_expand_copy_on_write_datablock(depsgraph,
id_node,
@@ -793,7 +781,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
}
static void deg_update_copy_on_write_animation(const Depsgraph *depsgraph,
- const IDDepsNode *id_node)
+ const IDNode *id_node)
{
DEG_debug_print_eval((::Depsgraph *)depsgraph,
__func__,
@@ -829,8 +817,7 @@ static void deg_backup_object_runtime(
BKE_object_runtime_reset(object);
/* Object update will override actual object->data to an evaluated version.
* Need to make sure we don't have data set to evaluated one before free
- * anything.
- */
+ * anything. */
if (mesh_eval != NULL && object->data == mesh_eval) {
object->data = object->runtime.mesh_orig;
}
@@ -853,8 +840,7 @@ static void deg_restore_object_runtime(
* have any "persistent" pointers to point to an invalid data.
*
* We restore object's data datablock to an original copy of
- * that datablock.
- */
+ * that datablock. */
object->data = mesh_orig;
/* After that, immediately free the invalidated caches. */
@@ -863,13 +849,11 @@ static void deg_restore_object_runtime(
else {
Mesh *mesh_eval = object->runtime.mesh_eval;
/* Do same thing as object update: override actual object data
- * pointer with evaluated datablock.
- */
+ * pointer with evaluated datablock. */
object->data = mesh_eval;
/* Evaluated mesh simply copied edit_btmesh pointer from
* original mesh during update, need to make sure no dead
- * pointers are left behind.
- */
+ * pointers are left behind. */
mesh_eval->edit_btmesh = mesh_orig->edit_btmesh;
}
}
@@ -878,7 +862,7 @@ static void deg_restore_object_runtime(
}
ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
- const IDDepsNode *id_node)
+ const IDNode *id_node)
{
const ID *id_orig = id_node->id_orig;
const ID_Type id_type = GS(id_orig->name);
@@ -892,15 +876,12 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
* - Perform full datablock copy.
*
* Note that we never free GPU materials from here since that's not
- * safe for threading and GPU materials are likely to be re-used.
- */
+ * safe for threading and GPU materials are likely to be re-used. */
/* TODO(sergey): Either move this to an utility function or redesign
* Copy-on-Write components in a way that only needed parts are being
- * copied over.
- */
+ * copied over. */
/* TODO(sergey): Wrap GPU material backup and object runtime backup to a
- * generic backup structure.
- */
+ * generic backup structure. */
ListBase gpumaterial_backup;
ListBase *gpumaterial_ptr = NULL;
DrawDataList drawdata_backup;
@@ -928,8 +909,7 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
*
* These flags CURRENTLY don't need full datablock update,
* everything is done by node tree update function which
- * only copies socket values.
- */
+ * only copies socket values. */
const int ignore_flag = (ID_RECALC_SHADING |
ID_RECALC_ANIMATION |
ID_RECALC_COPY_ON_WRITE);
@@ -978,7 +958,7 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
ID *id_orig)
{
- DEG::IDDepsNode *id_node = depsgraph->find_id_node(id_orig);
+ DEG::IDNode *id_node = depsgraph->find_id_node(id_orig);
BLI_assert(id_node != NULL);
return deg_update_copy_on_write_datablock(depsgraph, id_node);
}
@@ -1071,8 +1051,7 @@ void deg_free_copy_on_write_datablock(ID *id_cow)
{
if (!check_datablock_expanded(id_cow)) {
/* Actual content was never copied on top of CoW block, we have
- * nothing to free.
- */
+ * nothing to free. */
return;
}
const ID_Type type = GS(id_cow->name);
@@ -1084,8 +1063,7 @@ void deg_free_copy_on_write_datablock(ID *id_cow)
{
/* TODO(sergey): This workaround is only to prevent free derived
* caches from modifying object->data. This is currently happening
- * due to mesh/curve datablock boundbox tagging dirty.
- */
+ * due to mesh/curve datablock boundbox tagging dirty. */
Object *ob_cow = (Object *)id_cow;
ob_cow->data = NULL;
ob_cow->sculpt = NULL;
@@ -1102,14 +1080,13 @@ void deg_free_copy_on_write_datablock(ID *id_cow)
}
void deg_evaluate_copy_on_write(struct ::Depsgraph *graph,
- const IDDepsNode *id_node)
+ const IDNode *id_node)
{
const DEG::Depsgraph *depsgraph = reinterpret_cast<const DEG::Depsgraph *>(graph);
DEG_debug_print_eval(graph, __func__, id_node->id_orig->name, id_node->id_cow);
if (id_node->id_orig == &depsgraph->scene->id) {
/* NOTE: This is handled by eval_ctx setup routines, which
- * ensures scene and view layer pointers are valid.
- */
+ * ensures scene and view layer pointers are valid. */
return;
}
deg_update_copy_on_write_datablock(depsgraph, id_node);
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h
index e9f5bc1e918..c1124f01f7f 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h
@@ -52,13 +52,13 @@ namespace DEG {
struct Depsgraph;
struct DepsgraphNodeBuilder;
-struct IDDepsNode;
+struct IDNode;
/* Get fully expanded (ready for use) copy-on-write datablock for the given
* original datablock.
*/
ID *deg_expand_copy_on_write_datablock(const struct Depsgraph *depsgraph,
- const IDDepsNode *id_node,
+ const IDNode *id_node,
DepsgraphNodeBuilder *node_builder = NULL,
bool create_placeholders = false);
ID *deg_expand_copy_on_write_datablock(const struct Depsgraph *depsgraph,
@@ -70,7 +70,7 @@ ID *deg_expand_copy_on_write_datablock(const struct Depsgraph *depsgraph,
* datablock.
*/
ID *deg_update_copy_on_write_datablock(const struct Depsgraph *depsgraph,
- const IDDepsNode *id_node);
+ const IDNode *id_node);
ID *deg_update_copy_on_write_datablock(const struct Depsgraph *depsgraph,
struct ID *id_orig);
@@ -81,7 +81,7 @@ void deg_free_copy_on_write_datablock(struct ID *id_cow);
* datablock is ready for use by further evaluation routines.
*/
void deg_evaluate_copy_on_write(struct ::Depsgraph *depsgraph,
- const struct IDDepsNode *id_node);
+ const struct IDNode *id_node);
/* Check that given ID is properly expanded and does not have any shallow
* copies inside.
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index 5373c142ba6..a7071e14c38 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -52,14 +52,16 @@ extern "C" {
#include "DEG_depsgraph.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_operation.h"
+#include "intern/debug/deg_debug.h"
+#include "intern/depsgraph.h"
+#include "intern/depsgraph_update.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_factory.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
-#include "intern/depsgraph_intern.h"
#include "intern/eval/deg_eval_copy_on_write.h"
-#include "util/deg_util_foreach.h"
// Invalidate datablock data when update is flushed on it.
//
@@ -85,7 +87,7 @@ enum {
COMPONENT_STATE_DONE = 2,
};
-typedef std::deque<OperationDepsNode *> FlushQueue;
+typedef std::deque<OperationNode *> FlushQueue;
namespace {
@@ -95,7 +97,7 @@ void flush_init_operation_node_func(
const ParallelRangeTLS *__restrict /*tls*/)
{
Depsgraph *graph = (Depsgraph *)data_v;
- OperationDepsNode *node = graph->operations[i];
+ OperationNode *node = graph->operations[i];
node->scheduled = false;
}
@@ -105,9 +107,9 @@ void flush_init_id_node_func(
const ParallelRangeTLS *__restrict /*tls*/)
{
Depsgraph *graph = (Depsgraph *)data_v;
- IDDepsNode *id_node = graph->id_nodes[i];
+ IDNode *id_node = graph->id_nodes[i];
id_node->custom_flags = ID_STATE_NONE;
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
comp_node->custom_flags = COMPONENT_STATE_NONE;
GHASH_FOREACH_END();
}
@@ -138,7 +140,7 @@ BLI_INLINE void flush_prepare(Depsgraph *graph)
BLI_INLINE void flush_schedule_entrypoints(Depsgraph *graph, FlushQueue *queue)
{
- GSET_FOREACH_BEGIN(OperationDepsNode *, op_node, graph->entry_tags)
+ GSET_FOREACH_BEGIN(OperationNode *, op_node, graph->entry_tags)
{
queue->push_back(op_node);
op_node->scheduled = true;
@@ -149,14 +151,14 @@ BLI_INLINE void flush_schedule_entrypoints(Depsgraph *graph, FlushQueue *queue)
GSET_FOREACH_END();
}
-BLI_INLINE void flush_handle_id_node(IDDepsNode *id_node)
+BLI_INLINE void flush_handle_id_node(IDNode *id_node)
{
id_node->custom_flags = ID_STATE_MODIFIED;
}
/* TODO(sergey): We can reduce number of arguments here. */
-BLI_INLINE void flush_handle_component_node(IDDepsNode *id_node,
- ComponentDepsNode *comp_node,
+BLI_INLINE void flush_handle_component_node(IDNode *id_node,
+ ComponentNode *comp_node,
FlushQueue *queue)
{
/* We only handle component once. */
@@ -168,19 +170,18 @@ BLI_INLINE void flush_handle_component_node(IDDepsNode *id_node,
* special component where we don't want all operations to be tagged.
*
* TODO(sergey): Make this a more generic solution. */
- if (comp_node->type != DEG_NODE_TYPE_PARTICLE_SETTINGS &&
- comp_node->type != DEG_NODE_TYPE_PARTICLE_SYSTEM)
+ if (comp_node->type != NodeType::PARTICLE_SETTINGS &&
+ comp_node->type != NodeType::PARTICLE_SYSTEM)
{
- foreach (OperationDepsNode *op, comp_node->operations) {
+ for (OperationNode *op : comp_node->operations) {
op->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
}
}
/* when some target changes bone, we might need to re-run the
- * whole IK solver, otherwise result might be unpredictable.
- */
- if (comp_node->type == DEG_NODE_TYPE_BONE) {
- ComponentDepsNode *pose_comp =
- id_node->find_component(DEG_NODE_TYPE_EVAL_POSE);
+ * whole IK solver, otherwise result might be unpredictable. */
+ if (comp_node->type == NodeType::BONE) {
+ ComponentNode *pose_comp =
+ id_node->find_component(NodeType::EVAL_POSE);
BLI_assert(pose_comp != NULL);
if (pose_comp->custom_flags == COMPONENT_STATE_NONE) {
queue->push_front(pose_comp->get_entry_operation());
@@ -195,24 +196,24 @@ BLI_INLINE void flush_handle_component_node(IDDepsNode *id_node,
* return value, so it can start being handled right away, without building too
* much of a queue.
*/
-BLI_INLINE OperationDepsNode *flush_schedule_children(
- OperationDepsNode *op_node,
+BLI_INLINE OperationNode *flush_schedule_children(
+ OperationNode *op_node,
FlushQueue *queue)
{
- OperationDepsNode *result = NULL;
- foreach (DepsRelation *rel, op_node->outlinks) {
+ OperationNode *result = NULL;
+ for (Relation *rel : op_node->outlinks) {
/* Flush is forbidden, completely. */
- if (rel->flag & DEPSREL_FLAG_NO_FLUSH) {
+ if (rel->flag & RELATION_FLAG_NO_FLUSH) {
continue;
}
/* Relation only allows flushes on user changes, but the node was not
* affected by user. */
- if ((rel->flag & DEPSREL_FLAG_FLUSH_USER_EDIT_ONLY) &&
+ if ((rel->flag & RELATION_FLAG_FLUSH_USER_EDIT_ONLY) &&
(op_node->flag & DEPSOP_FLAG_USER_MODIFIED) == 0)
{
continue;
}
- OperationDepsNode *to_node = (OperationDepsNode *)rel->to;
+ OperationNode *to_node = (OperationNode *)rel->to;
/* Always flush flushable flags, so children always know what happened
* to their parents. */
to_node->flag |= (op_node->flag & DEPSOP_FLAG_FLUSH);
@@ -247,7 +248,7 @@ void flush_editors_id_update(Main *bmain,
Depsgraph *graph,
const DEGEditorUpdateContext *update_ctx)
{
- foreach (IDDepsNode *id_node, graph->id_nodes) {
+ for (IDNode *id_node : graph->id_nodes) {
if (id_node->custom_flags != ID_STATE_MODIFIED) {
continue;
}
@@ -257,16 +258,15 @@ void flush_editors_id_update(Main *bmain,
ID *id_cow = id_node->id_cow;
/* Copy tag from original data to CoW storage.
* This is because DEG_id_tag_update() sets tags on original
- * data.
- */
+ * data. */
id_cow->recalc |= (id_orig->recalc & ID_RECALC_ALL);
/* Gather recalc flags from all changed components. */
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
{
if (comp_node->custom_flags != COMPONENT_STATE_DONE) {
continue;
}
- DepsNodeFactory *factory = deg_type_get_factory(comp_node->type);
+ DepsNodeFactory *factory = type_get_factory(comp_node->type);
BLI_assert(factory != NULL);
id_cow->recalc |= factory->id_recalc_tag();
}
@@ -330,7 +330,7 @@ void invalidate_tagged_evaluated_geometry(ID *id)
void invalidate_tagged_evaluated_data(Depsgraph *graph)
{
#ifdef INVALIDATE_ON_FLUSH
- foreach (IDDepsNode *id_node, graph->id_nodes) {
+ for (IDNode *id_node : graph->id_nodes) {
if (id_node->custom_flags != ID_STATE_MODIFIED) {
continue;
}
@@ -338,7 +338,7 @@ void invalidate_tagged_evaluated_data(Depsgraph *graph)
if (!deg_copy_on_write_is_expanded(id_cow)) {
continue;
}
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
{
if (comp_node->custom_flags != COMPONENT_STATE_DONE) {
continue;
@@ -388,14 +388,14 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
update_ctx.view_layer = graph->view_layer;
/* Do actual flush. */
while (!queue.empty()) {
- OperationDepsNode *op_node = queue.front();
+ OperationNode *op_node = queue.front();
queue.pop_front();
while (op_node != NULL) {
/* Tag operation as required for update. */
op_node->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
/* Inform corresponding ID and component nodes about the change. */
- ComponentDepsNode *comp_node = op_node->owner;
- IDDepsNode *id_node = comp_node->owner;
+ ComponentNode *comp_node = op_node->owner;
+ IDNode *id_node = comp_node->owner;
flush_handle_id_node(id_node);
flush_handle_component_node(id_node,
comp_node,
@@ -407,8 +407,7 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
/* Inform editors about all changes. */
flush_editors_id_update(bmain, graph, &update_ctx);
/* Reset evaluation result tagged which is tagged for update to some state
- * which is obvious to catch.
- */
+ * which is obvious to catch. */
invalidate_tagged_evaluated_data(graph);
}
@@ -418,7 +417,7 @@ static void graph_clear_operation_func(
const ParallelRangeTLS *__restrict /*tls*/)
{
Depsgraph *graph = (Depsgraph *)data_v;
- OperationDepsNode *node = graph->operations[i];
+ OperationNode *node = graph->operations[i];
/* Clear node's "pending update" settings. */
node->flag &= ~(DEPSOP_FLAG_DIRECTLY_MODIFIED |
DEPSOP_FLAG_NEEDS_UPDATE |
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_stats.cc b/source/blender/depsgraph/intern/eval/deg_eval_stats.cc
index 52ce744cc0a..4dae608bae8 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_stats.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_stats.cc
@@ -35,23 +35,20 @@
#include "intern/depsgraph.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_operation.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
namespace DEG {
void deg_eval_stats_aggregate(Depsgraph *graph)
{
/* Reset current evaluation stats for ID and component nodes.
- * Those are not filled in by the evaluation engine.
- */
- foreach (DepsNode *node, graph->id_nodes) {
- IDDepsNode *id_node = (IDDepsNode *)node;
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ * Those are not filled in by the evaluation engine. */
+ for (Node *node : graph->id_nodes) {
+ IDNode *id_node = (IDNode *)node;
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
{
comp_node->stats.reset_current();
}
@@ -59,9 +56,9 @@ void deg_eval_stats_aggregate(Depsgraph *graph)
id_node->stats.reset_current();
}
/* Now accumulate operation timings to components and IDs. */
- foreach (OperationDepsNode *op_node, graph->operations) {
- ComponentDepsNode *comp_node = op_node->owner;
- IDDepsNode *id_node = comp_node->owner;
+ for (OperationNode *op_node : graph->operations) {
+ ComponentNode *comp_node = op_node->owner;
+ IDNode *id_node = comp_node->owner;
id_node->stats.current_time += op_node->stats.current_time;
comp_node->stats.current_time += op_node->stats.current_time;
}