Compile node graph description to GPU code

This commit is contained in:
Dennis
2022-06-08 09:52:58 +02:00
committed by Keavon Chambers
parent 41a602bba9
commit 089a3f5684
10 changed files with 498 additions and 76 deletions

View File

@@ -8,7 +8,10 @@ pub struct CacheNode<'n, CachedNode: Node<'n>> {
cache: OnceCell<CachedNode::Output>,
_phantom: PhantomData<&'n ()>,
}
impl<'n, CashedNode: Node<'n>> Node<'n> for CacheNode<'n, CashedNode> {
impl<'n, CashedNode: Node<'n>> Node<'n> for CacheNode<'n, CashedNode>
where
CashedNode::Output: 'n,
{
type Output = &'n CashedNode::Output;
fn eval(&'n self) -> Self::Output {
self.cache.get_or_init(|| self.node.eval())