mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Don't print the module in converter if no output is specified (#744)
This commit is contained in:
@@ -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
|
||||
```
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user