diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-01-15 16:16:44 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-01-15 16:16:44 +0400 |
commit | eaa9258449e4667b9a2a9764b7c8b9d64c7ff9ea (patch) | |
tree | a4bd8ed5a3ea9f2de2d7da57e1b6fe553a5ec733 | |
parent | da03cc338e061bc6bfd82344c693f698d640f82b (diff) |
Code cleanup: remove some remaining code from the old compositor.
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 3 | ||||
-rw-r--r-- | source/blender/nodes/composite/node_composite_tree.c | 87 | ||||
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_common.c | 175 | ||||
-rw-r--r-- | source/blender/nodes/intern/node_exec.c | 28 | ||||
-rw-r--r-- | source/blender/nodes/intern/node_exec.h | 2 |
6 files changed, 2 insertions, 295 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 0a2f757b38e..16d7ba8b090 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -737,8 +737,6 @@ void ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMateria /* API */ struct CompBuf; -struct bNodeTreeExec *ntreeCompositBeginExecTree(struct bNodeTree *ntree, int use_tree_data); -void ntreeCompositEndExecTree(struct bNodeTreeExec *exec, int use_tree_data); void ntreeCompositExecTree(struct bNodeTree *ntree, struct RenderData *rd, int rendering, int do_previews, const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings); void ntreeCompositTagRender(struct Scene *sce); diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 84e280034ed..c73bd5ef8fd 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1035,9 +1035,6 @@ void ntreeFreeTree_ex(bNodeTree *ntree, const short do_id_user) */ if (ntree->execdata) { switch (ntree->type) { - case NTREE_COMPOSIT: - ntreeCompositEndExecTree(ntree->execdata, 1); - break; case NTREE_SHADER: ntreeShaderEndExecTree(ntree->execdata, 1); break; diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 7004b722bc9..a6592b47e87 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -51,7 +51,6 @@ #include "BKE_tracking.h" #include "node_common.h" -#include "node_exec.h" #include "node_util.h" #include "PIL_time.h" @@ -268,92 +267,6 @@ bNodeTreeType ntreeType_Composite = { }; -/* XXX Group nodes must set use_tree_data to false, since their trees can be shared by multiple nodes. - * If use_tree_data is true, the ntree->execdata pointer is checked to avoid multiple execution of top-level trees. - */ -struct bNodeTreeExec *ntreeCompositBeginExecTree(bNodeTree *ntree, int use_tree_data) -{ - bNodeTreeExec *exec; - bNode *node; - bNodeSocket *sock; - - if (use_tree_data) { - /* XXX hack: prevent exec data from being generated twice. - * this should be handled by the renderer! - */ - if (ntree->execdata) - return ntree->execdata; - } - - /* ensures only a single output node is enabled */ - ntreeSetOutput(ntree); - - exec = ntree_exec_begin(ntree); - - for (node= exec->nodetree->nodes.first; node; node= node->next) { - /* initialize needed for groups */ - node->exec= 0; - - for (sock= node->outputs.first; sock; sock= sock->next) { - bNodeStack *ns= node_get_socket_stack(exec->stack, sock); - if (ns && sock->cache) { - ns->data= sock->cache; - sock->cache= NULL; - } - } - /* cannot initialize them while using in threads */ - if (ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT)) { - curvemapping_initialize(node->storage); - if (node->type==CMP_NODE_CURVE_RGB) - curvemapping_premultiply(node->storage, 0); - } - } - - if (use_tree_data) { - /* XXX this should not be necessary, but is still used for cmp/sha/tex nodes, - * which only store the ntree pointer. Should be fixed at some point! - */ - ntree->execdata = exec; - } - - return exec; -} - -/* XXX Group nodes must set use_tree_data to false, since their trees can be shared by multiple nodes. - * If use_tree_data is true, the ntree->execdata pointer is checked to avoid multiple execution of top-level trees. - */ -void ntreeCompositEndExecTree(bNodeTreeExec *exec, int use_tree_data) -{ - if (exec) { - bNodeTree *ntree= exec->nodetree; - bNode *node; - bNodeStack *ns; - - for (node= exec->nodetree->nodes.first; node; node= node->next) { - bNodeSocket *sock; - - for (sock= node->outputs.first; sock; sock= sock->next) { - ns = node_get_socket_stack(exec->stack, sock); - if (ns && ns->data) { - sock->cache= ns->data; - ns->data= NULL; - } - } - if (node->type==CMP_NODE_CURVE_RGB) - curvemapping_premultiply(node->storage, 1); - - node->need_exec= 0; - } - - ntree_exec_end(exec); - - if (use_tree_data) { - /* XXX clear nodetree backpointer to exec data, same problem as noted in ntreeBeginExecTree */ - ntree->execdata = NULL; - } - } -} - void *COM_linker_hack = NULL; void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int rendering, int do_preview, diff --git a/source/blender/nodes/composite/nodes/node_composite_common.c b/source/blender/nodes/composite/nodes/node_composite_common.c index 4307232a41e..835c2b75aa4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_common.c +++ b/source/blender/nodes/composite/nodes/node_composite_common.c @@ -38,179 +38,6 @@ #include "node_common.h" #include "node_exec.h" -#if 0 -static void PRINT_BUFFERS(bNodeTreeExec *exec) -{ - bNodeTree *ntree= exec->nodetree; - bNode *node; - bNodeSocket *sock; - bNodeStack *ns; - int i; - - printf("-------------- DEBUG --------------\n"); - for (sock=ntree->inputs.first, i=0; sock; sock=sock->next, ++i) { - ns = node_get_socket_stack(exec->stack, sock); - printf("%d. Tree Input %s", i, sock->name); - if (ns->external) - printf(" (external)"); - printf(": data=%p\n", ns->data); - } - for (sock=ntree->outputs.first, i=0; sock; sock=sock->next, ++i) { - ns = node_get_socket_stack(exec->stack, sock); - printf("%d. Tree Output %s", i, sock->name); - if (ns->external) - printf(" (external)"); - printf(": data=%p\n", ns->data); - } - for (node=ntree->nodes.first; node; node=node->next) { - printf("Node %s:\n", node->name); - for (sock=node->inputs.first, i=0; sock; sock=sock->next, ++i) { - ns = node_get_socket_stack(exec->stack, sock); - printf("\t%d. Input %s", i, sock->name); - if (ns->external) - printf(" (external)"); - printf(": data=%p\n", ns->data); - } - for (sock=node->outputs.first, i=0; sock; sock=sock->next, ++i) { - ns = node_get_socket_stack(exec->stack, sock); - printf("\t%d. Output %s", i, sock->name); - if (ns->external) - printf(" (external)"); - printf(": data=%p\n", ns->data); - } - } -} -#endif - -static void copy_stack(bNodeStack *to, bNodeStack *from) -{ - if (to != from) { - copy_v4_v4(to->vec, from->vec); - to->data = from->data; - to->datatype = from->datatype; - - /* tag as copy to prevent freeing */ - to->is_copy = 1; - } -} - -static void move_stack(bNodeStack *to, bNodeStack *from) -{ - if (to != from) { - copy_v4_v4(to->vec, from->vec); - to->data = from->data; - to->datatype = from->datatype; - to->is_copy = from->is_copy; - - zero_v4(from->vec); - from->data = NULL; - from->datatype = 0; - from->is_copy = 0; - } -} - -/**** GROUP ****/ - -static void *group_initexec(bNode *node) -{ - bNodeTree *ngroup = (bNodeTree *)node->id; - bNodeTreeExec *exec; - bNodeSocket *sock; - bNodeStack *ns; - - if (!ngroup) - return NULL; - - /* initialize the internal node tree execution */ - exec = ntreeCompositBeginExecTree(ngroup, 0); - - /* tag group outputs as external to prevent freeing */ - for (sock = ngroup->outputs.first; sock; sock = sock->next) { - if (!(sock->flag & SOCK_INTERNAL)) { - ns = node_get_socket_stack(exec->stack, sock); - ns->external = 1; - } - } - - return exec; -} - -static void group_freeexec(bNode *UNUSED(node), void *nodedata) -{ - bNodeTreeExec *gexec = (bNodeTreeExec *)nodedata; - - if (gexec) - ntreeCompositEndExecTree(gexec, 0); -} - -/* Copy inputs to the internal stack. - * This is a shallow copy, no buffers are duplicated here! - */ -static void group_copy_inputs(bNode *node, bNodeStack **in, bNodeStack *gstack) -{ - bNodeSocket *sock; - bNodeStack *ns; - int a; - for (sock=node->inputs.first, a=0; sock; sock=sock->next, ++a) { - if (sock->groupsock) { - ns = node_get_socket_stack(gstack, sock->groupsock); - copy_stack(ns, in[a]); - } - } -} - -/* Copy internal results to the external outputs. - */ -static void group_move_outputs(bNode *node, bNodeStack **out, bNodeStack *gstack) -{ - bNodeSocket *sock; - bNodeStack *ns; - int a; - for (sock = node->outputs.first, a = 0; sock; sock = sock->next, ++a) { - if (sock->groupsock) { - ns = node_get_socket_stack(gstack, sock->groupsock); - move_stack(out[a], ns); - } - } -} - -/* Free internal buffers */ -static void group_free_internal(bNodeTreeExec *gexec) -{ - bNodeStack *ns; - int i; - - for (i = 0, ns = gexec->stack; i < gexec->stacksize; ++i, ++ns) { - if (!ns->external && !ns->is_copy) { - if (ns->data) { - ns->data = NULL; - } - } - } -} - -static void group_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out) -{ - bNodeTreeExec *exec= (bNodeTreeExec *)nodedata; - - if (!exec) - return; - - /* XXX same behavior as trunk: all nodes inside group are executed. - * it's stupid, but just makes it work. compo redesign will do this better. - */ - { - bNode *inode; - for (inode=exec->nodetree->nodes.first; inode; inode=inode->next) - inode->need_exec = 1; - } - - group_copy_inputs(node, in, exec->stack); - ntreeExecNodes(exec, data, thread); - group_free_internal(exec); - group_move_outputs(node, out, exec->stack); -} - void register_node_type_cmp_group(bNodeTreeType *ttype) { static bNodeType ntype; @@ -224,7 +51,7 @@ void register_node_type_cmp_group(bNodeTreeType *ttype) node_type_template(&ntype, node_group_template); node_type_update(&ntype, NULL, node_group_verify); node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear); - node_type_exec_new(&ntype, group_initexec, group_freeexec, group_execute); nodeRegisterType(ttype, &ntype); } + diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c index 86f8f4dfbbf..1889fd9a38e 100644 --- a/source/blender/nodes/intern/node_exec.c +++ b/source/blender/nodes/intern/node_exec.c @@ -258,7 +258,7 @@ void ntree_exec_end(bNodeTreeExec *exec) MEM_freeN(exec); } -/**** Compositor/Material/Texture trees ****/ +/**** Material/Texture trees ****/ bNodeThreadStack *ntreeGetThreadStack(bNodeTreeExec *exec, int thread) { @@ -287,32 +287,6 @@ void ntreeReleaseThreadStack(bNodeThreadStack *nts) nts->used = 0; } -void ntreeExecNodes(bNodeTreeExec *exec, void *callerdata, int thread) -{ - bNodeStack *nsin[MAX_SOCKET]; /* arbitrary... watch this */ - bNodeStack *nsout[MAX_SOCKET]; /* arbitrary... watch this */ - bNodeExec *nodeexec; - bNode *node; - int n; - - /* nodes are presorted, so exec is in order of list */ - - for (n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) { - node = nodeexec->node; - if (node->need_exec) { - node_get_stack(node, exec->stack, nsin, nsout); - /* Handle muted nodes... - * If the mute func is not set, assume the node should never be muted, - * and hence execute it! - */ - if (node->typeinfo->execfunc) - node->typeinfo->execfunc(callerdata, node, nsin, nsout); - else if (node->typeinfo->newexecfunc) - node->typeinfo->newexecfunc(callerdata, thread, node, nodeexec->data, nsin, nsout); - } - } -} - void ntreeExecThreadNodes(bNodeTreeExec *exec, bNodeThreadStack *nts, void *callerdata, int thread) { bNodeStack *nsin[MAX_SOCKET]; /* arbitrary... watch this */ diff --git a/source/blender/nodes/intern/node_exec.h b/source/blender/nodes/intern/node_exec.h index e985795de71..92ab0813bb1 100644 --- a/source/blender/nodes/intern/node_exec.h +++ b/source/blender/nodes/intern/node_exec.h @@ -77,8 +77,6 @@ void node_get_stack(struct bNode *node, struct bNodeStack *stack, struct bNodeSt struct bNodeTreeExec *ntree_exec_begin(struct bNodeTree *ntree); void ntree_exec_end(struct bNodeTreeExec *exec); -void ntreeExecNodes(struct bNodeTreeExec *exec, void *callerdata, int thread); - struct bNodeThreadStack *ntreeGetThreadStack(struct bNodeTreeExec *exec, int thread); void ntreeReleaseThreadStack(struct bNodeThreadStack *nts); void ntreeExecThreadNodes(struct bNodeTreeExec *exec, struct bNodeThreadStack *nts, void *callerdata, int thread); |