2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version 2
5 * of the License, or (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software Foundation,
14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * The Original Code is Copyright (C) 2007 Blender Foundation.
17 * All rights reserved.
26 #include "DNA_listBase.h"
28 #include "BLI_utildefines.h"
32 #include "node_util.h"
34 #include "RNA_types.h"
44 /* Node execution data */
45 typedef struct bNodeExec {
46 /** Backpointer to node. */
50 /** Free function, stored in exec itself to avoid dangling node pointer access. */
51 NodeFreeExecFunction freeexecfunc;
54 /* Execution Data for each instance of node tree execution */
55 typedef struct bNodeTreeExec {
56 struct bNodeTree *nodetree; /* backpointer to node tree */
58 int totnodes; /* total node count */
59 struct bNodeExec *nodeexec; /* per-node execution data */
62 struct bNodeStack *stack; /* socket data stack */
63 /* only used by material and texture trees to keep one stack for each thread */
64 ListBase *threadstack; /* one instance of the stack for each thread */
67 /* stores one stack copy for each thread (material and texture trees) */
68 typedef struct bNodeThreadStack {
69 struct bNodeThreadStack *next, *prev;
70 struct bNodeStack *stack;
74 int node_exec_socket_use_stack(struct bNodeSocket *sock);
76 struct bNodeStack *node_get_socket_stack(struct bNodeStack *stack, struct bNodeSocket *sock);
77 void node_get_stack(struct bNode *node,
78 struct bNodeStack *stack,
79 struct bNodeStack **in,
80 struct bNodeStack **out);
82 struct bNodeTreeExec *ntree_exec_begin(struct bNodeExecContext *context,
83 struct bNodeTree *ntree,
84 bNodeInstanceKey parent_key);
85 void ntree_exec_end(struct bNodeTreeExec *exec);
87 struct bNodeThreadStack *ntreeGetThreadStack(struct bNodeTreeExec *exec, int thread);
88 void ntreeReleaseThreadStack(struct bNodeThreadStack *nts);
89 bool ntreeExecThreadNodes(struct bNodeTreeExec *exec,
90 struct bNodeThreadStack *nts,
94 struct bNodeTreeExec *ntreeShaderBeginExecTree_internal(struct bNodeExecContext *context,
95 struct bNodeTree *ntree,
96 bNodeInstanceKey parent_key);
97 void ntreeShaderEndExecTree_internal(struct bNodeTreeExec *exec);
99 struct bNodeTreeExec *ntreeTexBeginExecTree_internal(struct bNodeExecContext *context,
100 struct bNodeTree *ntree,
101 bNodeInstanceKey parent_key);
102 void ntreeTexEndExecTree_internal(struct bNodeTreeExec *exec);