diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-02-20 18:55:02 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-02-28 00:25:54 +0300 |
commit | 06420c5fe8fda54c543f26f9d95d2c6fcf5161cd (patch) | |
tree | 2cb566ad03dd15a34f3d04d0826c33aa096efada /source/blender/blenkernel/intern/sequencer.c | |
parent | bd119ab0177a380a1736677278c02790d8235be4 (diff) |
Refactor depsgraph/render logic to serve evaluated depsgraph to engines
User notes
----------
Compositing, rendering of multi-layers in Eevee should be fully working now.
Development notes
-----------------
Up until now we were still using the same depsgraph for rendering and viewport
evaluation. And we had to go out of our ways to be sure the depsgraphs were
updated.
Now we iterate over the (to be rendered) view layers and create a depsgraph to
each one, fully evaluated and call the render engines (Cycles, Eevee, ...) with
this viewlayer/depsgraph/evaluation context.
At this time we are not handling data persistency, Depsgraph is created from
scratch prior to rendering each frame. So I got rid of most of the partial
update calls we had during the render pipeline.
Cycles: Brecht Van Lommel did a patch to tackle some of the required Cycles
changes but this commit mark these changes as TODOs. Basically Cycles needs to
render one layer at a time.
Reviewers: sergey, brecht
Differential Revision: https://developer.blender.org/D3073
Diffstat (limited to 'source/blender/blenkernel/intern/sequencer.c')
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 950f7ad9957..b11c1583236 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3269,9 +3269,10 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq // have_seq = (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first); /* UNUSED */ have_comp = (scene->r.scemode & R_DOCOMP) && scene->use_nodes && scene->nodetree; - /* Get depsgraph and scene layer for the strip. */ + /* Get view layer for the strip. */ ViewLayer *view_layer = BKE_view_layer_from_scene_get(scene); - Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); + /* Depsgraph will be NULL when doing rendering. */ + Depsgraph *depsgraph = NULL; orig_data.scemode = scene->r.scemode; orig_data.cfra = scene->r.cfra; @@ -3329,6 +3330,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq /* opengl offscreen render */ context->eval_ctx->engine_type = RE_engines_find(scene->view_render.engine_id); + depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); BKE_scene_graph_update_for_newframe(context->eval_ctx, depsgraph, context->bmain, scene, view_layer); ibuf = sequencer_view3d_cb( /* set for OpenGL render (NULL when scrubbing) */ @@ -3360,15 +3362,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq if (re == NULL) re = RE_NewSceneRender(scene); - /* NOTE: Without this tag rendering from command line fails. - * TODO(sergey): Need some proper solution with ported - * BKE_scene_set_background() or DEG_on_visible_change() ? - */ - RE_SetDepsgraph(re, depsgraph); - DEG_graph_id_tag_update(context->bmain, depsgraph, &scene->id, 0); - - BKE_scene_graph_update_for_newframe(context->eval_ctx, depsgraph, context->bmain, scene, view_layer); - RE_BlenderFrame(re, context->bmain, scene, NULL, camera, scene->lay, frame, false); + RE_BlenderFrame(re, context->bmain, scene, view_layer, camera, scene->lay, frame, false); /* restore previous state after it was toggled on & off by RE_BlenderFrame */ G.is_rendering = is_rendering; @@ -3426,7 +3420,7 @@ finally: scene->r.cfra = orig_data.cfra; scene->r.subframe = orig_data.subframe; - if (is_frame_update) { + if (is_frame_update && (depsgraph != NULL)) { BKE_scene_graph_update_for_newframe(context->eval_ctx, depsgraph, context->bmain, scene, view_layer); } |