diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-20 16:14:10 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-23 17:22:25 +0300 |
commit | b432209f63f873a025a7f4c3a79aa1d697dc9b98 (patch) | |
tree | dbba9e8605777f91b1db73aa821a18647464819f /source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc | |
parent | 0ec6fa782b63a05e52df2d013ffbf547b178ffd1 (diff) |
Render: Use dependency graph for compositor/sequencer
This change makes it so a minimal dependency graph which only includes
compositor and sequencer is built for the render pipeline purposes.
Tricky part here is that it's only compositor itself and sequencer who
to use this dependency graph and IDs from it. Render engines are still
to be provided original IDs because:
- They will create dependency graph for the given scene, and currently
it is not possible to create dependency graph from CoW scene.
- IDs from the compositor/sequencer dependency graph are "stripped",
as in, they wouldn't have all view layers, collections or objects
required for proper final render.
This creates annoying mess of mixing evaluated and original scene
access in various parts of the pipeline.
Fixes T63927: Compositing nodes - drivers don't really work
Reviewers: brecht
Maniphest Tasks: T63927
Differential Revision: https://developer.blender.org/D4911
Diffstat (limited to 'source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc')
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index 98c50bf6fdf..d714a913b96 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -327,7 +327,7 @@ ViewLayer *get_original_view_layer(const Depsgraph *depsgraph, const IDNode *id_ return BKE_view_layer_default_render(scene_orig); } /* Is possible to have scene linked indirectly (i.e. via the driver) which - * we need to support. Currently there aer issues somewhere else, which + * we need to support. Currently there are issues somewhere else, which * makes testing hard. This is a reported problem, so will eventually be * properly fixed. * @@ -341,11 +341,17 @@ void scene_remove_unused_view_layers(const Depsgraph *depsgraph, Scene *scene_cow) { const ViewLayer *view_layer_input; - /* Indirectly linked scenes means it's not an input scene and not a set scene, and is pulled via - * some driver. Such scenes should not have view layers after copy. */ if (id_node->linked_state == DEG_ID_LINKED_INDIRECTLY) { + /* Indirectly linked scenes means it's not an input scene and not a set scene, and is pulled + * via some driver. Such scenes should not have view layers after copy. */ view_layer_input = NULL; } + else if (depsgraph->is_render_pipeline_depsgraph) { + /* If the dependency graph is used for post-processing (such as compositor) we do need to + * have access to its view layer names so can not remove any view layers. + * On a more positive side we can remove all the bases from all the view layers. */ + return; + } else { view_layer_input = get_original_view_layer(depsgraph, id_node); } @@ -372,6 +378,13 @@ void scene_remove_unused_view_layers(const Depsgraph *depsgraph, scene_cow->view_layers.last = view_layer_eval; } +void scene_remove_all_bases(Scene *scene_cow) +{ + LISTBASE_FOREACH (ViewLayer *, view_layer, &scene_cow->view_layers) { + BLI_freelistN(&view_layer->object_bases); + } +} + /* Makes it so given view layer only has bases corresponding to enabled * objects. */ void view_layer_remove_disabled_bases(const Depsgraph *depsgraph, ViewLayer *view_layer) @@ -425,6 +438,11 @@ void scene_setup_view_layers_before_remap(const Depsgraph *depsgraph, Scene *scene_cow) { scene_remove_unused_view_layers(depsgraph, id_node, scene_cow); + /* If dependency graph is used for post-processing we don't need any bases and can free of them. + * Do it before re-mapping to make that process faster. */ + if (depsgraph->is_render_pipeline_depsgraph) { + scene_remove_all_bases(scene_cow); + } } void scene_setup_view_layers_after_remap(const Depsgraph *depsgraph, |