Merge branch 'blender-v2.93-release'

This commit is contained in:
Campbell Barton 2021-04-23 10:02:46 +10:00
commit 76fcf58cdd
3 changed files with 13 additions and 6 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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);
}