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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-06 13:07:27 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-16 20:55:33 +0300
commit34ab90f546f097cada951b2c9ca22bf271996980 (patch)
treeebcdb3d37120ac1d8fb16462b9104badd1800329 /source/blender/draw
parent0c495005dd83913864acb510c1d4194a2275dbb0 (diff)
Depsgraph: remove EvaluationContext, pass Depsgraph instead.
The depsgraph was always created within a fixed evaluation context. Passing both risks the depsgraph and evaluation context not matching, and it complicates the Python API where we'd have to expose both which is not so easy to understand. This also removes the global evaluation context in main, which assumed there to be a single active scene and view layer. Differential Revision: https://developer.blender.org/D3152
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/engines/eevee/eevee_motion_blur.c5
-rw-r--r--source/blender/draw/intern/DRW_render.h1
-rw-r--r--source/blender/draw/intern/draw_cache_impl_particles.c6
-rw-r--r--source/blender/draw/intern/draw_manager.c17
-rw-r--r--source/blender/draw/modes/sculpt_mode.c2
5 files changed, 8 insertions, 23 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.c b/source/blender/draw/engines/eevee/eevee_motion_blur.c
index 9b19163c8d7..4bac8ba2ebd 100644
--- a/source/blender/draw/engines/eevee/eevee_motion_blur.c
+++ b/source/blender/draw/engines/eevee/eevee_motion_blur.c
@@ -68,16 +68,13 @@ static void eevee_motion_blur_camera_get_matrix_at_time(
cam_cpy.data = &camdata_cpy;
const DRWContextState *draw_ctx = DRW_context_state_get();
- /* 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 */
/* FIXME : This is a temporal solution that does not take care of parent animations */
/* Recalc Anim manualy */
BKE_animsys_evaluate_animdata(scene, &cam_cpy.id, cam_cpy.adt, time, ADT_RECALC_ALL);
BKE_animsys_evaluate_animdata(scene, &camdata_cpy.id, camdata_cpy.adt, time, ADT_RECALC_ALL);
- BKE_object_where_is_calc_time(&eval_ctx, scene, &cam_cpy, time);
+ BKE_object_where_is_calc_time(draw_ctx->depsgraph, scene, &cam_cpy, time);
/* Compute winmat */
CameraParams params;
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 5e00005edb6..27f2d891cc0 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -507,7 +507,6 @@ typedef struct DRWContextState {
struct RenderEngineType *engine_type;
- EvaluationContext eval_ctx;
struct Depsgraph *depsgraph;
eObjectMode object_mode;
diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c
index 0530d05c199..d7e8a6b71df 100644
--- a/source/blender/draw/intern/draw_cache_impl_particles.c
+++ b/source/blender/draw/intern/draw_cache_impl_particles.c
@@ -46,6 +46,8 @@
#include "GPU_batch.h"
+#include "DEG_depsgraph_query.h"
+
#include "draw_cache_impl.h" /* own include */
static void particle_batch_cache_clear(ParticleSystem *psys);
@@ -466,7 +468,7 @@ static void particle_batch_cache_ensure_pos(Object *object, ParticleSystem *psys
ParticleSimulationData sim = {NULL};
const DRWContextState *draw_ctx = DRW_context_state_get();
- sim.eval_ctx = &draw_ctx->eval_ctx;
+ sim.depsgraph = draw_ctx->depsgraph;
sim.scene = draw_ctx->scene;
sim.ob = object;
sim.psys = psys;
@@ -494,7 +496,7 @@ static void particle_batch_cache_ensure_pos(Object *object, ParticleSystem *psys
GWN_vertbuf_data_alloc(cache->pos, psys->totpart);
for (curr_point = 0, i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) {
- state.time = draw_ctx->eval_ctx.ctime;
+ state.time = DEG_get_ctime(draw_ctx->depsgraph);
if (!psys_get_particle_state(&sim, curr_point, &state, 0)) {
continue;
}
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 420841e2efa..b77218ec6ff 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -350,16 +350,6 @@ 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,
- 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)
{
@@ -388,8 +378,6 @@ 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
@@ -1122,15 +1110,14 @@ void DRW_notify_id_update(const DRWUpdateContext *update_ctx, ID *id)
* for each relevant engine / mode engine. */
void DRW_draw_view(const bContext *C)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
RenderEngineType *engine_type = CTX_data_engine_type(C);
ARegion *ar = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
/* Reset before using it. */
drw_state_prepare_clean_for_draw(&DST);
- DRW_draw_render_loop_ex(eval_ctx.depsgraph, engine_type, ar, v3d, C);
+ DRW_draw_render_loop_ex(depsgraph, engine_type, ar, v3d, C);
}
/**
diff --git a/source/blender/draw/modes/sculpt_mode.c b/source/blender/draw/modes/sculpt_mode.c
index 65f4653591f..4fb4464df06 100644
--- a/source/blender/draw/modes/sculpt_mode.c
+++ b/source/blender/draw/modes/sculpt_mode.c
@@ -202,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(&draw_ctx->eval_ctx, scene, scene->toolsettings->sculpt, ob, false, false);
+ BKE_sculpt_update_mesh_elements(draw_ctx->depsgraph, scene, scene->toolsettings->sculpt, ob, false, false);
}
PBVH *pbvh = ob->sculpt->pbvh;