[naga xtask] Use naga-cli's --bulk-validate option.

Use `naga --bulk-validate` for `cargo xtask validate wgsl`, reducing
runtime from 12s to 0.8s.
This commit is contained in:
Jim Blandy 2023-12-12 15:57:52 -08:00
parent 9013e226c3
commit 9afd54ea24
2 changed files with 12 additions and 4 deletions

View File

@ -81,6 +81,8 @@ Wgpu now exposes backend feature for the Direct3D 12 (`dx12`) and Metal (`metal`
- Naga constant evaluation can now process binary operators whose operands are both vectors. By @jimblandy in [#4861](https://github.com/gfx-rs/wgpu/pull/4861).
- Add `--bulk-validate` option to Naga CLI. By @jimblandy in [#4871](https://github.com/gfx-rs/wgpu/pull/4871).
### Changes
- Arcanization of wgpu core resources: By @gents83 in [#3626](https://github.com/gfx-rs/wgpu/pull/3626) and thanks also to @jimblandy, @nical, @Wumpf, @Elabajaba & @cwfitzgerald

View File

@ -188,10 +188,16 @@ fn run(args: Args) -> anyhow::Result<()> {
})
}
ValidateSubcommand::Wgsl => {
visit_files(snapshots_base_out, "wgsl/*.wgsl", |path| {
ack_visiting(path);
EasyCommand::new("cargo", |cmd| cmd.args(["run", "-p", "naga-cli", "--"]).arg(path)).success()
})
let mut paths = vec![];
let mut error_status = visit_files(snapshots_base_out, "wgsl/*.wgsl", |path| {
paths.push(path.to_owned());
Ok(())
});
EasyCommand::new("cargo", |cmd| {
cmd.args(["run", "-p", "naga-cli", "--", "--bulk-validate"]).args(paths)
}).success()
.log_if_err_found(&mut error_status);
error_status
}
ValidateSubcommand::Hlsl(cmd) => {
let visit_hlsl = |consume_config_item: &mut dyn FnMut(