Depsgraph: use BLI::Set for entry_tags

Reviewers: sergey

Differential Revision: https://developer.blender.org/D7555
This commit is contained in:
Jacques Lucke 2020-04-28 17:40:23 +02:00
parent 7bc4a436a0
commit 7dfa1b18c1
7 changed files with 10 additions and 14 deletions

View File

@ -337,7 +337,7 @@ void DepsgraphNodeBuilder::begin_build()
id_node->id_cow = nullptr;
}
GSET_FOREACH_BEGIN (OperationNode *, op_node, graph_->entry_tags) {
for (OperationNode *op_node : graph_->entry_tags) {
ComponentNode *comp_node = op_node->owner;
IDNode *id_node = comp_node->owner;
@ -349,12 +349,11 @@ void DepsgraphNodeBuilder::begin_build()
entry_tag.name_tag = op_node->name_tag;
saved_entry_tags_.push_back(entry_tag);
}
GSET_FOREACH_END();
/* Make sure graph has no nodes left from previous state. */
graph_->clear_all_nodes();
graph_->operations.clear();
BLI_gset_clear(graph_->entry_tags, nullptr);
graph_->entry_tags.clear();
}
void DepsgraphNodeBuilder::end_build()

View File

@ -81,7 +81,6 @@ Depsgraph::Depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluati
is_render_pipeline_depsgraph(false)
{
BLI_spin_init(&lock);
entry_tags = BLI_gset_ptr_new("Depsgraph entry_tags");
memset(id_type_updated, 0, sizeof(id_type_updated));
memset(id_type_exist, 0, sizeof(id_type_exist));
memset(physics_relations, 0, sizeof(physics_relations));
@ -90,7 +89,6 @@ Depsgraph::Depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluati
Depsgraph::~Depsgraph()
{
clear_id_nodes();
BLI_gset_free(entry_tags, nullptr);
if (time_source != nullptr) {
OBJECT_GUARDED_DELETE(time_source, TimeSourceNode);
}
@ -231,7 +229,7 @@ void Depsgraph::add_entry_tag(OperationNode *node)
* from.
* NOTE: this is necessary since we have several thousand nodes to play
* with. */
BLI_gset_insert(entry_tags, node);
entry_tags.add(node);
}
void Depsgraph::clear_all_nodes()

View File

@ -119,7 +119,7 @@ struct Depsgraph {
/* Quick-Access Temp Data ............. */
/* Nodes which have been tagged as "directly modified". */
GSet *entry_tags;
Set<OperationNode *> entry_tags;
/* Special entry tag for time source. Allows to tag invisible dependency graphs for update when
* scene frame changes, so then when dependency graph becomes visible it is on a proper state. */

View File

@ -87,5 +87,5 @@ void DEG_evaluate_on_framechange(Main *bmain, Depsgraph *graph, float ctime)
bool DEG_needs_eval(Depsgraph *graph)
{
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
return BLI_gset_len(deg_graph->entry_tags) != 0 || deg_graph->need_update_time;
return !deg_graph->entry_tags.is_empty() || deg_graph->need_update_time;
}

View File

@ -319,7 +319,7 @@ bool DEG_is_fully_evaluated(const struct Depsgraph *depsgraph)
return false;
}
/* Check whether IDs are up to date. */
if (BLI_gset_len(deg_graph->entry_tags) > 0) {
if (!deg_graph->entry_tags.is_empty()) {
return false;
}
return true;

View File

@ -364,7 +364,7 @@ void depsgraph_ensure_view_layer(Depsgraph *graph)
void deg_evaluate_on_refresh(Depsgraph *graph)
{
/* Nothing to update, early out. */
if (BLI_gset_len(graph->entry_tags) == 0) {
if (graph->entry_tags.is_empty()) {
return;
}

View File

@ -116,7 +116,7 @@ BLI_INLINE void flush_prepare(Depsgraph *graph)
BLI_INLINE void flush_schedule_entrypoints(Depsgraph *graph, FlushQueue *queue)
{
GSET_FOREACH_BEGIN (OperationNode *, op_node, graph->entry_tags) {
for (OperationNode *op_node : graph->entry_tags) {
queue->push_back(op_node);
op_node->scheduled = true;
DEG_DEBUG_PRINTF((::Depsgraph *)graph,
@ -124,7 +124,6 @@ BLI_INLINE void flush_schedule_entrypoints(Depsgraph *graph, FlushQueue *queue)
"Operation is entry point for update: %s\n",
op_node->identifier().c_str());
}
GSET_FOREACH_END();
}
BLI_INLINE void flush_handle_id_node(IDNode *id_node)
@ -345,7 +344,7 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
graph->ctime = ctime;
time_source->tag_update(graph, DEG::DEG_UPDATE_SOURCE_TIME);
}
if (BLI_gset_len(graph->entry_tags) == 0) {
if (graph->entry_tags.is_empty()) {
return;
}
/* Reset all flags, get ready for the flush. */
@ -391,7 +390,7 @@ void deg_graph_clear_tags(Depsgraph *graph)
DEPSOP_FLAG_USER_MODIFIED);
}
/* Clear any entry tags which haven't been flushed. */
BLI_gset_clear(graph->entry_tags, nullptr);
graph->entry_tags.clear();
}
} // namespace DEG