[Bf-blender-cvs] [89fa6a7a063] master: Fix T60900, T61111, T61963: node values stuck after clearing keyframes.

Brecht Van Lommel noreply at git.blender.org
Fri Mar 8 15:16:30 CET 2019


Commit: 89fa6a7a063e74604c14aedef9b88599249e3a29
Author: Brecht Van Lommel
Date:   Fri Mar 8 14:59:33 2019 +0100
Branches: master
https://developer.blender.org/rB89fa6a7a063e74604c14aedef9b88599249e3a29

Fix T60900, T61111, T61963: node values stuck after clearing keyframes.

This removes special dependency graph code that was intended to avoid GPU
shader recompiles by preserving the node tree and GPU material in specific
cases. This is no longer needed now that we have a general shader pass
cache that compares the generated shader code. The GPU material is already
being freed in material and world eval as well, so there's no point.

Note also that GPU materials are now safe to free from threads, actual
OpenGL buffer freeing happens delayed.

===================================================================

M	source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc

===================================================================

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 27c5bb89ba9..6e2b401a09e 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
@@ -838,23 +838,6 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
 	                                          create_placeholders);
 }
 
-static void deg_update_copy_on_write_animation(const Depsgraph *depsgraph,
-                                               const IDNode *id_node)
-{
-	DEG_debug_print_eval((::Depsgraph *)depsgraph,
-	                     __func__,
-	                     id_node->id_orig->name,
-	                     id_node->id_cow);
-	BKE_animdata_copy_id(NULL, id_node->id_cow, id_node->id_orig, LIB_ID_CREATE_NO_USER_REFCOUNT);
-	RemapCallbackUserData user_data = {NULL};
-	user_data.depsgraph = depsgraph;
-	BKE_library_foreach_ID_link(NULL,
-	                            id_node->id_cow,
-	                            foreach_libblock_remap_callback,
-	                            (void *)&user_data,
-	                            IDWALK_NOP);
-}
-
 typedef struct ObjectRuntimeBackup {
 	Object_Runtime runtime;
 	short base_flag;
@@ -937,50 +920,18 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
 	 * - Free previously expanded data, if any.
 	 * - Perform full datablock copy.
 	 *
-	 * Note that we never free GPU materials from here since that's not
-	 * safe for threading and GPU materials are likely to be re-used. */
+	 * Note that we never free GPU draw data from here since that's not
+	 * safe for threading and draw data is likely to be re-used. */
 	/* TODO(sergey): Either move this to an utility function or redesign
 	 * Copy-on-Write components in a way that only needed parts are being
 	 * copied over. */
-	/* TODO(sergey): Wrap GPU material backup and object runtime backup to a
+	/* TODO(sergey): Wrap GPU draw data backup and object runtime backup to a
 	 * generic backup structure. */
-	ListBase gpumaterial_backup;
-	ListBase *gpumaterial_ptr = NULL;
 	DrawDataList drawdata_backup;
 	DrawDataList *drawdata_ptr = NULL;
 	ObjectRuntimeBackup object_runtime_backup = {{0}};
 	if (check_datablock_expanded(id_cow)) {
 		switch (id_type) {
-			case ID_MA:
-			{
-				Material *material = (Material *)id_cow;
-				gpumaterial_ptr = &material->gpumaterial;
-				break;
-			}
-			case ID_WO:
-			{
-				World *world = (World *)id_cow;
-				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_SHADING |
-				                         ID_RECALC_ANIMATION |
-				                         ID_RECALC_COPY_ON_WRITE);
-				if ((id_cow->recalc & ~ignore_flag) == 0) {
-					deg_update_copy_on_write_animation(depsgraph, id_node);
-					return id_cow;
-				}
-				break;
-			}
 			case ID_OB:
 			{
 				Object *ob = (Object *)id_cow;
@@ -990,10 +941,6 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
 			default:
 				break;
 		}
-		if (gpumaterial_ptr != NULL) {
-			gpumaterial_backup = *gpumaterial_ptr;
-			gpumaterial_ptr->first = gpumaterial_ptr->last = NULL;
-		}
 		drawdata_ptr = DRW_drawdatalist_from_id(id_cow);
 		if (drawdata_ptr != NULL) {
 			drawdata_backup = *drawdata_ptr;
@@ -1002,10 +949,6 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
 	}
 	deg_free_copy_on_write_datablock(id_cow);
 	deg_expand_copy_on_write_datablock(depsgraph, id_node);
-	/* Restore GPU materials. */
-	if (gpumaterial_ptr != NULL) {
-		*gpumaterial_ptr = gpumaterial_backup;
-	}
 	/* Restore DrawData. */
 	if (drawdata_ptr != NULL) {
 		*drawdata_ptr = drawdata_backup;



More information about the Bf-blender-cvs mailing list