mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-17 07:18:04 +08:00
64 lines
1.6 KiB
Rust
64 lines
1.6 KiB
Rust
use gpu_compiler_bin_wrapper::CompileRequest;
|
|
use graph_craft::concrete;
|
|
use graph_craft::document::*;
|
|
|
|
use graph_craft::*;
|
|
use std::borrow::Cow;
|
|
|
|
fn main() {
|
|
let client = reqwest::blocking::Client::new();
|
|
|
|
let network = NodeNetwork {
|
|
inputs: vec![0],
|
|
outputs: vec![NodeOutput::new(0, 0)],
|
|
disabled: vec![],
|
|
previous_outputs: None,
|
|
nodes: [(
|
|
0,
|
|
DocumentNode {
|
|
name: "Inc".into(),
|
|
inputs: vec![NodeInput::Network(concrete!(u32))],
|
|
implementation: DocumentNodeImplementation::Network(add_network()),
|
|
metadata: DocumentNodeMetadata::default(),
|
|
},
|
|
)]
|
|
.into_iter()
|
|
.collect(),
|
|
};
|
|
|
|
let compile_request = CompileRequest::new(network, "u32".to_owned(), "u32".to_owned());
|
|
let response = client.post("http://localhost:3000/compile/spirv").json(&compile_request).send().unwrap();
|
|
println!("response: {:?}", response);
|
|
}
|
|
|
|
fn add_network() -> NodeNetwork {
|
|
NodeNetwork {
|
|
inputs: vec![0],
|
|
outputs: vec![NodeOutput::new(1, 0)],
|
|
disabled: vec![],
|
|
previous_outputs: None,
|
|
nodes: [
|
|
(
|
|
0,
|
|
DocumentNode {
|
|
name: "Dup".into(),
|
|
inputs: vec![NodeInput::Network(concrete!(u32))],
|
|
metadata: DocumentNodeMetadata::default(),
|
|
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::DupNode")),
|
|
},
|
|
),
|
|
(
|
|
1,
|
|
DocumentNode {
|
|
name: "Add".into(),
|
|
inputs: vec![NodeInput::node(0, 0)],
|
|
metadata: DocumentNodeMetadata::default(),
|
|
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::AddNode")),
|
|
},
|
|
),
|
|
]
|
|
.into_iter()
|
|
.collect(),
|
|
}
|
|
}
|