11use crate :: parsing:: { Input , NodeFnAttributes , ParsedField , ParsedFieldType , ParsedNodeFn , RegularParsedField } ;
2- use crate :: shader_nodes:: CodegenShaderEntryPoint ;
2+ use crate :: shader_nodes:: { CodegenShaderEntryPoint , ShaderNodeType } ;
33use convert_case:: { Case , Casing } ;
4- use proc_macro2:: { Ident , TokenStream } ;
4+ use proc_macro2:: { Ident , Span , TokenStream } ;
55use quote:: { ToTokens , format_ident, quote} ;
66use std:: borrow:: Cow ;
77use syn:: parse:: { Parse , ParseStream } ;
8- use syn:: { Path , Type , TypePath } ;
8+ use syn:: punctuated:: Punctuated ;
9+ use syn:: { Path , Token , TraitBound , TraitBoundModifier , Type , TypeImplTrait , TypeParamBound } ;
910
1011#[ derive( Debug , Clone ) ]
1112pub struct PerPixelAdjust { }
@@ -115,12 +116,16 @@ impl CodegenShaderEntryPoint for PerPixelAdjust {
115116 ParsedFieldType :: Node { .. } => Err ( syn:: Error :: new_spanned ( & f. pat_ident , "PerPixelAdjust shader nodes cannot accept other nodes as generics" ) ) ,
116117 } )
117118 . collect :: < syn:: Result < _ > > ( ) ?;
118- let body = quote ! { } ;
119+ let body = quote ! {
120+ {
121+
122+ }
123+ } ;
119124
120125 crate :: codegen:: generate_node_code ( & ParsedNodeFn {
121126 vis : parsed. vis . clone ( ) ,
122127 attributes : NodeFnAttributes {
123- shader_node : None ,
128+ shader_node : Some ( ShaderNodeType :: GpuNode ) ,
124129 ..parsed. attributes . clone ( )
125130 } ,
126131 fn_name,
@@ -130,9 +135,14 @@ impl CodegenShaderEntryPoint for PerPixelAdjust {
130135 where_clause : None ,
131136 input : Input {
132137 pat_ident : parsed. input . pat_ident . clone ( ) ,
133- ty : Type :: Path ( TypePath {
134- path : Path :: from ( format_ident ! ( "Ctx" ) ) ,
135- qself : None ,
138+ ty : Type :: ImplTrait ( TypeImplTrait {
139+ impl_token : Token ! [ impl ] ( Span :: call_site ( ) ) ,
140+ bounds : Punctuated :: from_iter ( [ TypeParamBound :: Trait ( TraitBound {
141+ paren_token : None ,
142+ modifier : TraitBoundModifier :: None ,
143+ lifetimes : None ,
144+ path : Path :: from ( format_ident ! ( "Ctx" ) ) ,
145+ } ) ] ) ,
136146 } ) ,
137147 implementations : Default :: default ( ) ,
138148 } ,
0 commit comments