Grow DirectStorage BCPack intermediates as zlib inflates #1238
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1238
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1238/head"
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?
@Jitheswar on GitHub · 2026-11-24 16:43 UTC · original
directstorage-sized-intermediate→main· +36 −8 · 1 files · 1 commits · closed without mergingBCPack 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
@Zipettte on GitHub · 2026-11-24 17:59 UTC · original
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).
@Marvisak on GitHub · 2026-11-25 01:27 UTC · original
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
@Jitheswar on GitHub · 2026-11-25 02:38 UTC · original
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