From 709ffd94eeca1f2f6f7e929128b5657665b2736c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 15 Mar 2018 15:18:16 +0100 Subject: [PATCH] Depsgraph: Fix missing shader updates with copy on write Basically, don't do full in-place copy of node tree datablock if it's already expanded. Current way how node tree is evaluated is fully built around the idea that evaluation copies values from original to copied datablocks. Changing links is handled on another level. --- .../intern/eval/deg_eval_copy_on_write.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index f9e99227337..5be95543801 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -870,6 +870,22 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, gpumaterial_ptr = &world->gpumaterial; break; } + case ID_NT: + { + /* Node trees should try to preserve their socket pointers + * as much as possible. This is due to UBOs code in GPU, + * which references sockets from trees. + * + * These flags CURRENTLY don't need full datablock update, + * everything is done by node tree update function which + * only copies socket values. + */ + const int ignore_flag = (ID_RECALC_DRAW | ID_RECALC_ANIMATION); + if ((id_cow->recalc & ~ignore_flag) == 0) { + return id_cow; + } + break; + } case ID_OB: { Object *object = (Object *)id_cow;