[Bf-blender-cvs] [3126f85d264] blender2.8: Fix T55062: Depsgraph: Crash with COW with EEVEE viewport

Dalai Felinto noreply at git.blender.org
Thu Jun 7 12:56:59 CEST 2018

Commit: 3126f85d26448d7e8698724a563e0f5a08f4f34f
Author: Dalai Felinto
Date:   Thu Jun 7 12:47:16 2018 +0200
Branches: blender2.8

Fix T55062: Depsgraph: Crash with COW with EEVEE viewport

We now remove the shader for every update.

So at the moment the whole point of UBO (Uniform Buffer Objects) is that they
are more efficient than individual uniforms.

Next steps is a harmless refactor to stopping UBO from referring to original
data in the UBO, and simply copying it.

It would also be interesting to make the final shader more granular as far as
the library and required functions are concerned. Even if this doesn't impact
performance, it should give us smaller easy to debug shaders
(a simple shader now has > 5k lines!).

If performance for animated values is measureable slower after this commit we
can port the shader creation CPU side to the depsgraph - localizing the tree,
hashing, lookup, ...

Additionally we can stick to update the UBO when the material changes but not
its topology. This is very trick because of localized trees. So we will only
re-visit this if profiling hints at any benefit from it.


M	source/blender/makesrna/intern/rna_nodetree.c


diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 9cb5b2d40d2..4f928a9a831 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -2307,31 +2307,13 @@ static void rna_NodeSocketStandard_vector_range(PointerRNA *ptr, float *min, flo
 	*softmax = dval->max;
-static void rna_NodeSocket_value_update(Main *bmain, Scene *scene, PointerRNA *ptr)
-	bNodeTree *ntree = (bNodeTree *)ptr->id.data;
-	bNodeSocket *sock = ptr->data;
-	if (ntree->type == NTREE_SHADER) {
-		DEG_id_tag_update_ex(bmain, &ntree->id, DEG_TAG_SHADING_UPDATE);
-		WM_main_add_notifier(NC_MATERIAL | ND_SHADING, NULL);
-		if (sock->type == SOCK_STRING) {
-			rna_NodeSocket_update(bmain, scene, ptr);
-		}
-	}
-	else {
-		rna_NodeSocket_update(bmain, scene, ptr);
-	}
 /* using a context update function here, to avoid searching the node if possible */
 static void rna_NodeSocketStandard_value_update(struct bContext *C, PointerRNA *ptr)
 	bNode *node;
 	/* default update */
-	rna_NodeSocket_value_update(CTX_data_main(C), CTX_data_scene(C), ptr);
+	rna_NodeSocket_update(CTX_data_main(C), CTX_data_scene(C), ptr);
 	/* try to use node from context, faster */
 	node = CTX_data_pointer_get(C, "node").data;

More information about the Bf-blender-cvs mailing list