Cleanup: move some data from bNodeTree to run-time data
No functional changes are expected.
This commit is contained in:
@@ -46,6 +46,30 @@ class bNodeTreeRuntime : NonCopyable, NonMovable {
|
||||
*/
|
||||
uint8_t runtime_flag = 0;
|
||||
|
||||
/** Flag to prevent re-entrant update calls. */
|
||||
short is_updating = 0;
|
||||
/** Generic temporary flag for recursion check (DFS/BFS). */
|
||||
short done = 0;
|
||||
|
||||
/** Execution data.
|
||||
*
|
||||
* XXX It would be preferable to completely move this data out of the underlying node tree,
|
||||
* so node tree execution could finally run independent of the tree itself.
|
||||
* This would allow node trees to be merely linked by other data (materials, textures, etc.),
|
||||
* as ID data is supposed to.
|
||||
* Execution data is generated from the tree once at execution start and can then be used
|
||||
* as long as necessary, even while the tree is being modified.
|
||||
*/
|
||||
struct bNodeTreeExec *execdata = nullptr;
|
||||
|
||||
/* Callbacks. */
|
||||
void (*progress)(void *, float progress) = nullptr;
|
||||
/** \warning may be called by different threads */
|
||||
void (*stats_draw)(void *, const char *str) = nullptr;
|
||||
bool (*test_break)(void *) = nullptr;
|
||||
void (*update_draw)(void *) = nullptr;
|
||||
void *tbh = nullptr, *prh = nullptr, *sdh = nullptr, *udh = nullptr;
|
||||
|
||||
/** Information about how inputs and outputs of the node group interact with fields. */
|
||||
std::unique_ptr<nodes::FieldInferencingInterface> field_inferencing_interface;
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ static void ntree_copy_data(Main * /*bmain*/, ID *id_dst, const ID *id_src, cons
|
||||
ntree_dst->runtime = MEM_new<bNodeTreeRuntime>(__func__);
|
||||
|
||||
/* in case a running nodetree is copied */
|
||||
ntree_dst->execdata = nullptr;
|
||||
ntree_dst->runtime->execdata = nullptr;
|
||||
|
||||
BLI_listbase_clear(&ntree_dst->nodes);
|
||||
BLI_listbase_clear(&ntree_dst->links);
|
||||
@@ -225,14 +225,14 @@ static void ntree_free_data(ID *id)
|
||||
* This should be removed when old tree types no longer require it.
|
||||
* Currently the execution data for texture nodes remains in the tree
|
||||
* after execution, until the node tree is updated or freed. */
|
||||
if (ntree->execdata) {
|
||||
if (ntree->runtime->execdata) {
|
||||
switch (ntree->type) {
|
||||
case NTREE_SHADER:
|
||||
ntreeShaderEndExecTree(ntree->execdata);
|
||||
ntreeShaderEndExecTree(ntree->runtime->execdata);
|
||||
break;
|
||||
case NTREE_TEXTURE:
|
||||
ntreeTexEndExecTree(ntree->execdata);
|
||||
ntree->execdata = nullptr;
|
||||
ntreeTexEndExecTree(ntree->runtime->execdata);
|
||||
ntree->runtime->execdata = nullptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -615,10 +615,8 @@ static void ntree_blend_write(BlendWriter *writer, ID *id, const void *id_addres
|
||||
bNodeTree *ntree = (bNodeTree *)id;
|
||||
|
||||
/* Clean up, important in undo case to reduce false detection of changed datablocks. */
|
||||
ntree->is_updating = false;
|
||||
ntree->typeinfo = nullptr;
|
||||
ntree->progress = nullptr;
|
||||
ntree->execdata = nullptr;
|
||||
ntree->runtime->execdata = nullptr;
|
||||
|
||||
BLO_write_id_struct(writer, bNodeTree, id_address, &ntree->id);
|
||||
|
||||
@@ -668,11 +666,8 @@ void ntreeBlendReadData(BlendDataReader *reader, ID *owner_id, bNodeTree *ntree)
|
||||
ntree->owner_id = owner_id;
|
||||
|
||||
/* NOTE: writing and reading goes in sync, for speed. */
|
||||
ntree->is_updating = false;
|
||||
ntree->typeinfo = nullptr;
|
||||
|
||||
ntree->progress = nullptr;
|
||||
ntree->execdata = nullptr;
|
||||
ntree->runtime = MEM_new<bNodeTreeRuntime>(__func__);
|
||||
BKE_ntree_update_tag_missing_runtime_data(ntree);
|
||||
|
||||
@@ -2949,9 +2944,9 @@ static void node_free_node(bNodeTree *ntree, bNode *node)
|
||||
}
|
||||
|
||||
/* texture node has bad habit of keeping exec data around */
|
||||
if (ntree->type == NTREE_TEXTURE && ntree->execdata) {
|
||||
ntreeTexEndExecTree(ntree->execdata);
|
||||
ntree->execdata = nullptr;
|
||||
if (ntree->type == NTREE_TEXTURE && ntree->runtime->execdata) {
|
||||
ntreeTexEndExecTree(ntree->runtime->execdata);
|
||||
ntree->runtime->execdata = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_texture.h"
|
||||
|
||||
@@ -85,8 +86,8 @@ static void texture_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const i
|
||||
texture_dst->coba = static_cast<ColorBand *>(MEM_dupallocN(texture_dst->coba));
|
||||
}
|
||||
if (texture_src->nodetree) {
|
||||
if (texture_src->nodetree->execdata) {
|
||||
ntreeTexEndExecTree(texture_src->nodetree->execdata);
|
||||
if (texture_src->nodetree->runtime->execdata) {
|
||||
ntreeTexEndExecTree(texture_src->nodetree->runtime->execdata);
|
||||
}
|
||||
|
||||
if (is_localized) {
|
||||
|
||||
@@ -294,7 +294,7 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
|
||||
if (width_ == 0 || height_ == 0) {
|
||||
return;
|
||||
} /** \note Break out... no pixels to calculate. */
|
||||
if (bTree->test_break && bTree->test_break(bTree->tbh)) {
|
||||
if (bTree->runtime->test_break && bTree->runtime->test_break(bTree->runtime->tbh)) {
|
||||
return;
|
||||
} /** \note Early break out for blur and preview nodes. */
|
||||
if (chunks_len_ == 0) {
|
||||
@@ -335,8 +335,8 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
|
||||
start_evaluated = true;
|
||||
number_evaluated++;
|
||||
|
||||
if (bTree->update_draw) {
|
||||
bTree->update_draw(bTree->udh);
|
||||
if (bTree->runtime->update_draw) {
|
||||
bTree->runtime->update_draw(bTree->runtime->udh);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -356,7 +356,7 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
|
||||
|
||||
WorkScheduler::finish();
|
||||
|
||||
if (bTree->test_break && bTree->test_break(bTree->tbh)) {
|
||||
if (bTree->runtime->test_break && bTree->runtime->test_break(bTree->runtime->tbh)) {
|
||||
breaked = true;
|
||||
}
|
||||
}
|
||||
@@ -414,12 +414,12 @@ void ExecutionGroup::finalize_chunk_execution(int chunk_number, MemoryBuffer **m
|
||||
/* Status report is only performed for top level Execution Groups. */
|
||||
float progress = chunks_finished_;
|
||||
progress /= chunks_len_;
|
||||
bTree_->progress(bTree_->prh, progress);
|
||||
bTree_->runtime->progress(bTree_->runtime->prh, progress);
|
||||
|
||||
char buf[128];
|
||||
BLI_snprintf(
|
||||
buf, sizeof(buf), TIP_("Compositing | Tile %u-%u"), chunks_finished_, chunks_len_);
|
||||
bTree_->stats_draw(bTree_->sdh, buf);
|
||||
bTree_->runtime->stats_draw(bTree_->runtime->sdh, buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ void ExecutionSystem::execute_work(const rcti &work_rect,
|
||||
bool ExecutionSystem::is_breaked() const
|
||||
{
|
||||
const bNodeTree *btree = context_.get_bnodetree();
|
||||
return btree->test_break(btree->tbh);
|
||||
return btree->runtime->test_break(btree->runtime->tbh);
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -32,7 +32,8 @@ FullFrameExecutionModel::FullFrameExecutionModel(CompositorContext &context,
|
||||
void FullFrameExecutionModel::execute(ExecutionSystem &exec_system)
|
||||
{
|
||||
const bNodeTree *node_tree = this->context_.get_bnodetree();
|
||||
node_tree->stats_draw(node_tree->sdh, TIP_("Compositing | Initializing execution"));
|
||||
node_tree->runtime->stats_draw(node_tree->runtime->sdh,
|
||||
TIP_("Compositing | Initializing execution"));
|
||||
|
||||
DebugInfo::graphviz(&exec_system, "compositor_prior_rendering");
|
||||
|
||||
@@ -272,7 +273,7 @@ void FullFrameExecutionModel::update_progress_bar()
|
||||
const bNodeTree *tree = context_.get_bnodetree();
|
||||
if (tree) {
|
||||
const float progress = num_operations_finished_ / float(operations_.size());
|
||||
tree->progress(tree->prh, progress);
|
||||
tree->runtime->progress(tree->runtime->prh, progress);
|
||||
|
||||
char buf[128];
|
||||
BLI_snprintf(buf,
|
||||
@@ -280,7 +281,7 @@ void FullFrameExecutionModel::update_progress_bar()
|
||||
TIP_("Compositing | Operation %i-%li"),
|
||||
num_operations_finished_ + 1,
|
||||
operations_.size());
|
||||
tree->stats_draw(tree->sdh, buf);
|
||||
tree->runtime->stats_draw(tree->runtime->sdh, buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "COM_MemoryBuffer.h"
|
||||
#include "COM_MetaData.h"
|
||||
|
||||
#include "BKE_node_runtime.hh"
|
||||
|
||||
#include "clew.h"
|
||||
|
||||
#include "DNA_node_types.h"
|
||||
@@ -555,13 +557,13 @@ class NodeOperation {
|
||||
|
||||
inline bool is_braked() const
|
||||
{
|
||||
return btree_->test_break(btree_->tbh);
|
||||
return btree_->runtime->test_break(btree_->runtime->tbh);
|
||||
}
|
||||
|
||||
inline void update_draw()
|
||||
{
|
||||
if (btree_->update_draw) {
|
||||
btree_->update_draw(btree_->udh);
|
||||
if (btree_->runtime->update_draw) {
|
||||
btree_->runtime->update_draw(btree_->runtime->udh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@ TiledExecutionModel::TiledExecutionModel(CompositorContext &context,
|
||||
: ExecutionModel(context, operations), groups_(groups)
|
||||
{
|
||||
const bNodeTree *node_tree = context.get_bnodetree();
|
||||
node_tree->stats_draw(node_tree->sdh, TIP_("Compositing | Determining resolution"));
|
||||
node_tree->runtime->stats_draw(node_tree->runtime->sdh,
|
||||
TIP_("Compositing | Determining resolution"));
|
||||
|
||||
uint resolution[2];
|
||||
for (ExecutionGroup *group : groups_) {
|
||||
@@ -100,7 +101,8 @@ void TiledExecutionModel::execute(ExecutionSystem &exec_system)
|
||||
{
|
||||
const bNodeTree *editingtree = this->context_.get_bnodetree();
|
||||
|
||||
editingtree->stats_draw(editingtree->sdh, TIP_("Compositing | Initializing execution"));
|
||||
editingtree->runtime->stats_draw(editingtree->runtime->sdh,
|
||||
TIP_("Compositing | Initializing execution"));
|
||||
|
||||
update_read_buffer_offset(operations_);
|
||||
|
||||
@@ -118,7 +120,8 @@ void TiledExecutionModel::execute(ExecutionSystem &exec_system)
|
||||
WorkScheduler::finish();
|
||||
WorkScheduler::stop();
|
||||
|
||||
editingtree->stats_draw(editingtree->sdh, TIP_("Compositing | De-initializing execution"));
|
||||
editingtree->runtime->stats_draw(editingtree->runtime->sdh,
|
||||
TIP_("Compositing | De-initializing execution"));
|
||||
|
||||
for (NodeOperation *operation : operations_) {
|
||||
operation->deinit_execution();
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_scene.h"
|
||||
|
||||
#include "COM_ExecutionSystem.h"
|
||||
@@ -41,8 +42,8 @@ static void compositor_init_node_previews(const RenderData *render_data, bNodeTr
|
||||
|
||||
static void compositor_reset_node_tree_status(bNodeTree *node_tree)
|
||||
{
|
||||
node_tree->progress(node_tree->prh, 0.0);
|
||||
node_tree->stats_draw(node_tree->sdh, IFACE_("Compositing"));
|
||||
node_tree->runtime->progress(node_tree->runtime->prh, 0.0);
|
||||
node_tree->runtime->stats_draw(node_tree->runtime->sdh, IFACE_("Compositing"));
|
||||
}
|
||||
|
||||
void COM_execute(RenderData *render_data,
|
||||
@@ -61,7 +62,7 @@ void COM_execute(RenderData *render_data,
|
||||
|
||||
BLI_mutex_lock(&g_compositor.mutex);
|
||||
|
||||
if (node_tree->test_break(node_tree->tbh)) {
|
||||
if (node_tree->runtime->test_break(node_tree->runtime->tbh)) {
|
||||
/* During editing multiple compositor executions can be triggered.
|
||||
* Make sure this is the most recent one. */
|
||||
BLI_mutex_unlock(&g_compositor.mutex);
|
||||
@@ -82,7 +83,7 @@ void COM_execute(RenderData *render_data,
|
||||
render_data, scene, node_tree, rendering, true, view_name);
|
||||
fast_pass.execute();
|
||||
|
||||
if (node_tree->test_break(node_tree->tbh)) {
|
||||
if (node_tree->runtime->test_break(node_tree->runtime->tbh)) {
|
||||
BLI_mutex_unlock(&g_compositor.mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ static void write_buffer_rect(rcti *rect,
|
||||
}
|
||||
offset += size;
|
||||
|
||||
if (tree->test_break && tree->test_break(tree->tbh)) {
|
||||
if (tree->runtime->test_break && tree->runtime->test_break(tree->runtime->tbh)) {
|
||||
breaked = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ void TextureBaseOperation::deinit_execution()
|
||||
BKE_image_pool_free(pool_);
|
||||
pool_ = nullptr;
|
||||
if (texture_ != nullptr && texture_->use_nodes && texture_->nodetree != nullptr &&
|
||||
texture_->nodetree->execdata != nullptr) {
|
||||
ntreeTexEndExecTree(texture_->nodetree->execdata);
|
||||
texture_->nodetree->runtime->execdata != nullptr) {
|
||||
ntreeTexEndExecTree(texture_->nodetree->runtime->execdata);
|
||||
}
|
||||
NodeOperation::deinit_execution();
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_curve.h"
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_paint.h"
|
||||
|
||||
@@ -323,7 +324,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
|
||||
BLI_task_parallel_range(0, size, &data, load_tex_task_cb_ex, &settings);
|
||||
|
||||
if (mtex->tex && mtex->tex->nodetree) {
|
||||
ntreeTexEndExecTree(mtex->tex->nodetree->execdata);
|
||||
ntreeTexEndExecTree(mtex->tex->nodetree->runtime->execdata);
|
||||
}
|
||||
|
||||
if (pool) {
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_paint.h"
|
||||
|
||||
#include "NOD_texture.h"
|
||||
@@ -395,11 +396,11 @@ void paint_brush_exit_tex(Brush *brush)
|
||||
if (brush) {
|
||||
MTex *mtex = &brush->mtex;
|
||||
if (mtex->tex && mtex->tex->nodetree) {
|
||||
ntreeTexEndExecTree(mtex->tex->nodetree->execdata);
|
||||
ntreeTexEndExecTree(mtex->tex->nodetree->runtime->execdata);
|
||||
}
|
||||
mtex = &brush->mask_mtex;
|
||||
if (mtex->tex && mtex->tex->nodetree) {
|
||||
ntreeTexEndExecTree(mtex->tex->nodetree->execdata);
|
||||
ntreeTexEndExecTree(mtex->tex->nodetree->runtime->execdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "BKE_mesh_mapping.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_multires.h"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_paint.h"
|
||||
#include "BKE_pbvh.h"
|
||||
@@ -5615,7 +5616,7 @@ static void sculpt_brush_exit_tex(Sculpt *sd)
|
||||
MTex *mtex = &brush->mtex;
|
||||
|
||||
if (mtex->tex && mtex->tex->nodetree) {
|
||||
ntreeTexEndExecTree(mtex->tex->nodetree->execdata);
|
||||
ntreeTexEndExecTree(mtex->tex->nodetree->runtime->execdata);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -268,14 +268,14 @@ static void compo_startjob(void *cjv,
|
||||
cj->do_update = do_update;
|
||||
cj->progress = progress;
|
||||
|
||||
ntree->test_break = compo_breakjob;
|
||||
ntree->tbh = cj;
|
||||
ntree->stats_draw = compo_statsdrawjob;
|
||||
ntree->sdh = cj;
|
||||
ntree->progress = compo_progressjob;
|
||||
ntree->prh = cj;
|
||||
ntree->update_draw = compo_redrawjob;
|
||||
ntree->udh = cj;
|
||||
ntree->runtime->test_break = compo_breakjob;
|
||||
ntree->runtime->tbh = cj;
|
||||
ntree->runtime->stats_draw = compo_statsdrawjob;
|
||||
ntree->runtime->sdh = cj;
|
||||
ntree->runtime->progress = compo_progressjob;
|
||||
ntree->runtime->prh = cj;
|
||||
ntree->runtime->update_draw = compo_redrawjob;
|
||||
ntree->runtime->udh = cj;
|
||||
|
||||
// XXX BIF_store_spare();
|
||||
/* 1 is do_previews */
|
||||
@@ -293,9 +293,9 @@ static void compo_startjob(void *cjv,
|
||||
}
|
||||
}
|
||||
|
||||
ntree->test_break = nullptr;
|
||||
ntree->stats_draw = nullptr;
|
||||
ntree->progress = nullptr;
|
||||
ntree->runtime->test_break = nullptr;
|
||||
ntree->runtime->stats_draw = nullptr;
|
||||
ntree->runtime->progress = nullptr;
|
||||
}
|
||||
|
||||
static void compo_canceljob(void *cjv)
|
||||
@@ -2797,13 +2797,13 @@ static bool node_shader_script_update_text_recursive(RenderEngine *engine,
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
ntree->done = true;
|
||||
ntree->runtime->done = true;
|
||||
|
||||
/* update each script that is using this text datablock */
|
||||
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
|
||||
if (node->type == NODE_GROUP) {
|
||||
bNodeTree *ngroup = (bNodeTree *)node->id;
|
||||
if (ngroup && !ngroup->done) {
|
||||
if (ngroup && !ngroup->runtime->done) {
|
||||
found |= node_shader_script_update_text_recursive(engine, type, ngroup, text);
|
||||
}
|
||||
}
|
||||
@@ -2855,14 +2855,14 @@ static int node_shader_script_update_exec(bContext *C, wmOperator *op)
|
||||
/* clear flags for recursion check */
|
||||
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
|
||||
if (ntree->type == NTREE_SHADER) {
|
||||
ntree->done = false;
|
||||
ntree->runtime->done = false;
|
||||
}
|
||||
}
|
||||
FOREACH_NODETREE_END;
|
||||
|
||||
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
|
||||
if (ntree->type == NTREE_SHADER) {
|
||||
if (!ntree->done) {
|
||||
if (!ntree->runtime->done) {
|
||||
found |= node_shader_script_update_text_recursive(engine, type, ntree, text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -903,7 +903,7 @@ static void node_link_exit(bContext &C, wmOperator &op, const bool apply_links)
|
||||
bNodeLinkDrag *nldrag = (bNodeLinkDrag *)op.customdata;
|
||||
|
||||
/* avoid updates while applying links */
|
||||
ntree.is_updating = true;
|
||||
ntree.runtime->is_updating = true;
|
||||
for (bNodeLink *link : nldrag->links) {
|
||||
link->flag &= ~NODE_LINK_DRAGGED;
|
||||
|
||||
@@ -929,7 +929,7 @@ static void node_link_exit(bContext &C, wmOperator &op, const bool apply_links)
|
||||
nodeRemLink(&ntree, link);
|
||||
}
|
||||
}
|
||||
ntree.is_updating = false;
|
||||
ntree.runtime->is_updating = false;
|
||||
|
||||
ED_node_tree_propagate_change(&C, bmain, &ntree);
|
||||
|
||||
|
||||
@@ -510,10 +510,8 @@ typedef struct bNodeTree {
|
||||
*/
|
||||
int cur_index;
|
||||
int flag;
|
||||
/** Flag to prevent re-entrant update calls. */
|
||||
short is_updating;
|
||||
/** Generic temporary flag for recursion check (DFS/BFS). */
|
||||
short done;
|
||||
|
||||
char _pad1[4];
|
||||
|
||||
/** Specific node type this tree is used for. */
|
||||
int nodetype DNA_DEPRECATED;
|
||||
@@ -546,25 +544,6 @@ typedef struct bNodeTree {
|
||||
|
||||
char _pad[4];
|
||||
|
||||
/** Execution data.
|
||||
*
|
||||
* XXX It would be preferable to completely move this data out of the underlying node tree,
|
||||
* so node tree execution could finally run independent of the tree itself.
|
||||
* This would allow node trees to be merely linked by other data (materials, textures, etc.),
|
||||
* as ID data is supposed to.
|
||||
* Execution data is generated from the tree once at execution start and can then be used
|
||||
* as long as necessary, even while the tree is being modified.
|
||||
*/
|
||||
struct bNodeTreeExec *execdata;
|
||||
|
||||
/* Callbacks. */
|
||||
void (*progress)(void *, float progress);
|
||||
/** \warning may be called by different threads */
|
||||
void (*stats_draw)(void *, const char *str);
|
||||
bool (*test_break)(void *);
|
||||
void (*update_draw)(void *);
|
||||
void *tbh, *prh, *sdh, *udh;
|
||||
|
||||
/** Image representing what the node group does. */
|
||||
struct PreviewImage *preview;
|
||||
|
||||
|
||||
@@ -1181,8 +1181,8 @@ bNodeTreeExec *ntreeShaderBeginExecTree(bNodeTree *ntree)
|
||||
/* XXX hack: prevent exec data from being generated twice.
|
||||
* this should be handled by the renderer!
|
||||
*/
|
||||
if (ntree->execdata) {
|
||||
return ntree->execdata;
|
||||
if (ntree->runtime->execdata) {
|
||||
return ntree->runtime->execdata;
|
||||
}
|
||||
|
||||
context.previews = ntree->previews;
|
||||
@@ -1192,7 +1192,7 @@ bNodeTreeExec *ntreeShaderBeginExecTree(bNodeTree *ntree)
|
||||
/* XXX: this should not be necessary, but is still used for compositor/shader/texture nodes,
|
||||
* which only store the `ntree` pointer. Should be fixed at some point!
|
||||
*/
|
||||
ntree->execdata = exec;
|
||||
ntree->runtime->execdata = exec;
|
||||
|
||||
return exec;
|
||||
}
|
||||
@@ -1225,6 +1225,6 @@ void ntreeShaderEndExecTree(bNodeTreeExec *exec)
|
||||
|
||||
/* XXX: clear node-tree back-pointer to exec data,
|
||||
* same problem as noted in #ntreeBeginExecTree. */
|
||||
ntree->execdata = nullptr;
|
||||
ntree->runtime->execdata = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,8 +242,8 @@ bNodeTreeExec *ntreeTexBeginExecTree(bNodeTree *ntree)
|
||||
/* XXX hack: prevent exec data from being generated twice.
|
||||
* this should be handled by the renderer!
|
||||
*/
|
||||
if (ntree->execdata) {
|
||||
return ntree->execdata;
|
||||
if (ntree->runtime->execdata) {
|
||||
return ntree->runtime->execdata;
|
||||
}
|
||||
|
||||
context.previews = ntree->previews;
|
||||
@@ -253,7 +253,7 @@ bNodeTreeExec *ntreeTexBeginExecTree(bNodeTree *ntree)
|
||||
/* XXX this should not be necessary, but is still used for compositor/shading/texture nodes,
|
||||
* which only store the ntree pointer. Should be fixed at some point!
|
||||
*/
|
||||
ntree->execdata = exec;
|
||||
ntree->runtime->execdata = exec;
|
||||
|
||||
return exec;
|
||||
}
|
||||
@@ -311,7 +311,7 @@ void ntreeTexEndExecTree(bNodeTreeExec *exec)
|
||||
|
||||
/* XXX: clear node-tree back-pointer to exec data,
|
||||
* same problem as noted in #ntreeBeginExecTree. */
|
||||
ntree->execdata = nullptr;
|
||||
ntree->runtime->execdata = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ int ntreeTexExecTree(bNodeTree *ntree,
|
||||
TexCallData data;
|
||||
int retval = TEX_INT;
|
||||
bNodeThreadStack *nts = nullptr;
|
||||
bNodeTreeExec *exec = ntree->execdata;
|
||||
bNodeTreeExec *exec = ntree->runtime->execdata;
|
||||
|
||||
data.co = co;
|
||||
data.dxt = dxt;
|
||||
@@ -348,12 +348,12 @@ int ntreeTexExecTree(bNodeTree *ntree,
|
||||
/* ensure execdata is only initialized once */
|
||||
if (!exec) {
|
||||
BLI_thread_lock(LOCK_NODES);
|
||||
if (!ntree->execdata) {
|
||||
if (!ntree->runtime->execdata) {
|
||||
ntreeTexBeginExecTree(ntree);
|
||||
}
|
||||
BLI_thread_unlock(LOCK_NODES);
|
||||
|
||||
exec = ntree->execdata;
|
||||
exec = ntree->runtime->execdata;
|
||||
}
|
||||
|
||||
nts = ntreeGetThreadStack(exec, thread);
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include "BKE_mask.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_pointcache.h"
|
||||
#include "BKE_report.h"
|
||||
@@ -1161,12 +1162,12 @@ static void do_render_compositor(Render *re)
|
||||
}
|
||||
|
||||
if (!re->test_break(re->tbh)) {
|
||||
ntree->stats_draw = render_compositor_stats;
|
||||
ntree->test_break = re->test_break;
|
||||
ntree->progress = re->progress;
|
||||
ntree->sdh = re;
|
||||
ntree->tbh = re->tbh;
|
||||
ntree->prh = re->prh;
|
||||
ntree->runtime->stats_draw = render_compositor_stats;
|
||||
ntree->runtime->test_break = re->test_break;
|
||||
ntree->runtime->progress = re->progress;
|
||||
ntree->runtime->sdh = re;
|
||||
ntree->runtime->tbh = re->tbh;
|
||||
ntree->runtime->prh = re->prh;
|
||||
|
||||
if (update_newframe) {
|
||||
/* If we have consistent depsgraph now would be a time to update them. */
|
||||
@@ -1177,10 +1178,10 @@ static void do_render_compositor(Render *re)
|
||||
re->pipeline_scene_eval, ntree, &re->r, true, G.background == 0, rv->name);
|
||||
}
|
||||
|
||||
ntree->stats_draw = nullptr;
|
||||
ntree->test_break = nullptr;
|
||||
ntree->progress = nullptr;
|
||||
ntree->tbh = ntree->sdh = ntree->prh = nullptr;
|
||||
ntree->runtime->stats_draw = nullptr;
|
||||
ntree->runtime->test_break = nullptr;
|
||||
ntree->runtime->progress = nullptr;
|
||||
ntree->runtime->tbh = ntree->runtime->sdh = ntree->runtime->prh = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user