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:
@@ -92,26 +92,24 @@ NodeInput *ViewerOutput::samples_input() const
|
||||
return samples_input_;
|
||||
}
|
||||
|
||||
void ViewerOutput::InvalidateCache(const rational &start_range, const rational &end_range, NodeInput *from)
|
||||
void ViewerOutput::InvalidateCache(const TimeRange &range, NodeInput *from, NodeInput *source)
|
||||
{
|
||||
Node::InvalidateCache(start_range, end_range, from);
|
||||
|
||||
if (from == texture_input()) {
|
||||
emit VideoChangedBetween(TimeRange(start_range, end_range));
|
||||
emit VideoChangedBetween(range, source);
|
||||
} else if (from == samples_input()) {
|
||||
emit AudioChangedBetween(TimeRange(start_range, end_range));
|
||||
emit AudioChangedBetween(range, source);
|
||||
}
|
||||
|
||||
SendInvalidateCache(start_range, end_range);
|
||||
Node::InvalidateCache(range, from, source);
|
||||
}
|
||||
|
||||
void ViewerOutput::InvalidateVisible(NodeInput* from)
|
||||
void ViewerOutput::InvalidateVisible(NodeInput* from, NodeInput *source)
|
||||
{
|
||||
if (from == texture_input()) {
|
||||
emit VisibleInvalidated();
|
||||
emit VisibleInvalidated(source);
|
||||
}
|
||||
|
||||
Node::InvalidateVisible(from);
|
||||
Node::InvalidateVisible(from, source);
|
||||
}
|
||||
|
||||
const VideoParams &ViewerOutput::video_params() const
|
||||
@@ -164,17 +162,6 @@ const QUuid &ViewerOutput::uuid() const
|
||||
return uuid_;
|
||||
}
|
||||
|
||||
void ViewerOutput::DependentEdgeChanged(NodeInput *from)
|
||||
{
|
||||
if (from == texture_input_) {
|
||||
emit VideoGraphChanged();
|
||||
} else if (from == samples_input_) {
|
||||
emit AudioGraphChanged();
|
||||
}
|
||||
|
||||
Node::DependentEdgeChanged(from);
|
||||
}
|
||||
|
||||
void ViewerOutput::UpdateTrackCache()
|
||||
{
|
||||
track_cache_.clear();
|
||||
|
||||
Reference in New Issue
Block a user