diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-04-23 03:02:46 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-04-23 03:02:46 +0300 |
commit | 76fcf58cdd894d99eb57690e72e774e7dd1faf20 (patch) | |
tree | 2aef7c189dcc59d12b2110e153257012405bd2f8 /source/blender | |
parent | 47892d6695bc9a8e3fab012c3ba4005a2cb4a767 (diff) | |
parent | a23e49c696cf9ac66ecb9c1ad009d38b0a5e9f9f (diff) |
Merge branch 'blender-v2.93-release'
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.cc | 5 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.h | 5 | ||||
-rw-r--r-- | source/blender/render/intern/engine.c | 9 |
3 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.cc index 7a0c1b5b693..0064240db23 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.cc @@ -33,6 +33,7 @@ namespace blender::deg { RuntimeBackup::RuntimeBackup(const Depsgraph *depsgraph) : have_backup(false), + id_data({.py_instance = nullptr}), animation_backup(depsgraph), scene_backup(depsgraph), sound_backup(depsgraph), @@ -51,6 +52,8 @@ void RuntimeBackup::init_from_id(ID *id) } have_backup = true; + id_data.py_instance = id->py_instance; + animation_backup.init_from_id(id); const ID_Type id_type = GS(id->name); @@ -89,6 +92,8 @@ void RuntimeBackup::restore_to_id(ID *id) return; } + id->py_instance = id_data.py_instance; + animation_backup.restore_to_id(id); const ID_Type id_type = GS(id->name); diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.h b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.h index c6249c83daa..0629dbe62b4 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.h +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.h @@ -58,6 +58,11 @@ class RuntimeBackup { * copy-on-write mechanism. */ bool have_backup; + /* Struct members of the ID pointer. */ + struct { + void *py_instance; + } id_data; + AnimationBackup animation_backup; SceneBackup scene_backup; SoundBackup sound_backup; diff --git a/source/blender/render/intern/engine.c b/source/blender/render/intern/engine.c index 817f09f5bfe..66d38eb19c7 100644 --- a/source/blender/render/intern/engine.c +++ b/source/blender/render/intern/engine.c @@ -143,12 +143,9 @@ RenderEngine *RE_engine_create(RenderEngineType *type) static void engine_depsgraph_free(RenderEngine *engine) { if (engine->depsgraph) { - /* Need GPU context since this might free GPU buffers. This function can - * only be called from a render thread. We do not currently support - * persistent data with GPU contexts for that reason. */ + /* Need GPU context since this might free GPU buffers. */ const bool use_gpu_context = (engine->type->flag & RE_USE_GPU_CONTEXT); if (use_gpu_context) { - BLI_assert(!BLI_thread_is_main()); DRW_render_context_enable(engine->re); } @@ -623,8 +620,8 @@ RenderData *RE_engine_get_render_data(Render *re) bool RE_engine_use_persistent_data(RenderEngine *engine) { - /* See engine_depsgraph_free() for why preserving the depsgraph for - * re-renders is not supported with GPU contexts. */ + /* Re-rendering is not supported with GPU contexts, since the GPU context + * is destroyed when the render thread exists. */ return (engine->re->r.mode & R_PERSISTENT_DATA) && !(engine->type->flag & RE_USE_GPU_CONTEXT); } |