mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-18 18:38:05 +08:00
Restructure GPU compilation execution pipeline (#903)
* Restructure gpu compilation execution pipeline * Add compilation server/client infrastructure * Add wgpu executor
This commit is contained in:
committed by
Keavon Chambers
parent
be32f7949f
commit
79ad3e7908
26
node-graph/gpu-compiler/src/main.rs
Normal file
26
node-graph/gpu-compiler/src/main.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use graph_craft::document::NodeNetwork;
|
||||
use gpu_compiler as compiler;
|
||||
use std::io::Write;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
println!("Starting Gpu Compiler!");
|
||||
let mut stdin = std::io::stdin();
|
||||
let mut stdout = std::io::stdout();
|
||||
let input_type = std::env::args().nth(1).expect("input type arg missing");
|
||||
let output_type = std::env::args().nth(2).expect("output type arg missing");
|
||||
let compile_dir = std::env::args().nth(3).map(|x| std::path::PathBuf::from(&x)).unwrap_or(tempfile::tempdir()?.into_path());
|
||||
let network: NodeNetwork = serde_json::from_reader(&mut stdin)?;
|
||||
let compiler = graph_craft::executor::Compiler{};
|
||||
let proto_network = compiler.compile(network, true);
|
||||
dbg!(&compile_dir);
|
||||
|
||||
let metadata = compiler::Metadata::new("project".to_owned(), vec!["test@example.com".to_owned()]);
|
||||
|
||||
compiler::create_files(&metadata, &proto_network, &compile_dir, &input_type, &output_type)?;
|
||||
let result = compiler::compile(&compile_dir)?;
|
||||
|
||||
let bytes = std::fs::read(result.module.unwrap_single())?;
|
||||
stdout.write_all(&bytes)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user