Skip to content

Commit

Permalink
[naga xtask] Use naga-cli's --bulk-validate option.
Browse files Browse the repository at this point in the history
Use `naga --bulk-validate` for `cargo xtask validate wgsl`, reducing
runtime from 12s to 0.8s.
  • Loading branch information
jimblandy committed Dec 24, 2023
1 parent 9013e22 commit 9afd54e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 10 additions & 4 deletions naga/xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 9afd54e

Please sign in to comment.