diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_motion_blur.c | 15 | ||||
-rw-r--r-- | source/blender/draw/intern/DRW_render.h | 3 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 13 | ||||
-rw-r--r-- | source/blender/draw/modes/sculpt_mode.c | 6 |
4 files changed, 19 insertions, 18 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.c b/source/blender/draw/engines/eevee/eevee_motion_blur.c index 5a562cc49e0..9b19163c8d7 100644 --- a/source/blender/draw/engines/eevee/eevee_motion_blur.c +++ b/source/blender/draw/engines/eevee/eevee_motion_blur.c @@ -59,7 +59,6 @@ static void eevee_motion_blur_camera_get_matrix_at_time( float time, float r_mat[4][4]) { - EvaluationContext eval_ctx; float obmat[4][4]; /* HACK */ @@ -68,19 +67,9 @@ static void eevee_motion_blur_camera_get_matrix_at_time( memcpy(&camdata_cpy, camera->data, sizeof(camdata_cpy)); cam_cpy.data = &camdata_cpy; - /* NOTE: Mode corresponds to old usage of eval_ctx from viewport (which was - * actually coming from bmain). It was always DAG_EVAL_VIEWPORT. For F12 - * render this should be DAG_EVAL_RENDER, but the whole hack is to be - * reconsidered first anyway. - */ const DRWContextState *draw_ctx = DRW_context_state_get(); - DEG_evaluation_context_init_from_scene( - &eval_ctx, - scene, - draw_ctx->view_layer, - draw_ctx->engine_type, - draw_ctx->object_mode, - DAG_EVAL_VIEWPORT); + /* We will be modifying time, so we create copy of eval_ctx. */ + EvaluationContext eval_ctx = draw_ctx->eval_ctx; eval_ctx.ctime = time; /* Past matrix */ diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index dc2e61b564b..60e855108f9 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -57,6 +57,8 @@ #include "RE_engine.h" +#include "DEG_depsgraph.h" + struct rcti; struct bContext; struct GPUFrameBuffer; @@ -504,6 +506,7 @@ typedef struct DRWContextState { struct RenderEngineType *engine_type; + EvaluationContext eval_ctx; struct Depsgraph *depsgraph; eObjectMode object_mode; diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 7bfb558e471..282b8048cf3 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -346,6 +346,17 @@ static void drw_viewport_cache_resize(void) DRW_instance_data_list_resize(DST.idatalist); } +static void drw_state_eval_ctx_init(DRWManager *dst) +{ + DRWContextState *draw_ctx = &dst->draw_ctx; + DEG_evaluation_context_init_from_scene( + &draw_ctx->eval_ctx, + draw_ctx->scene, + draw_ctx->view_layer, + draw_ctx->engine_type, + draw_ctx->object_mode, + DST.options.is_scene_render ? DAG_EVAL_RENDER : DAG_EVAL_VIEWPORT); +} /* Not a viewport variable, we could split this out. */ static void drw_context_state_init(void) @@ -368,6 +379,8 @@ static void drw_context_state_init(void) else { DST.draw_ctx.object_pose = NULL; } + + drw_state_eval_ctx_init(&DST); } /* It also stores viewport variable to an immutable place: DST diff --git a/source/blender/draw/modes/sculpt_mode.c b/source/blender/draw/modes/sculpt_mode.c index d8c5bae522b..65f4653591f 100644 --- a/source/blender/draw/modes/sculpt_mode.c +++ b/source/blender/draw/modes/sculpt_mode.c @@ -193,12 +193,8 @@ static void SCULPT_cache_populate(void *vedata, Object *ob) if (ob->type == OB_MESH) { const DRWContextState *draw_ctx = DRW_context_state_get(); - EvaluationContext eval_ctx; - - CTX_data_eval_ctx(draw_ctx->evil_C, &eval_ctx); if (ob->sculpt && (ob == draw_ctx->obact)) { - /* XXX, needed for dyntopo-undo (which clears). * probably depsgraph should handlle? in 2.7x getting derived-mesh does this (mesh_build_data) */ if (ob->sculpt->pbvh == NULL) { @@ -206,7 +202,7 @@ static void SCULPT_cache_populate(void *vedata, Object *ob) * but this avoids waiting on first stroke) */ Scene *scene = draw_ctx->scene; - BKE_sculpt_update_mesh_elements(&eval_ctx, scene, scene->toolsettings->sculpt, ob, false, false); + BKE_sculpt_update_mesh_elements(&draw_ctx->eval_ctx, scene, scene->toolsettings->sculpt, ob, false, false); } PBVH *pbvh = ob->sculpt->pbvh; |