Implement Infrastructure to reuse previous frames for brush drawing

Implement Infrastructuro to reuse the previous evaluation of the
node graph to blend the new stroke with instead of drawing the
entire trace from scratch.
This does not transition to a blending based approach because that still
caused regressions but allows the brush node to work with input data
natively.

Test Plan:
- Use the brush tool in the editor and check for regressions
- Evaluate the performance

Reviewers: Keavon

Pull Request: https://github.com/GraphiteEditor/Graphite/pull/1190
This commit is contained in:
Dennis Kobert
2023-05-03 13:14:41 +02:00
committed by GitHub
parent 7c115b3b26
commit a3498fe182
19 changed files with 282 additions and 172 deletions

View File

@@ -17,6 +17,7 @@ use interpreted_executor::executor::DynamicExecutor;
use glam::{DAffine2, DVec2};
use std::borrow::Cow;
use std::sync::Arc;
#[derive(Debug, Clone, Default)]
pub struct NodeGraphExecutor {
@@ -37,6 +38,7 @@ impl NodeGraphExecutor {
assert_eq!(scoped_network.outputs.len(), 1, "Graph with multiple outputs not yet handled");
let c = Compiler {};
let proto_network = c.compile_single(scoped_network, true)?;
assert_ne!(proto_network.nodes.len(), 0, "No protonodes exist?");
if let Err(e) = self.executor.update(proto_network) {
error!("Failed to update executor:\n{}", e);
@@ -53,7 +55,7 @@ impl NodeGraphExecutor {
}
}
pub fn introspect_node(&self, path: &[NodeId]) -> Option<String> {
pub fn introspect_node(&self, path: &[NodeId]) -> Option<Arc<dyn std::any::Any>> {
self.executor.introspect(path).flatten()
}