Grow DirectStorage BCPack intermediates as zlib inflates #1238
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1238"
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 Jitheswar on 2026-11-24T16:43:56Z.
BCPack requests with a zlib stage inflate into an intermediate buffer before BCPack decoding. That buffer was allocated at the request's
intermediate_sizeup front,vec![0; intermediate_size], and truncated after inflating. Titles pass a generous limit there, so each such request zero-filled a buffer far larger than its data (64 MiB for a small texture in the test fixture).What changes:
inflate_intermediateusesminiz_oxide'sdecompress_to_vec_zlib_with_limit. The buffer grows as bytes arrive and never exceeds the limit. Inflate errors map toINVALID_DATA, as before.Test (synthetic):
zlib_intermediate_grows_with_output_and_respects_its_limit:For the BC4 fixture, intermediate capacity drops from 64 MiB to 116 bytes, with identical decoded output. Windows-target clippy and the asset policy pass.
victory-hletests for the Windows target under Proton 11, merged onto940d32f: 142 passed / 2 failed. Plain940d32fgives 141 / 2 with the same two Wine-host failures (only_loopback_is_reachable,a_kept_blob_past_the_link_limit_is_copied); this PR adds the test above. Not run in the game for this change. Merges cleanly onto940d32f.AI-assisted (Claude Code, Codex).
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T17:59:35Z.
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
591932a:cargo test -p victory-hlepasses, 96 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:27:02Z.
Automated triage for the maintainers.
Needs work. In
execute(crates/victory-hle/src/modules/dstorage.rs), the zlib-then-BCPack path now inflates withdecompress_to_vec_zlib_with_limitinstead of zeroing a buffer ofintermediate_sizeup front. The change is correct: the limit is still enforced, the Adler-32 checksum is still checked, and the error mapping is unchanged.zlib_intermediate_grows_with_output_and_respects_its_limitcovers all three.The benefit isn't shown for the title, though. The "64 MiB → 116 bytes" figure comes from a synthetic test limit. If the title's requests give an
intermediate_sizeclose to the inflated size, as the existinginflatecomment suggests its chunks do, this only adds reallocations and copies as the vector grows. Please show the gap betweenintermediate_sizeand the inflated size on real requests (the existingdstoragetrace logsintermediate_size), or a measurement where the up-front allocation costs something.CI: not run.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Jitheswar on 2026-11-25T02:38:05Z.
Measured as requested, and the review was right. I logged
intermediate_sizeagainst the inflated length on every zlib-then-BCPack request, local probe only, Grand Theft Auto VI Xbox Series 1.0.2.1 (my own dump), RTX 3050 6 GB under Proton. Two runs, through boot, the menus and about two minutes into the story load and world streaming: zero such requests. On what this title does early on, the path never runs, so there's no measured benefit to set against the extra reallocations you pointed out. Closing; I'll reopen with numbers if a later phase turns out to use it. Thanks for the careful review. AI-assisted (Claude Code).Pull request closed