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 13, 2023
1 parent d98d6dd commit e9eaf7a
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 @@ -71,6 +71,8 @@ This feature allowed you to call `global_id` on any wgpu opaque handle to get a
- Naga'sn WGSL front and back ends now have experimental support for 64-bit floating-point literals: `1.0lf` denotes an `f64` value. There has been experimental support for an `f64` type for a while, but until now there was no syntax for writing literals with that type. As before, Naga module validation rejects `f64` values unless `naga::valid::Capabilities::FLOAT64` is requested. By @jimblandy in [#4747](https://github.com/gfx-rs/wgpu/pull/4747).
- 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 e9eaf7a

Please sign in to comment.