mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-21 06:48:13 +08:00
Add GPU support for node graph
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#![no_std]
|
||||
#![cfg_attr(target_arch = "spirv", feature(register_attr), register_attr(spirv))]
|
||||
|
||||
pub mod generic;
|
||||
pub mod ops;
|
||||
@@ -9,12 +10,13 @@ pub mod value;
|
||||
pub trait Node< 'n, Input> {
|
||||
type Output : 'n;
|
||||
|
||||
fn eval(&'n self, input: &'n Input) -> Self::Output;
|
||||
fn eval(&'n self, input: Input) -> Self::Output;
|
||||
}
|
||||
|
||||
// TODO: Fix exec trait
|
||||
pub trait Exec<'n>: Node<'n, ()> {
|
||||
fn exec(&'n self) -> Self::Output {
|
||||
self.eval(&())
|
||||
self.eval(())
|
||||
}
|
||||
}
|
||||
impl<'n, T: Node<'n, ()>> Exec<'n> for T {}
|
||||
@@ -23,7 +25,9 @@ pub trait Cache {
|
||||
fn clear(&mut self);
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "gpu"))]
|
||||
extern crate alloc;
|
||||
#[cfg(not(feature = "gpu"))]
|
||||
impl<'n, I, O: 'n> Node<'n, I> for alloc::boxed::Box<dyn Node<'n, I, Output = O>> {
|
||||
type Output = O;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user