Game: the shader pack in an archive inflates through zlib-rs #2948
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2950"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T01:22:12Z.
What
shaderpack::find()reads the shader pack an archive holds as a run of zlib streams of at most 64 KiB, and inflated each one with miniz_oxide. It now inflates each one with zlib-rs (pure Rust, runtime SIMD dispatch), ininflate_one. It's the same crate and version #1355 proposes for DirectStorage:zlib-rs = { version = "0.6.8", default-features = false, features = ["std"] }. miniz_oxide stays for the tests and the other users.Measurement
600 streams of 64 KiB, release build, Ryzen 9 7900X,
inflate_bench(ignored), medians of 5 rounds each:Where it came from
From DexNom's fork, DexNom/VIctory@570a941:
find()withzlib_rs::Inflate. Credited withCo-authored-by: DexNom.#1355 converts DirectStorage and the other inflaters but predates this function. Whichever lands second only needs the workspace dependency line deduplicated.
Tested
shaderpack::tests::one_stream_inflates_alone: a stream gives its output and the bytes it took even with data after it. A truncated stream, one larger than the chunk, and bytes that aren't a stream give nothing.finds_a_pack_inside_an_archivepasses as before.cargo test -p victory-game: 16 passed.cargo build --workspace: builds.cargo clippy -p victory-game --all-targets -- -D warnings: clean.Not tested
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T01:31:55Z.
Code review and Windows 11 release benchmark verification at head
1d7602da385aonmain(63bcca43c6a0):crates/victory-game/src/shaderpack.rs:302-314,Cargo.toml/Cargo.lock):--locked(zlib-rs 0.6.9, Zlib-licensed, pure Rust).inflate_oneusesInflate::new(true, 15)into a fixed0x20000(128 KiB) buffer, requiresStatus::StreamEnd, rejects truncated/malformed/oversized (BufError) streams cleanly withNone, and slices exacttotal_in()/total_out()lengths.cargo xtask policy:191 files ok;cargo clippy --locked -p victory-game --tests -- -D warnings: 0 warningscargo test --locked -p victory-game: 16/16 passed (1 ignored bench, includingone_stream_inflates_alone)--releaseshaderpack::tests::inflate_bench:miniz_oxide: median 31.0 ms->zlib-rs: median 14.5 ms(2.14x speedup).LGTM.
Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-26T01:35:06Z.
Local verification on Windows / rustc 1.100.0 / MSVC, no game data, no GPU, no clippy/rustup.
842b0cb: 5 files, +93/-12.git diff --checkflags one pre-existing-style trailing whitespace in README.md:17 (displayed.); worth fixing.one_stream_inflates_aloneis absent from the base commit.cargo test --locked -p victory-game --lib -- shaderpack::tests::one_stream_inflates_alone --exact --quiet-> 1 passed, 16 filtered (CARGO_BUILD_JOBS=2).cargo test --locked -p victory-game --quiet-> 16 passed, 0 failed, 1 ignored.AI-assisted (Hy4 flash).
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T02:24:16Z.
Review: COMMENTED
Verified: inflate_one preserves the exact semantics the archive scan needs — StreamEnd + total_in/total_out for chained zlib streams at 16-byte alignment. zlib-rs 0.6.x is a solid choice (pure Rust, runtime SIMD). The pinned lock entry and the new edge tests (truncated, oversized, non-zlib, trailing bytes) cover the contract.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T04:29:47Z.
Automated triage for the maintainers.
Thanks. No new push, so the verdict stays the same: this needs the maintainer's decision on bringing in
zlib-rs. Both of your options work (land #1355 first and rebase this to only theinflate_oneswitch, or foldshaderpack.rsinto #1355), and the maintainer can pick one.CI: passing.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T07:00:30Z.
Agreed, the dependency should land once. #1355 (wbkepler) brings
zlib-rsin for the larger users (the DirectStorage and formats inflate). This PR is only theshaderpack::findcall site, which was added to main after #1355 branched, so #1355 doesn't cover it. I can't measure on the title's archives here.Two options, whichever is easier for you:
inflate_oneswitch plus its test, with no new dependency; orshaderpack.rschange into #1355 when it's rebased (it's conflicting right now), and close this.upstream-sync referenced this pull request2026-11-26 08:03:05 +00:00
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.