@@ -12,6 +12,7 @@ use syn::{
1212} ;
1313
1414use crate :: codegen:: generate_node_code;
15+ use crate :: shader_nodes:: ShaderNodeType ;
1516
1617#[ derive( Debug ) ]
1718pub ( crate ) struct Implementation {
@@ -47,6 +48,8 @@ pub(crate) struct NodeFnAttributes {
4748 pub ( crate ) properties_string : Option < LitStr > ,
4849 /// whether to `#[cfg]` gate the node implementation, defaults to None
4950 pub ( crate ) cfg : Option < TokenStream2 > ,
51+ /// if this node should get a gpu implementation, defaults to None
52+ pub ( crate ) shader_node : Option < ShaderNodeType > ,
5053 // Add more attributes as needed
5154}
5255
@@ -187,6 +190,7 @@ impl Parse for NodeFnAttributes {
187190 let mut skip_impl = false ;
188191 let mut properties_string = None ;
189192 let mut cfg = None ;
193+ let mut shader_node = None ;
190194
191195 let content = input;
192196 // let content;
@@ -249,6 +253,13 @@ impl Parse for NodeFnAttributes {
249253 let meta = meta. require_list ( ) ?;
250254 cfg = Some ( meta. tokens . clone ( ) ) ;
251255 }
256+ "shader_node" => {
257+ if shader_node. is_some ( ) {
258+ return Err ( Error :: new_spanned ( path, "Multiple 'feature' attributes are not allowed" ) ) ;
259+ }
260+ let meta = meta. require_list ( ) ?;
261+ shader_node = Some ( syn:: parse2 ( meta. tokens . to_token_stream ( ) ) ?) ;
262+ }
252263 _ => {
253264 return Err ( Error :: new_spanned (
254265 meta,
@@ -273,6 +284,7 @@ impl Parse for NodeFnAttributes {
273284 skip_impl,
274285 properties_string,
275286 cfg,
287+ shader_node,
276288 } )
277289 }
278290}
0 commit comments