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.
This commit is contained in:
parent
d1474371fa
commit
3126f85d26
Notes:
blender-bot
2023-02-14 05:52:29 +01:00
Referenced by issue #55062, Depsgraph: Crash with COW with EEVEE viewport
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue