spirv-builder: force a single CGU (codegen-unit).

This commit is contained in:
Eduard-Mihai Burtescu 2023-04-15 18:28:32 +03:00 committed by Eduard-Mihai Burtescu
parent cbe922dc7f
commit b560a21453
2 changed files with 14 additions and 1 deletions

View File

@ -29,8 +29,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added ⭐
- [PR#1031](https://github.com/EmbarkStudios/rust-gpu/pull/1031) added `Components` generic parameter to `Image` type, allowing images to return lower dimensional vectors and even scalars from the sampling API
### Changed 🛠
- [PR#1031](https://github.com/EmbarkStudios/rust-gpu/pull/1031) Added `Components` generic parameter to `Image` type, allowing images to return lower dimensional vectors and even scalars from the sampling API.
- [PR#1035](https://github.com/EmbarkStudios/rust-gpu/pull/1035) reduced the number of CGUs ("codegen units") used by `spirv-builder` to just `1`
- [PR#1011](https://github.com/EmbarkStudios/rust-gpu/pull/1011) made `NonWritable` all read-only storage buffers (i.e. those typed `&T`, where `T` doesn't have interior mutability)
- [PR#1029](https://github.com/EmbarkStudios/rust-gpu/pull/1029) fixed SampledImage::sample() fns being unnecessarily marked as unsafe

View File

@ -578,6 +578,16 @@ fn invoke_rustc(builder: &SpirvBuilder) -> Result<PathBuf, SpirvBuilderError> {
join_checking_for_separators(rustflags, "\x1f"),
);
let profile_in_env_var = profile.replace('-', "_").to_ascii_uppercase();
// NOTE(eddyb) there's no parallelism to take advantage of multiple CGUs,
// and inter-CGU duplication can be wasteful, so this forces 1 CGU for now.
let num_cgus = 1;
cargo.env(
format!("CARGO_PROFILE_{profile_in_env_var}_CODEGEN_UNITS"),
num_cgus.to_string(),
);
let build = cargo
.stderr(Stdio::inherit())
.current_dir(&builder.path_to_crate)