1
- use crate :: parsing:: { ParsedField , ParsedNodeFn } ;
1
+ use crate :: parsing:: { Input , NodeFnAttributes , ParsedField , ParsedNodeFn } ;
2
2
use crate :: shader_nodes:: CodegenShaderEntryPoint ;
3
+ use convert_case:: { Case , Casing } ;
3
4
use proc_macro2:: { Ident , TokenStream } ;
4
5
use quote:: { ToTokens , format_ident, quote} ;
5
6
use std:: borrow:: Cow ;
6
7
use syn:: parse:: { Parse , ParseStream } ;
8
+ use syn:: { Path , Type , TypePath } ;
7
9
8
- #[ derive( Debug ) ]
10
+ #[ derive( Debug , Clone ) ]
9
11
pub struct PerPixelAdjust { }
10
12
11
13
impl Parse for PerPixelAdjust {
@@ -17,7 +19,7 @@ impl Parse for PerPixelAdjust {
17
19
impl CodegenShaderEntryPoint for PerPixelAdjust {
18
20
fn codegen_shader_entry_point ( & self , parsed : & ParsedNodeFn ) -> syn:: Result < TokenStream > {
19
21
let fn_name = & parsed. fn_name ;
20
- let gpu_mod = format_ident ! ( "{}_gpu " , parsed. fn_name) ;
22
+ let gpu_mod = format_ident ! ( "{}_gpu_entry_point " , parsed. fn_name) ;
21
23
let spirv_image_ty = quote ! ( Image2d ) ;
22
24
23
25
// bindings for images start at 1
@@ -93,6 +95,42 @@ impl CodegenShaderEntryPoint for PerPixelAdjust {
93
95
}
94
96
} )
95
97
}
98
+
99
+ fn codegen_gpu_node ( & self , parsed : & ParsedNodeFn ) -> syn:: Result < TokenStream > {
100
+ let fn_name = format_ident ! ( "{}_gpu" , parsed. fn_name) ;
101
+ let struct_name = format_ident ! ( "{}" , fn_name. to_string( ) . to_case( Case :: Pascal ) ) ;
102
+ let mod_name = fn_name. clone ( ) ;
103
+
104
+ let fields = todo ! ( ) ;
105
+ let body = todo ! ( ) ;
106
+
107
+ crate :: codegen:: generate_node_code ( & ParsedNodeFn {
108
+ vis : parsed. vis . clone ( ) ,
109
+ attributes : NodeFnAttributes {
110
+ shader_node : None ,
111
+ ..parsed. attributes . clone ( )
112
+ } ,
113
+ fn_name,
114
+ struct_name,
115
+ mod_name,
116
+ fn_generics : vec ! [ ] ,
117
+ where_clause : None ,
118
+ input : Input {
119
+ pat_ident : parsed. input . pat_ident . clone ( ) ,
120
+ ty : Type :: Path ( TypePath {
121
+ path : Path :: from ( format_ident ! ( "Ctx" ) ) ,
122
+ qself : None ,
123
+ } ) ,
124
+ implementations : Default :: default ( ) ,
125
+ } ,
126
+ output_type : parsed. output_type . clone ( ) ,
127
+ is_async : true ,
128
+ fields,
129
+ body,
130
+ crate_name : parsed. crate_name . clone ( ) ,
131
+ description : "" . to_string ( ) ,
132
+ } )
133
+ }
96
134
}
97
135
98
136
struct Param < ' a > {
0 commit comments