mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
* Web gpu execution MVP Ready infrastructure for wgpu experimentation Start implementing simple gpu test case Fix Extract Node not working with nested networks Convert inputs for extracted node to network inputs Fix missing cors headers Feature gate gcore to make it once again no-std compatible Add skeleton structure gpu shader Work on gpu node graph output saving Fix Get and Set nodes Fix storage nodes Fix shader construction errors -> spirv errors Add unsafe version Add once cell node Web gpu execution MVP
26 lines
910 B
Rust
26 lines
910 B
Rust
use gpu_compiler as compiler;
|
|
use gpu_executor::CompileRequest;
|
|
use graph_craft::document::NodeNetwork;
|
|
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 compile_dir = std::env::args().nth(1).map(|x| std::path::PathBuf::from(&x)).unwrap_or(tempfile::tempdir()?.into_path());
|
|
let request: CompileRequest = serde_json::from_reader(&mut stdin)?;
|
|
dbg!(&compile_dir);
|
|
|
|
let metadata = compiler::Metadata::new("project".to_owned(), vec!["test@example.com".to_owned()]);
|
|
|
|
compiler::create_files(&metadata, &request.networks, &compile_dir, &request.io)?;
|
|
let result = compiler::compile(&compile_dir)?;
|
|
|
|
let bytes = std::fs::read(result.module.unwrap_single())?;
|
|
// TODO: properly resolve this
|
|
let spirv_path = compile_dir.join("shader.spv");
|
|
std::fs::write(&spirv_path, &bytes)?;
|
|
|
|
Ok(())
|
|
}
|