Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
30c6502
compile_codegen: add compile_codegen feature
Firestar99 Apr 27, 2025
a30c580
compile_codegen: panic when `rustc_codegen_spirv_location` is not set
Firestar99 Apr 27, 2025
dd056a3
gitignore: .idea
Firestar99 Apr 27, 2025
7e3a7b5
compile_codegen: make SpirvBuilderError use thiserror
Firestar99 Apr 28, 2025
49a962b
compile_codegen: make SpirvBuilder fields pub, reuse spirv-tools structs
Firestar99 Apr 27, 2025
1c0baee
compile_codegen: forward missing codegen backend error
Firestar99 Apr 28, 2025
fe42c46
compile_codegen: fix watch feature
Firestar99 Apr 29, 2025
674214b
compile_codegen: fix lint
Firestar99 Apr 29, 2025
879338b
compile_codegen: validate `rustc_codegen_spirv_location` on build
Firestar99 Apr 29, 2025
bb5d2e0
compile_codegen: rename feature from `compile_codegen` to `rustc_code…
Firestar99 Apr 29, 2025
5235161
compile_codegen: add serde derives
Firestar99 Apr 29, 2025
de2cef8
compile_codegen: add clap feature, make SpirvBuilder args the same as…
Firestar99 Apr 29, 2025
d643a65
compile_codegen: derive Debug for SpirvBuilder
Firestar99 Apr 29, 2025
6a518ac
compile_codegen: make clip skip variables not previously exposed
Firestar99 Apr 29, 2025
744c844
compile_codegen: serde flatten
Firestar99 Apr 29, 2025
9a9ebc1
compile_codegen: add warning in build.rs about cargo gpu parsing
Firestar99 Apr 30, 2025
da624d1
compile_codegen: make SpirvBuilder::build() no longer consume self
Firestar99 Apr 30, 2025
b619665
compile_codegen: add SpirvBuilder.toolchain_overwrite
Firestar99 Apr 30, 2025
dcbdc52
compile_codegen: include_str! all target_spec jsons for cargo gpu
Firestar99 Apr 30, 2025
e040ab9
compile_codegen: SpirvBuilder: remove RUSTC env var before calling cargo
Firestar99 Apr 30, 2025
b8f659b
compile_codegen: SpirvBuilder: only use target_spec json when compile…
Firestar99 Apr 30, 2025
eca83df
compile_codegen: SpirvBuilder: fix `query_rustc_version()` for stable…
Firestar99 Apr 30, 2025
5db761e
compile_codegen: change default MetadataPrintout to None
Firestar99 May 1, 2025
3c9a7d7
compile_codegen: refactor watcher to call on_compilation_finishes() e…
Firestar99 May 1, 2025
74d1c66
compile_codegen: allow SpirvBuilder watch to return something on firs…
Firestar99 May 1, 2025
d8f0398
compile_codegen: fix typo
Firestar99 May 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ target/
tests/Cargo.lock
.github/install-spirv-tools/Cargo.lock
rustc-ice-*.txt
.idea
65 changes: 48 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/rustc_codegen_spirv-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true
repository.workspace = true

[dependencies]
spirv = { version = "0.3.0", features = ["serialize", "deserialize"] }
rspirv = "0.12"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
3 changes: 3 additions & 0 deletions crates/rustc_codegen_spirv/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ use std::process::{Command, ExitCode};
use std::{env, fs, mem};

/// Current `rust-toolchain.toml` file
/// WARNING!!! cargo-gpu is new relying on this being a string literal! It will
/// scan `build.rs` for any line starting with `channel = "..."` to figure out
/// which toolchain version to use! This also allows backwards compat.
/// Unfortunately, directly including the actual workspace `rust-toolchain.toml` doesn't work together with
/// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/
//const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml");
Expand Down
14 changes: 11 additions & 3 deletions crates/spirv-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ no-default-features = true
# that optional dependency, from being automatically created by Cargo, see:
# https://doc.rust-lang.org/cargo/reference/features.html#optional-dependencies
[features]
# See `rustc_codegen_spirv/Cargo.toml` for details on these features.
default = ["use-compiled-tools"]
use-installed-tools = ["dep:rustc_codegen_spirv", "rustc_codegen_spirv?/use-installed-tools"]
use-compiled-tools = ["dep:rustc_codegen_spirv", "rustc_codegen_spirv?/use-compiled-tools"]
# Compile `rustc_codegen_spirv`, allows constructing SpirvBuilder without
# explicitly passing in a path to a compiled `rustc_codegen_spirv.so` (or dll)
rustc_codegen_spirv = ["dep:rustc_codegen_spirv"]
# See `rustc_codegen_spirv/Cargo.toml` for details on these features.
use-installed-tools = ["rustc_codegen_spirv", "rustc_codegen_spirv?/use-installed-tools"]
use-compiled-tools = ["rustc_codegen_spirv", "rustc_codegen_spirv?/use-compiled-tools"]
skip-toolchain-check = ["rustc_codegen_spirv?/skip-toolchain-check"]

watch = ["dep:notify"]
clap = ["dep:clap"]

[dependencies]
# See comment in `src/lib.rs` `invoke_rustc` regarding `rustc_codegen_spirv` dep.
Expand All @@ -38,5 +42,9 @@ memchr = "2.4"
raw-string = "0.3.5"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "2.0.12"
semver = { version = "1.0.24", features = ["serde"] }

notify = { version = "7.0", optional = true }
# Pinning clap, as newer versions have raised min rustc version without being marked a breaking change
clap = { version = "=4.5.37", optional = true, features = ["derive"] }
Comment on lines +49 to +50
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really annoying, can this constraint be lifted now that the toolchain was upgraded? This prevents me from using newer clap version in the workspace downstream.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I seem to remember that I pinned that. Running cargo-gpu against newer rust-gpu versions was failing. cargo-gpu has tests for the last ~2 years of rust-gpu versions. So if you want to bump clap, and cargo-gpu tests pass then I think it's fine. And if they fail, then what @schell and I discussed is that cargo-gpu should aim to support the last 2 versions of rust-gpu. But I'm sure that could be relaxed if there's good reason.

Copy link
Member Author

@Firestar99 Firestar99 Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that you no longer directly depend on old spirv-builder versions since I refactored cargo-gpu, we always use the newest one. Only the codegen backend is now compiled in a potentially quite old toolchain, which doesn't need clap.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already updated in #349, everything looks good so far

Loading