mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 10:58:04 +08:00
Decrease graph compilation time significantly (#1368)
* Decrease compilation time significantly * Refactor reorder_ids method to improve performance
This commit is contained in:
@@ -50,7 +50,7 @@ log = "0.4"
|
||||
bezier-rs = { path = "../../libraries/bezier-rs", features = ["serde"] }
|
||||
glam = { version = "0.24", features = ["serde"] }
|
||||
node-macro = { path = "../node-macro" }
|
||||
xxhash-rust = { workspace = true }
|
||||
rustc-hash = { workspace = true }
|
||||
serde_json = "1.0.96"
|
||||
reqwest = { version = "0.11.18", features = ["rustls", "rustls-tls", "json"] }
|
||||
futures = "0.3.28"
|
||||
|
||||
@@ -26,7 +26,7 @@ pub struct GpuCompiler<TypingContext, ShaderIO> {
|
||||
async fn compile_gpu(node: &'input DocumentNode, mut typing_context: TypingContext, io: ShaderIO) -> compilation_client::Shader {
|
||||
let compiler = graph_craft::graphene_compiler::Compiler {};
|
||||
let DocumentNodeImplementation::Network(ref network) = node.implementation else { panic!() };
|
||||
let proto_networks: Vec<_> = compiler.compile(network.clone(), true).collect();
|
||||
let proto_networks: Vec<_> = compiler.compile(network.clone()).collect();
|
||||
|
||||
for network in proto_networks.iter() {
|
||||
typing_context.update(network).expect("Failed to type check network");
|
||||
@@ -229,7 +229,7 @@ async fn create_compute_pass_descriptor<T: Clone + Pixel + StaticTypeSized>(
|
||||
..Default::default()
|
||||
};
|
||||
log::debug!("compiling network");
|
||||
let proto_networks = compiler.compile(network.clone(), true).collect();
|
||||
let proto_networks = compiler.compile(network.clone()).collect();
|
||||
log::debug!("compiling shader");
|
||||
let shader = compilation_client::compile(
|
||||
proto_networks,
|
||||
@@ -442,7 +442,7 @@ async fn blend_gpu_image(foreground: ImageFrame<Color>, background: ImageFrame<C
|
||||
..Default::default()
|
||||
};
|
||||
log::debug!("compiling network");
|
||||
let proto_networks = compiler.compile(network.clone(), true).collect();
|
||||
let proto_networks = compiler.compile(network.clone()).collect();
|
||||
log::debug!("compiling shader");
|
||||
|
||||
let shader = compilation_client::compile(
|
||||
|
||||
@@ -454,8 +454,7 @@ macro_rules! generate_imaginate_node {
|
||||
$(let $val = self.$val.eval(());)*
|
||||
|
||||
use std::hash::Hasher;
|
||||
use xxhash_rust::xxh3::Xxh3;
|
||||
let mut hasher = Xxh3::new();
|
||||
let mut hasher = rustc_hash::FxHasher::default();
|
||||
frame.image.hash(&mut hasher);
|
||||
let hash =hasher.finish();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user