Skip to content

Commit

Permalink
[naga xtask] Add validate all subcommand.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimblandy committed Dec 19, 2023
1 parent f646602 commit 60f1c69
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 79,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).

- 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
Expand Down
7 changes: 6 additions & 1 deletion naga/xtask/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 85,7 @@ pub(crate) enum ValidateSubcommand {
Dot,
Wgsl,
Hlsl(ValidateHlslCommand),
All,
}

impl ValidateSubcommand {
Expand Down Expand Up @@ -114,7 115,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")
}
Expand Down
18 changes: 18 additions & 0 deletions naga/xtask/src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 126,24 @@ fn collect_validation_jobs(jobs: &mut Vec<Job>, cmd: ValidateSubcommand) -> anyh
})
});
}
ValidateSubcommand::All => {
collect_validation_jobs(jobs, ValidateSubcommand::Spirv)?;

#[cfg(any(target_os = "macos", target_os = "ios"))]
collect_validation_jobs(jobs, ValidateSubcommand::Metal)?;

collect_validation_jobs(jobs, ValidateSubcommand::Spirv)?;
collect_validation_jobs(jobs, ValidateSubcommand::Glsl)?;
collect_validation_jobs(jobs, ValidateSubcommand::Dot)?;
collect_validation_jobs(jobs, ValidateSubcommand::Wgsl)?;

// The DXC compiler can be built and run on any platform.
collect_validation_jobs(jobs, ValidateSubcommand::Hlsl(ValidateHlslCommand::Dxc))?;

// The FXC compiler is only available on Windows.
#[cfg(windows)]
collect_validation_jobs(jobs, ValidateSubcommand::Hlsl(ValidateHlslCommand::Fxc))?;
}
};

Ok(())
Expand Down

0 comments on commit 60f1c69

Please sign in to comment.