From 8c913d698210177272364a3eac70e611c488e11c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 14:25:52 +0000 Subject: [PATCH 1/4] Update syn requirement from 1.0 to 2.0 Updates the requirements on [syn](https://github.com/dtolnay/syn) to permit the latest version. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/1.0.0...2.0.38) --- updated-dependencies: - dependency-name: syn dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 7ccc2db..43788cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ 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.12", features = ["wgsl-in", "wgsl-out"] } naga-to-tokenstream = "0.1" proc-macro2 = "1.0" From fa14f83922bb86b40fa3d805daa65f5652d41734 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 14:25:56 +0000 Subject: [PATCH 2/4] Update naga-to-tokenstream requirement from 0.1 to 0.3 Updates the requirements on [naga-to-tokenstream](https://github.com/LucentFlux/naga-to-tokenstream) to permit the latest version. - [Commits](https://github.com/LucentFlux/naga-to-tokenstream/commits) --- updated-dependencies: - dependency-name: naga-to-tokenstream dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 7ccc2db..8678427 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ include = ["/Cargo.toml", "/LICENSE", "/README.md", "/src/**"] [dependencies] syn = { version = "1.0", features = ["full"] } naga = { version = "0.12", features = ["wgsl-in", "wgsl-out"] } -naga-to-tokenstream = "0.1" +naga-to-tokenstream = "0.3" proc-macro2 = "1.0" quote = "1.0" From ea38ffdf6a1472745c5c1cdde08dfc8149750c60 Mon Sep 17 00:00:00 2001 From: Joe O'Connor Date: Thu, 19 Oct 2023 15:42:25 +0100 Subject: [PATCH 3/4] Use newer API --- src/result.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 From c0b3905d5cd5733b9f8c476a259863aecebc0aff Mon Sep 17 00:00:00 2001 From: Joe O'Connor Date: Thu, 19 Oct 2023 15:44:36 +0100 Subject: [PATCH 4/4] Add struct export example --- examples/struct_export.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 examples/struct_export.rs 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); +}