Compare commits

..

No commits in common. "262aa6364d0b429bd6e99254a974186a2f1d2dc1" and "2ce14e25d8f1685bd3486257cba4025587fd0fb9" have entirely different histories.

2 changed files with 7 additions and 6 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 = "2024" edition = "2021"
[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 = "25.0.0", features = ["wgsl-in"] } naga = { version = "23.0.0", features = ["wgsl-in"] }
regex = "1.11.1" regex = "1.11.1"

View File

@ -4,8 +4,7 @@ use {
naga::front::wgsl, naga::front::wgsl,
proc_macro::TokenStream, proc_macro::TokenStream,
quote::{format_ident, quote}, quote::{format_ident, quote},
std::path::Path, syn::{parse, LitStr},
syn::{LitStr, parse},
}; };
mod source_reader; mod source_reader;
@ -40,7 +39,9 @@ impl ShaderModule {
)) ))
} }
})?; })?;
Ok(Self { source_file }) Ok(Self {
source_file,
})
} }
fn emit_rust_code(&self) -> TokenStream { fn emit_rust_code(&self) -> TokenStream {
@ -102,7 +103,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 = Path::new(&token.span().local_file().unwrap()).parent().unwrap().into(); let source_dir = token.span().source_file().path().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 {