[naga xtask] Add validate all subcommand.

This commit is contained in:
Jim Blandy committed 2023-12-27 13:07:09 -08:00
1 parent 403db446e4
commit de3df51807
3 files changed
+31 -1

No files matched your search

+2
View File
@@ -83,6 +83,8 @@ Wgpu now exposes backend feature for the Direct3D 12 (`dx12`) and Metal (`metal`
- Add `--bulk-validate` option to Naga CLI. By @jimblandy in [#4871](https://github.com/gfx-rs/wgpu/pull/4871).
- Naga's `cargo xtask validate` now runs validation jobs in parallel, using the [jobserver](https://crates.io/crates/jobserver) protocol to limit concurrency, and offers a `validate all` subcommand, which runs all available validation types. By @jimblandy in [#4902](https://github.com/gfx-rs/wgpu/pull/4902).
### 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
+8 -1
View File
@@ -77,6 +77,8 @@ impl Subcommand {
}
}
// If you add a new validation subcommand, be sure to update the code
// that processes `All`.
#[derive(Debug)]
pub(crate) enum ValidateSubcommand {
Spirv,
@@ -85,6 +87,7 @@ pub(crate) enum ValidateSubcommand {
Dot,
Wgsl,
Hlsl(ValidateHlslCommand),
All,
}
impl ValidateSubcommand {
@@ -114,7 +117,11 @@ impl ValidateSubcommand {
ensure_remaining_args_empty(args)?;
Ok(Self::Wgsl)
}
"hlsl" => return Ok(Self::Hlsl(ValidateHlslCommand::parse(args)?)),
"hlsl" => Ok(Self::Hlsl(ValidateHlslCommand::parse(args)?)),
"all" => {
ensure_remaining_args_empty(args)?;
Ok(Self::All)
}
other => {
bail!("unrecognized `validate` subcommand {other:?}; see `--help` for more details")
}
+21
View File
@@ -142,6 +142,27 @@ fn collect_validation_jobs(jobs: &mut Vec<Job>, cmd: ValidateSubcommand) -> anyh
})
});
}
ValidateSubcommand::All => {
collect_validation_jobs(jobs, ValidateSubcommand::Wgsl)?;
collect_validation_jobs(jobs, ValidateSubcommand::Spirv)?;
collect_validation_jobs(jobs, ValidateSubcommand::Glsl)?;
collect_validation_jobs(jobs, ValidateSubcommand::Dot)?;
#[cfg(any(target_os = "macos", target_os = "ios"))]
collect_validation_jobs(jobs, ValidateSubcommand::Metal)?;
// The FXC compiler is only available on Windows.
//
// The DXC compiler can be built and run on any platform,
// but they don't make Linux releases and it's not clear
// what Git commit actually works on Linux, so restrict
// that to Windows as well.
#[cfg(windows)]
{
collect_validation_jobs(jobs, ValidateSubcommand::Hlsl(ValidateHlslCommand::Dxc))?;
collect_validation_jobs(jobs, ValidateSubcommand::Hlsl(ValidateHlslCommand::Fxc))?;
}
}
};
Ok(())