diff --git a/README.md b/README.md index 2224fab6e9..6482c9ab4c 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Front-end | Status | Feature | Notes | --------------- | ------------------ | ------- | ----- | SPIR-V (binary) | :white_check_mark: | spv-in | | WGSL | :white_check_mark: | wgsl-in | | -GLSL | :ok: | glsl-in | Vulkan flavor is expected | +GLSL | :construction: | glsl-in | Vulkan flavor is expected | Rust | | | | Back-end | Status | Feature | Notes | @@ -36,7 +36,8 @@ DOT (GraphViz) | :ok: | dot-out | Not a shading language | Naga includes a default binary target "convert", which allows to test the conversion of different code paths. ```bash -cargo run --features spv-in -- my_shader.spv # dump the IR module to debug output +cargo run --features wgsl-in -- my_shader.wgsl # validate only +cargo run --features spv-in -- my_shader.spv - # dump the IR module to debug output cargo run --features spv-in,msl-out -- my_shader.spv my_shader.metal --flow-dir flow-dir # convert the SPV to Metal, also dump the SPIR-V flow graph to `flow-dir` cargo run --features wgsl-in,glsl-out -- my_shader.wgsl my_shader.vert --profile es310 # convert the WGSL to GLSL vertex stage under ES 3.20 profile ``` diff --git a/bin/convert.rs b/bin/convert.rs index 978756cffb..126c4d7d4e 100644 --- a/bin/convert.rs +++ b/bin/convert.rs @@ -23,10 +23,10 @@ trait PrettyResult { } fn print_err(error: impl Error) { - println!("{}:", error); + eprintln!("{}:", error); let mut e = error.source(); while let Some(source) = e { - println!("\t{}", source); + eprintln!("\t{}", source); e = source.source(); } } @@ -174,7 +174,6 @@ fn main() { }; // validate the IR - #[allow(unused_variables)] let info = match naga::valid::Validator::new(naga::valid::ValidationFlags::all()).validate(&module) { Ok(info) => Some(info), @@ -187,11 +186,20 @@ fn main() { let output_path = match output_path { Some(ref string) => string, None => { - println!("{:#?}", module); - println!("{:#?}", info); + if info.is_some() { + println!("Validation successful"); + } return; } }; + if output_path == "-" { + println!("{:#?}", module); + if let Some(info) = info { + println!(); + println!("{:#?}", info); + } + return; + } match Path::new(output_path) .extension()