Depsgraph: Replace iteration over ghash with iteration over flat array
This commit is contained in:
@@ -125,8 +125,7 @@ void deg_graph_build_finalize(Depsgraph *graph)
|
||||
* to do it ahead of a time and don't spend time on flushing updates on
|
||||
* every frame change.
|
||||
*/
|
||||
GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, graph->id_hash)
|
||||
{
|
||||
foreach (IDDepsNode *id_node, graph->id_nodes) {
|
||||
if (id_node->layers == 0) {
|
||||
ID *id = id_node->id;
|
||||
if (GS(id->name) == ID_OB) {
|
||||
@@ -137,14 +136,12 @@ void deg_graph_build_finalize(Depsgraph *graph)
|
||||
}
|
||||
}
|
||||
}
|
||||
GHASH_FOREACH_END();
|
||||
/* STEP 2: Flush visibility layers from children to parent. */
|
||||
deg_graph_build_flush_layers(graph);
|
||||
/* STEP 3: Re-tag IDs for update if it was tagged before the relations
|
||||
* update tag.
|
||||
*/
|
||||
GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, graph->id_hash)
|
||||
{
|
||||
foreach (IDDepsNode *id_node, graph->id_nodes) {
|
||||
GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp, id_node->components)
|
||||
{
|
||||
id_node->layers |= comp->layers;
|
||||
@@ -169,7 +166,6 @@ void deg_graph_build_finalize(Depsgraph *graph)
|
||||
}
|
||||
id_node->finalize_build();
|
||||
}
|
||||
GHASH_FOREACH_END();
|
||||
}
|
||||
|
||||
} // namespace DEG
|
||||
|
||||
@@ -497,11 +497,9 @@ static void deg_debug_graphviz_node_relations(const DebugContext &ctx,
|
||||
static void deg_debug_graphviz_graph_nodes(const DebugContext &ctx,
|
||||
const Depsgraph *graph)
|
||||
{
|
||||
GHASH_FOREACH_BEGIN (DepsNode *, node, graph->id_hash)
|
||||
{
|
||||
foreach (DepsNode *node, graph->id_nodes) {
|
||||
deg_debug_graphviz_node(ctx, node);
|
||||
}
|
||||
GHASH_FOREACH_END();
|
||||
TimeSourceDepsNode *time_source = graph->find_time_source();
|
||||
if (time_source != NULL) {
|
||||
deg_debug_graphviz_node(ctx, time_source);
|
||||
@@ -511,8 +509,7 @@ static void deg_debug_graphviz_graph_nodes(const DebugContext &ctx,
|
||||
static void deg_debug_graphviz_graph_relations(const DebugContext &ctx,
|
||||
const Depsgraph *graph)
|
||||
{
|
||||
GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, graph->id_hash)
|
||||
{
|
||||
foreach (IDDepsNode *id_node, graph->id_nodes) {
|
||||
GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
|
||||
{
|
||||
foreach (OperationDepsNode *op_node, comp_node->operations) {
|
||||
@@ -521,7 +518,6 @@ static void deg_debug_graphviz_graph_relations(const DebugContext &ctx,
|
||||
}
|
||||
GHASH_FOREACH_END();
|
||||
}
|
||||
GHASH_FOREACH_END();
|
||||
|
||||
TimeSourceDepsNode *time_source = graph->find_time_source();
|
||||
if (time_source != NULL) {
|
||||
|
||||
@@ -197,8 +197,7 @@ void DEG_stats_simple(const Depsgraph *graph, size_t *r_outer,
|
||||
size_t tot_outer = 0;
|
||||
size_t tot_rels = 0;
|
||||
|
||||
GHASH_FOREACH_BEGIN(DEG::IDDepsNode *, id_node, deg_graph->id_hash)
|
||||
{
|
||||
foreach (DEG::IDDepsNode *id_node, deg_graph->id_nodes) {
|
||||
tot_outer++;
|
||||
GHASH_FOREACH_BEGIN(DEG::ComponentDepsNode *, comp_node, id_node->components)
|
||||
{
|
||||
@@ -209,7 +208,6 @@ void DEG_stats_simple(const Depsgraph *graph, size_t *r_outer,
|
||||
}
|
||||
GHASH_FOREACH_END();
|
||||
}
|
||||
GHASH_FOREACH_END();
|
||||
|
||||
DEG::TimeSourceDepsNode *time_source = deg_graph->find_time_source();
|
||||
if (time_source != NULL) {
|
||||
|
||||
@@ -292,8 +292,7 @@ void DEG_graph_on_visible_update(Main *bmain, Scene *scene)
|
||||
* This is mainly needed on file load only, after that updates of invisible objects
|
||||
* will be stored in the pending list.
|
||||
*/
|
||||
GHASH_FOREACH_BEGIN(DEG::IDDepsNode *, id_node, graph->id_hash)
|
||||
{
|
||||
foreach (DEG::IDDepsNode *id_node, graph->id_nodes) {
|
||||
ID *id = id_node->id;
|
||||
if ((id->recalc & ID_RECALC_ALL) != 0 ||
|
||||
(id_node->layers & scene->lay_updated) == 0)
|
||||
@@ -319,7 +318,6 @@ void DEG_graph_on_visible_update(Main *bmain, Scene *scene)
|
||||
}
|
||||
}
|
||||
}
|
||||
GHASH_FOREACH_END();
|
||||
}
|
||||
scene->lay_updated |= graph->layers;
|
||||
/* If graph is tagged for update, we don't need to bother with updates here,
|
||||
|
||||
Reference in New Issue
Block a user