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:
authorDalai Felinto <dfelinto@gmail.com>2018-02-20 18:55:02 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-02-28 00:25:54 +0300
commit06420c5fe8fda54c543f26f9d95d2c6fcf5161cd (patch)
tree2cb566ad03dd15a34f3d04d0826c33aa096efada /source/blender/blenkernel/intern
parentbd119ab0177a380a1736677278c02790d8235be4 (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')
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c8
-rw-r--r--source/blender/blenkernel/intern/scene.c5
-rw-r--r--source/blender/blenkernel/intern/sequencer.c18
3 files changed, 10 insertions, 21 deletions
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 349f995819c..22a1f9b4b18 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -3348,7 +3348,7 @@ typedef struct BrushMaterials {
/* Initialize materials for brush object:
* Calculates inverse matrices for linked objects, updates
* volume caches etc. */
-static void dynamicPaint_updateBrushMaterials(Object *brushOb, Material *ui_mat, Scene *scene, BrushMaterials *bMats)
+static void dynamicPaint_updateBrushMaterials(const EvaluationContext *eval_ctx, Object *brushOb, Material *ui_mat, Scene *scene, BrushMaterials *bMats)
{
/* Calculate inverse transformation matrix
* for this object */
@@ -3363,13 +3363,13 @@ static void dynamicPaint_updateBrushMaterials(Object *brushOb, Material *ui_mat,
if (tot) {
bMats->ob_mats = MEM_callocN(sizeof(Material *) * (tot), "BrushMaterials");
for (i = 0; i < tot; i++) {
- bMats->ob_mats[i] = RE_sample_material_init(give_current_material(brushOb, (i + 1)), scene);
+ bMats->ob_mats[i] = RE_sample_material_init(eval_ctx, give_current_material(brushOb, (i + 1)), scene);
}
}
bMats->tot = tot;
}
else {
- bMats->mat = RE_sample_material_init(ui_mat, scene);
+ bMats->mat = RE_sample_material_init(eval_ctx, ui_mat, scene);
}
}
@@ -6087,7 +6087,7 @@ static int dynamicPaint_doStep(const struct EvaluationContext *eval_ctx, Scene *
}
/* Prepare materials if required */
if (brush_usesMaterial(brush, scene))
- dynamicPaint_updateBrushMaterials(brushObj, brush->mat, scene, &bMats);
+ dynamicPaint_updateBrushMaterials(eval_ctx, brushObj, brush->mat, scene, &bMats);
/* Apply brush on the surface depending on it's collision type */
if (brush->psys && brush->psys->part &&
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 7032541f90d..f263f23fb92 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1455,11 +1455,6 @@ void BKE_scene_graph_update_for_newframe(EvaluationContext *eval_ctx,
Scene *scene,
ViewLayer *view_layer)
{
- /* TODO(sergey): Temporary solution for until pipeline.c is ported. */
- if (view_layer == NULL) {
- view_layer = DEG_get_evaluated_view_layer(depsgraph);
- BLI_assert(view_layer != NULL);
- }
/* TODO(sergey): Some functions here are changing global state,
* for example, clearing update tags from bmain.
*/
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);
}