Add zstd release note

This commit is contained in:
atlas 2025-07-09 01:08:07 -04:00
parent 0ee937784e
commit a7d68c64b0
2 changed files with 29 additions and 2 deletions

View File

@ -58,7 +58,7 @@ pub fn ktx2_buffer_to_image(
})?;
levels.push(decompressed);
}
#[cfg(feature = "zstd_rust")]
#[cfg(all(feature = "zstd_rust", not(feature = "zstd_c")))]
SupercompressionScheme::Zstandard => {
let mut cursor = std::io::Cursor::new(level.data);
let mut decoder = ruzstd::decoding::StreamingDecoder::new(&mut cursor)
@ -71,7 +71,7 @@ pub fn ktx2_buffer_to_image(
})?;
levels.push(decompressed);
}
#[cfg(all(feature = "zstd_c", not(feature = "zstd_rust")))]
#[cfg(feature = "zstd_c")]
SupercompressionScheme::Zstandard => {
levels.push(zstd::decode_all(level.data).map_err(|err| {
TextureError::SuperDecompressionError(format!(

View File

@ -0,0 +1,27 @@
---
title: Faster Zstd decompression option
authors: ["@atlv24", "@brianreavis"]
pull_requests: [19793]
---
There is now an option to use the [zstd](https://crates.io/crates/zstd) c-bindings instead of [ruzstd](https://crates.io/crates/ruzstd).
This is less safe and portable, but can be around 44% faster.
The two features that control which one is used are `zstd_rust` and `zstd_c`.
`zstd_rust` is enabled by default, but `zstd_c` takes precedence if both are enabled.
To enable it, add the feature to the `bevy` entry of your Cargo.toml:
```toml
bevy = { version = "0.17.0", features = ["zstd_c"] }
```
Note: this will still include a dependency on `ruzstd`, because mutually exclusive features are not supported by Cargo.
To remove this dependency, disable default-features, and manually enable any default features you need:
```toml
bevy = { version = "0.17.0", default-features = false, features = [
"zstd_c",
"bevy_render", // etc..
] }
```