mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 06:38:03 +08:00
* Start implementing GpuExecutor for wgpu * Implement read_output_buffer function * Implement extraction node in the compiler * Generate type annotations during shader compilation * Start adding node wrapprs for graph execution api * Wrap more of the api in nodes * Restructure Pipeline to accept arbitrary shader inputs * Adapt nodes to new trait definitions * Start implementing gpu-compiler trait * Adapt shader generation * Hardstuck on pointer casts * Pass nodes as references in gpu code to avoid zsts * Update gcore to compile on the gpu * Fix color doc tests * Impl Node for node refs
26 lines
909 B
Rust
26 lines
909 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.network, &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(())
|
|
}
|