mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 23:08:05 +08:00
* Start implementing GpuExecutor for wgpu * Implement read_output_buffer function * Implement extraction node in the compiler * Generate type annotations during shader compilation * Start adding node wrapprs for graph execution api * Wrap more of the api in nodes * Restructure Pipeline to accept arbitrary shader inputs * Adapt nodes to new trait definitions * Start implementing gpu-compiler trait * Adapt shader generation * Hardstuck on pointer casts * Pass nodes as references in gpu code to avoid zsts * Update gcore to compile on the gpu * Fix color doc tests * Impl Node for node refs
35 lines
697 B
Rust
35 lines
697 B
Rust
use crate::Node;
|
|
|
|
use core::marker::PhantomData;
|
|
use core::ops::{DerefMut, Index, IndexMut};
|
|
|
|
struct SetNode<S, I, Storage, Index> {
|
|
storage: Storage,
|
|
index: Index,
|
|
_s: PhantomData<S>,
|
|
_i: PhantomData<I>,
|
|
}
|
|
|
|
#[node_macro::node_fn(SetNode<_S, _I>)]
|
|
fn set_node<T, _S, _I>(value: T, storage: &'any_input mut _S, index: _I)
|
|
where
|
|
_S: IndexMut<_I>,
|
|
_S::Output: DerefMut<Target = T> + Sized,
|
|
{
|
|
*storage.index_mut(index).deref_mut() = value;
|
|
}
|
|
|
|
struct GetNode<S, Storage> {
|
|
storage: Storage,
|
|
_s: PhantomData<S>,
|
|
}
|
|
|
|
#[node_macro::node_fn(GetNode<_S>)]
|
|
fn get_node<_S, I>(index: I, storage: &'any_input _S) -> &'input _S::Output
|
|
where
|
|
_S: Index<I>,
|
|
_S::Output: Sized,
|
|
{
|
|
storage.index(index)
|
|
}
|