mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-03 13:02:20 +00: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:
parent
be32f7949f
commit
79ad3e7908
43 changed files with 2744 additions and 482 deletions
15
node-graph/future-executor/Cargo.toml
Normal file
15
node-graph/future-executor/Cargo.toml
Normal file
|
@ -0,0 +1,15 @@
|
|||
[package]
|
||||
name = "future-executor"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
authors = ["Graphite Authors <contact@graphite.rs>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
futures = "0.3.25"
|
||||
log = "0.4"
|
||||
|
||||
[target.wasm32-unknown-unknown.dependencies]
|
||||
wasm-rs-async-executor = {version = "0.9.0", features = ["cooperative-browser", "debug", "requestIdleCallback"] }
|
26
node-graph/future-executor/src/lib.rs
Normal file
26
node-graph/future-executor/src/lib.rs
Normal file
|
@ -0,0 +1,26 @@
|
|||
use core::future::Future;
|
||||
|
||||
pub fn block_on<F: Future + 'static>(future: F) -> F::Output {
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
{
|
||||
use wasm_rs_async_executor::single_threaded as executor;
|
||||
|
||||
let val = std::sync::Arc::new(std::sync::Mutex::new(None));
|
||||
let move_val = val.clone();
|
||||
let result = executor::spawn(async move {
|
||||
let result = executor::yield_async(future).await;
|
||||
*move_val.lock().unwrap() = Some(result);
|
||||
log::info!("Finished");
|
||||
});
|
||||
executor::run(Some(result.task()));
|
||||
loop {
|
||||
if let Some(result) = val.lock().unwrap().take() {
|
||||
return result;
|
||||
}
|
||||
log::info!("Waiting");
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
futures::executor::block_on(future)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue