Remove mentions of 0.4 pre-releases and try making spirv-builder/README.md more readable.

This commit is contained in:
Eduard-Mihai Burtescu 2023-07-14 15:07:33 +03:00 committed by Eduard-Mihai Burtescu
parent 26fcbc0b67
commit a389a7993f
3 changed files with 19 additions and 20 deletions

View File

@ -8,7 +8,7 @@ use std::process::{Command, ExitCode};
/// Current `rust-toolchain.toml` file
/// 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");
//const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml");
const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain]
channel = "nightly-2023-05-27"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
@ -65,7 +65,7 @@ fn check_toolchain_version() -> Result<(), Box<dyn Error>> {
return Err(Box::<dyn Error>::from(format!(
r#"error: wrong toolchain detected (found commit hash `{current_hash}`, expected `{required_hash}`).
Make sure your `rust-toolchain` file contains the following:
Make sure your `rust-toolchain.toml` file contains the following:
-------------
{stripped_toolchain}
-------------"#

View File

@ -29,23 +29,26 @@ const SHADER: &[u8] = include_bytes!(env!("my_shaders.spv"));
## Building with `spirv-builder`
Because of its nature, `rustc_codegen_spirv`, and therefore `spirv-builder` by extension, require the use of a very specific nightly toolchain of Rust.
As `spirv-builder` relies on `rustc_codegen_spirv` being built for it (by Cargo, as a direct dependency), and due to the special nature of the latter (as a `rustc` codegen backend "plugin"), both end up sharing the requirement for a very specific nightly toolchain version of Rust.
**The current toolchain is: `nightly-2023-05-27`.**
**The current Rust toolchain version is: `nightly-2023-05-27`.**
Toolchains for previous versions of `spirv-builder`:
Rust toolchain version history across [rust-gpu releases](https://github.com/EmbarkStudios/rust-gpu/releases) (since `0.4`):
|Version|Toolchain|
|-:|-|
|`0.8.0`|`nightly-2023-04-15`|
|`0.7.0`|`nightly-2023-03-04`|
|`0.6.*`|`nightly-2023-01-21`|
|`0.5.0`|`nightly-2022-12-18`|
|`0.4.0`|`nightly-2022-10-29`|
|`0.4.0-alpha.16` - `0.4.0-alpha.17`|`nightly-2022-10-01`|
|`0.4.0-alpha.15`|`nightly-2022-08-29`|
|`0.4.0-alpha.13` - `0.4.0-alpha.14`|`nightly-2022-04-11`|
|`spirv-builder`<br>version|Rust toolchain<br>version|
|:-:|:-:|
|`0.8`|`nightly-2023-04-15`|
|`0.7`|`nightly-2023-03-04`|
|`0.6`|`nightly-2023-01-21`|
|`0.5`|`nightly-2022-12-18`|
|`0.4`|`nightly-2022-10-29`|
The nightly toolchain has to match *exactly*. Starting with `0.4.0-alpha.15`, the commit hash of your local toolchain is checked and you'll get a build error when building `rustc_codegen_spirv` with the wrong toolchain. If you want to experiment with different versions, this check can be omitted by defining the environment variable `RUSTGPU_SKIP_TOOLCHAIN_CHECK`<sup>since `0.4.0-alpha.16`</sup>. Keep in mind that, as `rustc_codegen_spirv` is heavily dependent on `rustc`'s internal API, diverging too much from the required toolchain will quickly result in compile errors.
<sup>*As patch versions must be semver-compatible, they will always require the
same toolchain (for example, `0.6.0` and `0.6.1` both use `nightly-2023-01-21`).*</sup>
Only that *exact* Rust nightly toolchain version is **supported**. Since `0.4`, the commit hash of your current Rust toolchain is checked and you'll get a build error when building `rustc_codegen_spirv` with the wrong toolchain.
Notably, the error will also show what the `rust-toolchain.toml` file *should* contain (to get the expected toolchain), which you can rely on when updating to a new release.
If you want to experiment with _different, **unsupported**_, Rust toolchain versions, this check can be omitted by defining the environment variable `RUSTGPU_SKIP_TOOLCHAIN_CHECK`. Keep in mind that, as `rustc_codegen_spirv` is *heavily* dependent on `rustc`'s internal APIs, diverging too much from the supported toolchain version will quickly result in compile errors (or worse, e.g. spurious errors and/or incorrect behavior, when compiling shaders with it).
[rustgpu]: https://github.com/EmbarkStudios/rust-gpu/

View File

@ -4,10 +4,6 @@ Core functions, traits, and more that make up a “standard library” for SPIR-
This crate gives a `rust-gpu` shader access to the required `#![spirv(..)]` attribute, as well as povide all kinds of APIs that allows a shader to access GPU resources such as textures and buffers. Optionally, through the use of the `"glam"` feature, it includes some boilerplate trait implementations to make `glam` vector types compatible with these APIs.
## 🚨 BREAKING 🚨
As of `0.4.0-alpha.16`, your shaders will require a different preamble. See [this migration guide][migration] for more information.
## Example
![Sky shader](https://github.com/EmbarkStudios/rust-gpu/raw/b12a2f3f6a54bc841d05a9224bc577909d519228/docs/assets/sky.jpg)