Compare commits

...

3 Commits

Author SHA1 Message Date
Matthew Gordon 262aa6364d Update rust edition and naga version 2025-05-10 09:19:56 -03:00
Matthew Gordon 439082dad3 Update to reflect changes to proc_macro
I was using the unstable Span::source_file() function which has been
removed. Replaced with Span::local_file().
2025-05-10 09:18:22 -03:00
Matthew Gordon 56c8652c57 Code formatting 2025-05-10 09:17:45 -03:00
2 changed files with 6 additions and 7 deletions

View File

@ -1,7 +1,7 @@
[package] [package]
name = "wgsl-shader-assembler" name = "wgsl-shader-assembler"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2024"
[lib] [lib]
proc-macro = true proc-macro = true
@ -9,5 +9,5 @@ proc-macro = true
[dependencies] [dependencies]
quote = "1.0" quote = "1.0"
syn = "2.0.90" syn = "2.0.90"
naga = { version = "23.0.0", features = ["wgsl-in"] } naga = { version = "25.0.0", features = ["wgsl-in"] }
regex = "1.11.1" regex = "1.11.1"

View File

@ -4,7 +4,8 @@ use {
naga::front::wgsl, naga::front::wgsl,
proc_macro::TokenStream, proc_macro::TokenStream,
quote::{format_ident, quote}, quote::{format_ident, quote},
syn::{parse, LitStr}, std::path::Path,
syn::{LitStr, parse},
}; };
mod source_reader; mod source_reader;
@ -39,9 +40,7 @@ impl ShaderModule {
)) ))
} }
})?; })?;
Ok(Self { Ok(Self { source_file })
source_file,
})
} }
fn emit_rust_code(&self) -> TokenStream { fn emit_rust_code(&self) -> TokenStream {
@ -103,7 +102,7 @@ fn parse_input(token_stream: TokenStream) -> Result<WgslModuleMacroInput, Error>
.next() .next()
.ok_or(Error::from_message("Expected single string literal."))?; .ok_or(Error::from_message("Expected single string literal."))?;
let source_dir = token.span().source_file().path().parent().unwrap().into(); let source_dir = Path::new(&token.span().local_file().unwrap()).parent().unwrap().into();
let literal: LitStr = parse(token_stream)?; let literal: LitStr = parse(token_stream)?;
let filename = std::path::Path::new(&literal.value()).into(); let filename = std::path::Path::new(&literal.value()).into();
Ok(WgslModuleMacroInput { Ok(WgslModuleMacroInput {