diff options
-rw-r--r-- | source/blender/blenkernel/BKE_scene.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/context.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/displist.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 16 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 2 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_build.cc | 22 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_debug.cc | 2 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_tag.cc | 12 | ||||
-rw-r--r-- | source/blender/editors/include/ED_view3d.h | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 11 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw_legacy.c | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 1 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_subsurf.c | 3 | ||||
-rw-r--r-- | source/blender/python/intern/gpu_offscreen.c | 2 | ||||
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 5 |
17 files changed, 59 insertions, 38 deletions
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 5047070012c..6ca79d8c7cd 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -39,12 +39,14 @@ extern "C" { struct AviCodecData; struct BaseLegacy; +struct Depsgraph; struct EvaluationContext; struct Main; struct Object; struct Base; struct QuicktimeCodecData; struct RenderData; +struct SceneLayer; struct SceneRenderLayer; struct Scene; struct SceneCollection; @@ -184,6 +186,9 @@ void BKE_scene_multiview_view_prefix_get(struct Scene *scene, const char void BKE_scene_multiview_videos_dimensions_get(const struct RenderData *rd, const size_t width, const size_t height, size_t *r_width, size_t *r_height); int BKE_scene_multiview_num_videos_get(const struct RenderData *rd); +/* depsgraph */ +struct Depsgraph* BKE_scene_get_depsgraph(struct Scene *scene, struct SceneLayer *scene_layer); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index aea2ad0cd9e..49a219691bc 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -2605,7 +2605,8 @@ static bool calc_modifiers_skip_orco(Scene *scene, else if ((ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) != 0) { return false; } - else if ((DEG_get_eval_flags_for_id(scene->depsgraph, &ob->id) & DAG_EVAL_NEED_CPU) != 0) { + /* TODO(sergey): How do we get depsgraph here? */ + else if ((DEG_get_eval_flags_for_id(scene->depsgraph_legacy, &ob->id) & DAG_EVAL_NEED_CPU) != 0) { return false; } SubsurfModifierData *smd = (SubsurfModifierData *)last_md; diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 0ad853b016a..ffccc59171c 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -52,6 +52,7 @@ #include "BKE_context.h" #include "BKE_layer.h" #include "BKE_main.h" +#include "BKE_scene.h" #include "BKE_screen.h" #include "BKE_sound.h" #include "BKE_workspace.h" @@ -1225,5 +1226,6 @@ int CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list) Depsgraph *CTX_data_depsgraph(const bContext *C) { Scene *scene = CTX_data_scene(C); - return scene->depsgraph; + SceneLayer *scene_layer = CTX_data_scene_layer(C); + return BKE_scene_get_depsgraph(scene, scene_layer); } diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 44f284d043e..25f50056c42 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -1740,8 +1740,9 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba } if (!for_orco) { + /* TODO(sergey): How do we get depsgraph here? */ if ((cu->flag & CU_PATH) || - DEG_get_eval_flags_for_id(scene->depsgraph, &ob->id) & DAG_EVAL_NEED_CURVE_PATH) + DEG_get_eval_flags_for_id(scene->depsgraph_legacy, &ob->id) & DAG_EVAL_NEED_CURVE_PATH) { calc_curvepath(ob, &nubase); } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 3b2287a7921..7b103a3c56e 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -255,7 +255,7 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type) scen->ed = NULL; scen->theDag = NULL; - scen->depsgraph = NULL; + scen->depsgraph_legacy = NULL; scen->obedit = NULL; scen->fps_info = NULL; @@ -583,8 +583,8 @@ void BKE_scene_free_ex(Scene *sce, const bool do_id_user) } DEG_scene_graph_free(sce); - if (sce->depsgraph) - DEG_graph_free(sce->depsgraph); + if (sce->depsgraph_legacy) + DEG_graph_free(sce->depsgraph_legacy); MEM_SAFE_FREE(sce->fps_info); @@ -1542,7 +1542,7 @@ void BKE_scene_update_tagged(EvaluationContext *eval_ctx, Main *bmain, Scene *sc * * in the future this should handle updates for all datablocks, not * only objects and scenes. - brecht */ - DEG_evaluate_on_refresh(eval_ctx, scene->depsgraph, scene); + DEG_evaluate_on_refresh(eval_ctx, scene->depsgraph_legacy, scene); /* TODO(sergey): This is to beocme a node in new depsgraph. */ BKE_mask_update_scene(bmain, scene); @@ -1604,7 +1604,7 @@ void BKE_scene_update_for_newframe(EvaluationContext *eval_ctx, Main *bmain, Sce BKE_main_id_tag_idcode(bmain, ID_LA, LIB_TAG_DOIT, false); /* BKE_object_handle_update() on all objects, groups and sets */ - DEG_evaluate_on_framechange(eval_ctx, bmain, sce->depsgraph, ctime); + DEG_evaluate_on_framechange(eval_ctx, bmain, sce->depsgraph_legacy, ctime); /* update sound system animation (TODO, move to depsgraph) */ BKE_sound_update_scene(bmain, sce); @@ -2250,3 +2250,9 @@ int BKE_scene_multiview_num_videos_get(const RenderData *rd) return BKE_scene_multiview_num_views_get(rd); } } + +Depsgraph* BKE_scene_get_depsgraph(Scene *scene, SceneLayer *scene_layer) +{ + (void) scene_layer; + return scene->depsgraph_legacy; +} diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 61fb616013c..7f92cc9e8bb 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6093,7 +6093,7 @@ static void direct_link_scene(FileData *fd, Scene *sce, Main *bmain) SceneRenderLayer *srl; sce->theDag = NULL; - sce->depsgraph = NULL; + sce->depsgraph_legacy = NULL; sce->obedit = NULL; sce->fps_info = NULL; sce->customdata_mask_modal = 0; diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc index 88ff1ac0a9c..41934e3e4e6 100644 --- a/source/blender/depsgraph/intern/depsgraph_build.cc +++ b/source/blender/depsgraph/intern/depsgraph_build.cc @@ -261,8 +261,8 @@ void DEG_relations_tag_update(Main *bmain) scene != NULL; scene = (Scene *)scene->id.next) { - if (scene->depsgraph != NULL) { - DEG_graph_tag_relations_update(scene->depsgraph); + if (scene->depsgraph_legacy != NULL) { + DEG_graph_tag_relations_update(scene->depsgraph_legacy); } } } @@ -272,14 +272,14 @@ void DEG_relations_tag_update(Main *bmain) */ void DEG_scene_relations_update(Main *bmain, Scene *scene) { - if (scene->depsgraph == NULL) { + if (scene->depsgraph_legacy == NULL) { /* Rebuild graph from scratch and exit. */ - scene->depsgraph = DEG_graph_new(); - DEG_graph_build_from_scene(scene->depsgraph, bmain, scene); + scene->depsgraph_legacy = DEG_graph_new(); + DEG_graph_build_from_scene(scene->depsgraph_legacy, bmain, scene); return; } - DEG::Depsgraph *graph = reinterpret_cast<DEG::Depsgraph *>(scene->depsgraph); + DEG::Depsgraph *graph = reinterpret_cast<DEG::Depsgraph *>(scene->depsgraph_legacy); if (!graph->need_update) { /* Graph is up to date, nothing to do. */ return; @@ -301,17 +301,17 @@ void DEG_scene_relations_update(Main *bmain, Scene *scene) /* Rebuild dependency graph only for a given scene. */ void DEG_scene_relations_rebuild(Main *bmain, Scene *scene) { - if (scene->depsgraph != NULL) { - DEG_graph_tag_relations_update(scene->depsgraph); + if (scene->depsgraph_legacy != NULL) { + DEG_graph_tag_relations_update(scene->depsgraph_legacy); } DEG_scene_relations_update(bmain, scene); } void DEG_scene_graph_free(Scene *scene) { - if (scene->depsgraph) { - DEG_graph_free(scene->depsgraph); - scene->depsgraph = NULL; + if (scene->depsgraph_legacy) { + DEG_graph_free(scene->depsgraph_legacy); + scene->depsgraph_legacy = NULL; } } diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cc b/source/blender/depsgraph/intern/depsgraph_debug.cc index 388b692d742..453bd2aa75f 100644 --- a/source/blender/depsgraph/intern/depsgraph_debug.cc +++ b/source/blender/depsgraph/intern/depsgraph_debug.cc @@ -91,7 +91,7 @@ bool DEG_debug_scene_relations_validate(Main *bmain, Depsgraph *depsgraph = DEG_graph_new(); bool valid = true; DEG_graph_build_from_scene(depsgraph, bmain, scene); - if (!DEG_debug_compare(depsgraph, scene->depsgraph)) { + if (!DEG_debug_compare(depsgraph, scene->depsgraph_legacy)) { fprintf(stderr, "ERROR! Depsgraph wasn't tagged for update when it should have!\n"); BLI_assert(!"This should not happen!"); valid = false; diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index 5b7294d92f9..abf4cba2617 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -230,8 +230,8 @@ void DEG_id_tag_update_ex(Main *bmain, ID *id, int flag) scene != NULL; scene = (Scene *)scene->id.next) { - if (scene->depsgraph) { - Depsgraph *graph = scene->depsgraph; + if (scene->depsgraph_legacy) { + Depsgraph *graph = scene->depsgraph_legacy; if (flag == 0) { /* TODO(sergey): Currently blender is still tagging IDs * for recalc just using flag=0. This isn't totally correct @@ -294,10 +294,10 @@ void DEG_id_type_tag(Main *bmain, short idtype) void DEG_ids_flush_tagged(Main *bmain, Scene *scene) { /* TODO(sergey): Only visible scenes? */ - if (scene->depsgraph != NULL) { + if (scene->depsgraph_legacy != NULL) { DEG::deg_graph_flush_updates( bmain, - reinterpret_cast<DEG::Depsgraph *>(scene->depsgraph)); + reinterpret_cast<DEG::Depsgraph *>(scene->depsgraph_legacy)); } } @@ -305,7 +305,7 @@ void DEG_ids_flush_tagged(Main *bmain, Scene *scene) void DEG_graph_on_visible_update(Main *bmain, Scene *scene) { (void) bmain; - DEG::Depsgraph *graph = reinterpret_cast<DEG::Depsgraph *>(scene->depsgraph); + DEG::Depsgraph *graph = reinterpret_cast<DEG::Depsgraph *>(scene->depsgraph_legacy); GHASH_FOREACH_BEGIN(DEG::IDDepsNode *, id_node, graph->id_hash) { id_node->tag_update(graph); @@ -319,7 +319,7 @@ void DEG_on_visible_update(Main *bmain, const bool UNUSED(do_time)) scene != NULL; scene = (Scene *)scene->id.next) { - if (scene->depsgraph != NULL) { + if (scene->depsgraph_legacy != NULL) { DEG_graph_on_visible_update(bmain, scene); } } diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 69d27e30b1f..19bb55742d5 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -360,7 +360,7 @@ void ED_draw_object_facemap(struct Scene *scene, struct Object *ob, const float bool ED_view3d_context_activate(struct bContext *C); void ED_view3d_draw_offscreen_init(struct Scene *scene, struct SceneLayer *sl, struct View3D *v3d); void ED_view3d_draw_offscreen( - struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int winx, int winy, float viewmat[4][4], + struct Scene *scene, struct SceneLayer *sl, struct View3D *v3d, struct ARegion *ar, int winx, int winy, float viewmat[4][4], float winmat[4][4], bool do_bgpic, bool do_sky, bool is_persp, const char *viewname, struct GPUFX *fx, struct GPUFXSettings *fx_settings, struct GPUOffScreen *ofs); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 1afa8cda111..6232eac15a2 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1947,7 +1947,7 @@ static void view3d_main_region_clear(Scene *scene, View3D *v3d, ARegion *ar) * stuff like shadow buffers */ void ED_view3d_draw_offscreen( - Scene *scene, View3D *v3d, ARegion *ar, int winx, int winy, + Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, int winx, int winy, float viewmat[4][4], float winmat[4][4], bool do_bgpic, bool do_sky, bool is_persp, const char *viewname, GPUFX *fx, GPUFXSettings *fx_settings, @@ -2043,7 +2043,8 @@ void ED_view3d_draw_offscreen( } else { /* XXX, should take depsgraph as arg */ - DRW_draw_render_loop_offscreen(scene->depsgraph, ar, v3d, ofs); + Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, sl); + DRW_draw_render_loop_offscreen(depsgraph, ar, v3d, ofs); } /* restore size */ @@ -2137,7 +2138,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( if ((samples && full_samples) == 0) { /* Single-pass render, common case */ ED_view3d_draw_offscreen( - scene, v3d, ar, sizex, sizey, NULL, winmat, + scene, sl, v3d, ar, sizex, sizey, NULL, winmat, draw_background, draw_sky, !is_ortho, viewname, fx, &fx_settings, ofs); @@ -2161,7 +2162,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( /* first sample buffer, also initializes 'rv3d->persmat' */ ED_view3d_draw_offscreen( - scene, v3d, ar, sizex, sizey, NULL, winmat, + scene, sl, v3d, ar, sizex, sizey, NULL, winmat, draw_background, draw_sky, !is_ortho, viewname, fx, &fx_settings, ofs); GPU_offscreen_read_pixels(ofs, GL_UNSIGNED_BYTE, rect_temp); @@ -2180,7 +2181,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( (jit_ofs[j][1] * 2.0f) / sizey); ED_view3d_draw_offscreen( - scene, v3d, ar, sizex, sizey, NULL, winmat_jitter, + scene, sl, v3d, ar, sizex, sizey, NULL, winmat_jitter, draw_background, draw_sky, !is_ortho, viewname, fx, &fx_settings, ofs); GPU_offscreen_read_pixels(ofs, GL_UNSIGNED_BYTE, rect_temp); diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index 4c15a291c9c..15424854814 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -1422,7 +1422,7 @@ static void gpu_update_lamps_shadows_world(Scene *scene, View3D *v3d) /* no need to call ED_view3d_draw_offscreen_init since shadow buffers were already updated */ ED_view3d_draw_offscreen( - scene, v3d, &ar, winsize, winsize, viewmat, winmat, + scene, BKE_scene_layer_context_active(scene), v3d, &ar, winsize, winsize, viewmat, winmat, false, false, true, NULL, NULL, NULL, NULL); GPU_lamp_shadow_buffer_unbind(shadow->lamp); diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index f21cee80f80..a3b0b8ac2c7 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1697,7 +1697,7 @@ typedef struct Scene { void *fps_info; /* (runtime) info/cache used for presenting playback framerate info to the user */ /* none of the dependency graph vars is mean to be saved */ - struct Depsgraph *depsgraph; + struct Depsgraph *depsgraph_legacy; void *pad1; struct DagForest *theDag; short dagflags; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 491242b4df8..16517ecfde3 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -9384,6 +9384,7 @@ void RNA_def_scene(BlenderRNA *brna) /* Dependency Graph */ prop = RNA_def_property(srna, "depsgraph", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "depsgraph_legacy"); RNA_def_property_struct_type(prop, "Depsgraph"); RNA_def_property_ui_text(prop, "Dependency Graph", "Dependencies in the scene data"); diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index 407fd63d5c3..cee8dd301bf 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -135,7 +135,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, else if ((ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) != 0) { modifier_setError(md, "OpenSubdiv is not supported in paint modes"); } - else if ((DEG_get_eval_flags_for_id(md->scene->depsgraph, &ob->id) & DAG_EVAL_NEED_CPU) == 0) { + /* TODO(sergey): How do we get depsgraph here? */ + else if ((DEG_get_eval_flags_for_id(md->scene->depsgraph_legacy, &ob->id) & DAG_EVAL_NEED_CPU) == 0) { subsurf_flags |= SUBSURF_USE_GPU_BACKEND; do_cddm_convert = false; } diff --git a/source/blender/python/intern/gpu_offscreen.c b/source/blender/python/intern/gpu_offscreen.c index da8e5d69f02..c7350ad2e3f 100644 --- a/source/blender/python/intern/gpu_offscreen.c +++ b/source/blender/python/intern/gpu_offscreen.c @@ -231,7 +231,7 @@ static PyObject *pygpu_offscreen_draw_view3d(BPy_GPUOffScreen *self, PyObject *a GPU_offscreen_bind(self->ofs, true); /* bind */ ED_view3d_draw_offscreen( - scene, v3d, ar, GPU_offscreen_width(self->ofs), GPU_offscreen_height(self->ofs), + scene, sl, v3d, ar, GPU_offscreen_width(self->ofs), GPU_offscreen_height(self->ofs), (float(*)[4])py_mat_modelview->matrix, (float(*)[4])py_mat_projection->matrix, false, true, true, "", fx, &fx_settings, diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index f7b0bbd8324..4581e0bdea0 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -64,6 +64,7 @@ #include "BKE_colortools.h" #include "BKE_global.h" #include "BKE_image.h" +#include "BKE_layer.h" #include "BKE_library.h" #include "BKE_library_remap.h" #include "BKE_main.h" @@ -3795,6 +3796,8 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri void RE_PreviewRender(Render *re, Main *bmain, Scene *sce) { Object *camera; + /* TODO(sergey): Get proper scene layer here. */ + SceneLayer *scene_layer = BKE_scene_layer_context_active_ex(bmain, sce); int winx, winy; winx = (sce->r.size * sce->r.xsch) / 100; @@ -3808,7 +3811,7 @@ void RE_PreviewRender(Render *re, Main *bmain, Scene *sce) re->scene = sce; re->scene_color_manage = BKE_scene_check_color_management_enabled(sce); re->lay = sce->lay; - re->depsgraph = sce->depsgraph; + re->depsgraph = BKE_scene_get_depsgraph(sce, scene_layer); camera = RE_GetCamera(re); RE_SetCamera(re, camera); |