Fix #119211: Masks do not update in GPU compositor #123085

Merged
Omar Emara merged 3 commits from OmarEmaraDev/blender:fix-119211 into blender-v4.2-release 2024-06-13 07:43:23 +02:00
3 changed files with 29 additions and 6 deletions

View File

@ -8,13 +8,24 @@
#include "BLI_timeit.hh"
#include "BLI_utility_mixins.hh"
struct Depsgraph;
namespace blender::bke {
/* Runtime data specific to the compositing trees. */
struct CompositorRuntime {
class CompositorRuntime {
public:
/* Per-node instance total execution time for the corresponding node, during the last tree
* evaluation. */
Map<bNodeInstanceKey, timeit::Nanoseconds> per_node_execution_time;
/* A dependency graph used for interactive compositing. This is initialized the first time it is
* needed, and then kept persistent for the lifetime of the scene. This is done to allow the
* compositor to track changes to resources its uses as well as reduce the overhead of creating
* the dependency graph every time it executes. */
Depsgraph *preview_depsgraph = nullptr;
~CompositorRuntime();
};
class SceneRuntime : NonCopyable, NonMovable {

View File

@ -107,8 +107,16 @@
#include "bmesh.hh"
using blender::bke::CompositorRuntime;
using blender::bke::SceneRuntime;
CompositorRuntime::~CompositorRuntime()
{
if (preview_depsgraph) {
DEG_graph_free(preview_depsgraph);
}
}
CurveMapping *BKE_sculpt_default_cavity_curve()
{

View File

@ -219,9 +219,6 @@ static void compo_freejob(void *cjv)
bke::ntreeFreeTree(cj->localtree);
MEM_freeN(cj->localtree);
}
if (cj->compositor_depsgraph != nullptr) {
DEG_graph_free(cj->compositor_depsgraph);
}
MEM_delete(cj);
}
@ -235,8 +232,15 @@ static void compo_initjob(void *cjv)
Scene *scene = cj->scene;
ViewLayer *view_layer = cj->view_layer;
cj->compositor_depsgraph = DEG_graph_new(bmain, scene, view_layer, DAG_EVAL_RENDER);
DEG_debug_name_set(cj->compositor_depsgraph, "COMPOSITOR");
bke::CompositorRuntime &compositor_runtime = scene->runtime->compositor;
if (!compositor_runtime.preview_depsgraph) {
compositor_runtime.preview_depsgraph = DEG_graph_new(
bmain, scene, view_layer, DAG_EVAL_RENDER);
DEG_debug_name_set(compositor_runtime.preview_depsgraph, "COMPOSITOR");
}
cj->compositor_depsgraph = compositor_runtime.preview_depsgraph;
DEG_graph_build_for_compositor_preview(cj->compositor_depsgraph, cj->ntree);
/* NOTE: Don't update animation to preserve unkeyed changes, this means can not use