Cleanup: Remove unused node socket cache handling

This cache was never written to, only "copied" between sockets in one
case, it dates back at least a decade. It doesn't make sense to store
caches on node trees directly anyway, since they can be used in
multiple places.
This commit is contained in:
Hans Goudey 2022-11-30 13:25:06 -06:00
parent 31b3b07ad7
commit db1728096a
7 changed files with 0 additions and 63 deletions

View File

@ -405,8 +405,6 @@ typedef struct bNodeTreeType {
int ui_icon;
/* callbacks */
void (*free_cache)(struct bNodeTree *ntree);
void (*free_node_cache)(struct bNodeTree *ntree, struct bNode *node);
/* Iteration over all node classes. */
void (*foreach_nodeclass)(struct Scene *scene, void *calldata, bNodeClassCallback func);
/* Check visibility in the node editor */
@ -521,8 +519,6 @@ void ntreeUpdateAllUsers(struct Main *main, struct ID *id);
*/
void ntreeSetOutput(struct bNodeTree *ntree);
void ntreeFreeCache(struct bNodeTree *ntree);
void ntreeNodeFlagSet(const bNodeTree *ntree, int flag, bool enable);
/**
* Returns localized tree for execution in threads.

View File

@ -133,9 +133,6 @@ class bNodeSocketRuntime : NonCopyable, NonMovable {
/* Runtime-only cache of the number of input links, for multi-input sockets. */
short total_inputs = 0;
/** Cached data from execution. */
void *cache = nullptr;
/** Only valid when #topology_cache_is_dirty is false. */
Vector<bNodeLink *> directly_linked_links;
Vector<bNodeSocket *> directly_linked_sockets;

View File

@ -2234,9 +2234,6 @@ static void node_socket_copy(bNodeSocket *sock_dst, const bNodeSocket *sock_src,
MEM_dupallocN(sock_src->default_attribute_name));
sock_dst->stack_index = 0;
/* XXX some compositor nodes (e.g. image, render layers) still store
* some persistent buffer data here, need to clear this to avoid dangling pointers. */
sock_dst->runtime->cache = nullptr;
}
namespace blender::bke {
@ -2923,10 +2920,6 @@ static void node_free_node(bNodeTree *ntree, bNode *node)
if (ntree) {
BLI_remlink(&ntree->nodes, node);
if (ntree->typeinfo->free_node_cache) {
ntree->typeinfo->free_node_cache(ntree, node);
}
/* texture node has bad habit of keeping exec data around */
if (ntree->type == NTREE_TEXTURE && ntree->runtime->execdata) {
ntreeTexEndExecTree(ntree->runtime->execdata);
@ -3107,17 +3100,6 @@ void ntreeFreeLocalTree(bNodeTree *ntree)
}
}
void ntreeFreeCache(bNodeTree *ntree)
{
if (ntree == nullptr) {
return;
}
if (ntree->typeinfo->free_cache) {
ntree->typeinfo->free_cache(ntree);
}
}
void ntreeSetOutput(bNodeTree *ntree)
{
/* find the active outputs, might become tree type dependent handler */

View File

@ -889,9 +889,6 @@ static void node_group_make_insert_selected(const bContext &C, bNodeTree &ntree,
}
}
/* node groups don't use internal cached data */
ntreeFreeCache(ngroup);
/* create input node */
bNode *input_node = nodeAddStaticNode(&C, ngroup, NODE_GROUP_INPUT);
input_node->locx = real_min[0] - center[0] - offsetx;

View File

@ -62,22 +62,6 @@ static void foreach_nodeclass(Scene * /*scene*/, void *calldata, bNodeClassCallb
func(calldata, NODE_CLASS_LAYOUT, N_("Layout"));
}
static void free_node_cache(bNodeTree * /*ntree*/, bNode *node)
{
LISTBASE_FOREACH (bNodeSocket *, sock, &node->outputs) {
if (sock->runtime->cache) {
sock->runtime->cache = nullptr;
}
}
}
static void free_cache(bNodeTree *ntree)
{
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
free_node_cache(ntree, node);
}
}
/* local tree then owns all compbufs */
static void localize(bNodeTree *localtree, bNodeTree *ntree)
{
@ -137,14 +121,6 @@ static void local_merge(Main *bmain, bNodeTree *localtree, bNodeTree *ntree)
orig_node->storage = BKE_tracking_distortion_copy((MovieDistortion *)lnode->storage);
}
}
for (lsock = (bNodeSocket *)lnode->outputs.first; lsock; lsock = lsock->next) {
if (bNodeSocket *orig_socket = nodeFindSocket(orig_node, SOCK_OUT, lsock->identifier)) {
orig_socket->runtime->cache = lsock->runtime->cache;
lsock->runtime->cache = nullptr;
orig_socket = nullptr;
}
}
}
}
}
@ -186,8 +162,6 @@ void register_node_tree_type_cmp()
tt->ui_icon = ICON_NODE_COMPOSITING;
strcpy(tt->ui_description, N_("Compositing nodes"));
tt->free_cache = free_cache;
tt->free_node_cache = free_node_cache;
tt->foreach_nodeclass = foreach_nodeclass;
tt->localize = localize;
tt->local_merge = local_merge;

View File

@ -22,12 +22,6 @@ bool cmp_node_poll_default(bNodeType * /*ntype*/, bNodeTree *ntree, const char *
void cmp_node_update_default(bNodeTree * /*ntree*/, bNode *node)
{
LISTBASE_FOREACH (bNodeSocket *, sock, &node->outputs) {
if (sock->runtime->cache) {
// free_compbuf(sock->cache);
// sock->cache = nullptr;
}
}
node->runtime->need_exec = 1;
}

View File

@ -1115,9 +1115,6 @@ static void do_render_compositor(Render *re)
int update_newframe = 0;
if (compositor_needs_render(re->pipeline_scene_eval, 1)) {
/* save memory... free all cached images */
ntreeFreeCache(ntree);
/* render the frames
* it could be optimized to render only the needed view
* but what if a scene has a different number of views