Commit: 80face1be57ed38b812dbd9a245de36b3e160013
Author: Jacques Lucke
Date:   Tue Aug 18 17:40:45 2020 +0200
Branches: master
https://developer.blender.org/rB80face1be57ed38b812dbd9a245de36b3e160013

Depsgraph: simplify DEG_evaluate_* API

This mainly removes the bmain argument, which can be
retrieved from the graph itself.

Also, I removed some outdated/unnecessary comments.

Reviewers: sergey, sybren

Differential Revision: https://developer.blender.org/D8614

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

M       source/blender/blenkernel/intern/scene.c
M       source/blender/blenkernel/intern/seqprefetch.c
M       source/blender/depsgraph/DEG_depsgraph.h
M       source/blender/depsgraph/intern/depsgraph_eval.cc
M       source/blender/depsgraph/intern/eval/deg_eval_flush.cc
M       source/blender/depsgraph/intern/eval/deg_eval_flush.h
M       source/blender/draw/engines/eevee/eevee_lightcache.c
M       source/blender/editors/space_node/node_edit.c
M       source/blender/render/intern/source/external_engine.c
M       source/blender/render/intern/source/pipeline.c

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

diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index 631c5ed330d..6f1cca619ff 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1493,7 +1493,7 @@ static void scene_graph_update_tagged(Depsgraph 
*depsgraph, Main *bmain, bool on
     /* Update all objects: drivers, matrices, displists, etc. flags set
      * by depgraph or manual, no layer check here, gets correct flushed.
      */
-    DEG_evaluate_on_refresh(bmain, depsgraph);
+    DEG_evaluate_on_refresh(depsgraph);
     /* Update sound system. */
     BKE_scene_update_sound(depsgraph, bmain);
     /* Notify python about depsgraph update. */
@@ -1565,10 +1565,10 @@ void BKE_scene_graph_update_for_newframe(Depsgraph 
*depsgraph)
      * loose any possible unkeyed changes made by the handler. */
     if (pass == 0) {
       const float ctime = BKE_scene_frame_get(scene);
-      DEG_evaluate_on_framechange(bmain, depsgraph, ctime);
+      DEG_evaluate_on_framechange(depsgraph, ctime);
     }
     else {
-      DEG_evaluate_on_refresh(bmain, depsgraph);
+      DEG_evaluate_on_refresh(depsgraph);
     }
     /* Update sound system animation. */
     BKE_scene_update_sound(depsgraph, bmain);
diff --git a/source/blender/blenkernel/intern/seqprefetch.c 
b/source/blender/blenkernel/intern/seqprefetch.c
index c442b7ca780..3a7e4af490a 100644
--- a/source/blender/blenkernel/intern/seqprefetch.c
+++ b/source/blender/blenkernel/intern/seqprefetch.c
@@ -207,7 +207,7 @@ static void seq_prefetch_free_depsgraph(PrefetchJob *pfjob)
 
 static void seq_prefetch_update_depsgraph(PrefetchJob *pfjob)
 {
-  DEG_evaluate_on_framechange(pfjob->bmain_eval, pfjob->depsgraph, 
seq_prefetch_cfra(pfjob));
+  DEG_evaluate_on_framechange(pfjob->depsgraph, seq_prefetch_cfra(pfjob));
 }
 
 static void seq_prefetch_init_depsgraph(PrefetchJob *pfjob)
diff --git a/source/blender/depsgraph/DEG_depsgraph.h 
b/source/blender/depsgraph/DEG_depsgraph.h
index b3636743101..8f33e9f480d 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -149,16 +149,11 @@ void DEG_ids_check_recalc(struct Main *bmain,
 
 /* Graph Evaluation  ----------------------------- */
 
-/* Frame changed recalculation entry point
- * < context_type: context to perform evaluation for
- * < ctime: (frame) new frame to evaluate values on
- */
-void DEG_evaluate_on_framechange(struct Main *bmain, Depsgraph *graph, float 
ctime);
+/* Frame changed recalculation entry point. */
+void DEG_evaluate_on_framechange(Depsgraph *graph, float ctime);
 
-/* Data changed recalculation entry point.
- * < context_type: context to perform evaluation for
- */
-void DEG_evaluate_on_refresh(struct Main *bmain, Depsgraph *graph);
+/* Data changed recalculation entry point. */
+void DEG_evaluate_on_refresh(Depsgraph *graph);
 
 bool DEG_needs_eval(Depsgraph *graph);
 
diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cc 
b/source/blender/depsgraph/intern/depsgraph_eval.cc
index b4c93fb12af..0c116f5863c 100644
--- a/source/blender/depsgraph/intern/depsgraph_eval.cc
+++ b/source/blender/depsgraph/intern/depsgraph_eval.cc
@@ -48,7 +48,7 @@
 namespace deg = blender::deg;
 
 /* Evaluate all nodes tagged for updating. */
-void DEG_evaluate_on_refresh(Main *bmain, Depsgraph *graph)
+void DEG_evaluate_on_refresh(Depsgraph *graph)
 {
   deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph);
   deg_graph->ctime = BKE_scene_frame_get(deg_graph->scene);
@@ -56,18 +56,18 @@ void DEG_evaluate_on_refresh(Main *bmain, Depsgraph *graph)
   if (deg_graph->scene_cow) {
     BKE_scene_frame_set(deg_graph->scene_cow, deg_graph->ctime);
   }
-  deg::deg_graph_flush_updates(bmain, deg_graph);
+  deg::deg_graph_flush_updates(deg_graph);
   deg::deg_evaluate_on_refresh(deg_graph);
   deg_graph->need_update_time = false;
 }
 
 /* Frame-change happened for root scene that graph belongs to. */
-void DEG_evaluate_on_framechange(Main *bmain, Depsgraph *graph, float ctime)
+void DEG_evaluate_on_framechange(Depsgraph *graph, float ctime)
 {
   deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph);
   deg_graph->ctime = ctime;
   deg_graph->need_update_time = true;
-  deg::deg_graph_flush_updates(bmain, deg_graph);
+  deg::deg_graph_flush_updates(deg_graph);
   /* Update time in scene. */
   if (deg_graph->scene_cow) {
     BKE_scene_frame_set(deg_graph->scene_cow, deg_graph->ctime);
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc 
b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index a74ec485d88..dea23c9f96d 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -351,11 +351,12 @@ void invalidate_tagged_evaluated_data(Depsgraph *graph)
 /* Flush updates from tagged nodes outwards until all affected nodes
  * are tagged.
  */
-void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
+void deg_graph_flush_updates(Depsgraph *graph)
 {
   /* Sanity checks. */
-  BLI_assert(bmain != nullptr);
   BLI_assert(graph != nullptr);
+  Main *bmain = graph->bmain;
+
   /* Nothing to update, early out. */
   if (graph->need_update_time) {
     const Scene *scene_orig = graph->scene;
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.h 
b/source/blender/depsgraph/intern/eval/deg_eval_flush.h
index c76dc9fe01d..1f58c54dbf4 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.h
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.h
@@ -35,7 +35,7 @@ struct Depsgraph;
 /* Flush updates from tagged nodes outwards until all affected nodes
  * are tagged.
  */
-void deg_graph_flush_updates(struct Main *bmain, struct Depsgraph *graph);
+void deg_graph_flush_updates(struct Depsgraph *graph);
 
 /* Clear tags from all operation nodes. */
 void deg_graph_clear_tags(struct Depsgraph *graph);
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c 
b/source/blender/draw/engines/eevee/eevee_lightcache.c
index b5364a71378..a785d27c2db 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -1303,7 +1303,7 @@ void EEVEE_lightbake_job(void *custom_data, short *stop, 
short *do_update, float
   Depsgraph *depsgraph = lbake->depsgraph;
 
   DEG_graph_relations_update(depsgraph);
-  DEG_evaluate_on_framechange(lbake->bmain, depsgraph, lbake->frame);
+  DEG_evaluate_on_framechange(depsgraph, lbake->frame);
 
   lbake->view_layer = DEG_get_evaluated_view_layer(depsgraph);
   lbake->stop = stop;
diff --git a/source/blender/editors/space_node/node_edit.c 
b/source/blender/editors/space_node/node_edit.c
index 5f5f6467c8a..ef931dd9bb8 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -211,7 +211,7 @@ static void compo_initjob(void *cjv)
 
   /* NOTE: Don't update animation to preserve unkeyed changes, this means can 
not use
    * evaluate_on_framechange. */
-  DEG_evaluate_on_refresh(bmain, cj->compositor_depsgraph);
+  DEG_evaluate_on_refresh(cj->compositor_depsgraph);
 
   bNodeTree *ntree_eval = (bNodeTree 
*)DEG_get_evaluated_id(cj->compositor_depsgraph,
                                                             &cj->ntree->id);
diff --git a/source/blender/render/intern/source/external_engine.c 
b/source/blender/render/intern/source/external_engine.c
index adab95d41a9..440c54f5eeb 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -610,7 +610,7 @@ static void engine_depsgraph_init(RenderEngine *engine, 
ViewLayer *view_layer)
   if (engine->re->r.scemode & R_BUTS_PREVIEW) {
     Depsgraph *depsgraph = engine->depsgraph;
     DEG_graph_relations_update(depsgraph);
-    DEG_evaluate_on_framechange(bmain, depsgraph, CFRA);
+    DEG_evaluate_on_framechange(depsgraph, CFRA);
     DEG_ids_check_recalc(bmain, depsgraph, scene, view_layer, true);
     DEG_ids_clear_recalc(bmain, depsgraph);
   }
diff --git a/source/blender/render/intern/source/pipeline.c 
b/source/blender/render/intern/source/pipeline.c
index 8f5469c7a98..86c9c64098b 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -1964,7 +1964,7 @@ void RE_SetReports(Render *re, ReportList *reports)
 static void render_update_depsgraph(Render *re)
 {
   Scene *scene = re->scene;
-  DEG_evaluate_on_framechange(re->main, re->pipeline_depsgraph, CFRA);
+  DEG_evaluate_on_framechange(re->pipeline_depsgraph, CFRA);
   BKE_scene_update_sound(re->pipeline_depsgraph, re->main);
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to