nodes: optimize node graph changes by only updating from inputs that changed
A huge optimization that ensures only the parts of a node graph that have changed get pushed to the renderer. For thread-safety, the node graph is copied elsewhere so that users can make changes asynchronously and the graph can update when its threads are ready. Up until now, if an input value changed, every node's values would be re-copied, or worse, if a connection was changed, the entire graph would be recopied. This has been negligible in testing since we've been largely testing with small graphs, but for massive projects, it's important that this be as optimized as possible.
This commit is contained in:
@@ -59,12 +59,12 @@ NodeInput *ClipBlock::texture_input() const
|
||||
return texture_input_;
|
||||
}
|
||||
|
||||
void ClipBlock::InvalidateCache(const rational &start_range, const rational &end_range, NodeInput *from)
|
||||
void ClipBlock::InvalidateCache(const TimeRange &range, NodeInput *from, NodeInput *source)
|
||||
{
|
||||
// If signal is from texture input, transform all times from media time to sequence time
|
||||
if (from == texture_input_) {
|
||||
rational start = MediaToSequenceTime(start_range);
|
||||
rational end = MediaToSequenceTime(end_range);
|
||||
rational start = MediaToSequenceTime(range.in());
|
||||
rational end = MediaToSequenceTime(range.out());
|
||||
|
||||
// Ensure range actually covers this clip's area
|
||||
if (!(end < in() || start > out())) {
|
||||
@@ -73,12 +73,12 @@ void ClipBlock::InvalidateCache(const rational &start_range, const rational &end
|
||||
start = qMax(start, in());
|
||||
end = qMin(end, out());
|
||||
|
||||
Node::InvalidateCache(start, end, from);
|
||||
Node::InvalidateCache(TimeRange(start, end), from, source);
|
||||
|
||||
}
|
||||
} else {
|
||||
// Otherwise, pass signal along normally
|
||||
Node::InvalidateCache(start_range, end_range, from);
|
||||
Node::InvalidateCache(range, from, source);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user