diff --git a/Cargo.toml b/Cargo.toml index ecb5ced..9a448e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,9 +12,9 @@ categories = ["game-development", "graphics"] include = ["/Cargo.toml", "/LICENSE", "/README.md", "/src/**"] [dependencies] -syn = { version = "1.0", features = ["full"] } +syn = { version = "2.0", features = ["full"] } naga = { version = "0.13", features = ["wgsl-in", "wgsl-out"] } -naga-to-tokenstream = "0.1" +naga-to-tokenstream = "0.3" proc-macro2 = "1.0" quote = "1.0" diff --git a/examples/struct_export.rs b/examples/struct_export.rs new file mode 100644 index 0000000..d8dc213 --- /dev/null +++ b/examples/struct_export.rs @@ -0,0 +1,14 @@ +mod shader { + wgsl_inline::wgsl! { + struct MyStruct { + foo: f32, + bar: u32 + } + } +} + +fn main() { + let my_struct = shader::types::MyStruct { foo: 1.0, bar: 12 }; + + println!("my struct: {:?}", my_struct); +} diff --git a/src/result.rs b/src/result.rs index c0e6c72..72db049 100644 --- a/src/result.rs +++ b/src/result.rs @@ -61,7 +61,12 @@ impl ShaderResult { } } - let mut module_items = naga_to_tokenstream::ModuleToTokens::to_items(&self.module); + let mut module_items = naga_to_tokenstream::ModuleToTokens::to_items( + &self.module, + naga_to_tokenstream::ModuleToTokensConfig { + structs_filter: None, + }, + ); items.append(&mut module_items); items