mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 14:58: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
5a4ef40d24
commit
a492e7a4bb
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)
|
||||
}
|
||||
Reference in New Issue
Block a user