GPU: a pipeline stream's shader bytecode is read unaligned #2299
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2301"
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 denkencar-sketch on 2026-11-25T10:05:40Z.
Summary
A pipeline stream is a byte slice that need not be 8-aligned; the reference made over it to read the shader bytecode was undefined behaviour and a panic in checked builds. It is now read unaligned.
Testing
Test
a_stream_of_any_alignment_is_readaborts onmain(misaligned dereference) and passes with this change.cargo test --workspace --lockedpasses apart from known flakes:modules::dstorage::tests::a_page_list_filled_after_its_request_startsfails now and then onmaintoo, and so does a parallel-run flake invictory-gpu's lib tests (watch::anddescriptor::host::tests, 2 of 40 runs on pristinemain).Not tried: a run in the game.
AI-assisted.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T10:19:17Z.
Review: COMMENTED
Pipeline stream shader bytecode read unaligned (read_unaligned) — slice alignment not promised. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Correct fix for unaligned title buffers.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:21:27Z.
Automated triage for the maintainers.
Merge candidate (worth a look).
read_streamincrates/victory-gpu/src/pipeline.rsturnedstream[at + 8..]into a&Bytecodereference. The stream is only a&[u8], and on the pre-build path (Prebuild::graphics, called fromapps/victory/src/prebuild.rs) it comes from aVec<u8>, so nothing guarantees 8-byte alignment: the reference is undefined behaviour and debug builds trap on it. The PR reads theBytecodewithread_unaligned, asGraphicsState::readinpipeline/host.rsalready does for every other subobject. I checked the new test againstsubobject(): kind 1 is the 24-byte vertex subobject, and the loop stops cleanly at the end of the 32-byte slice. CI: passing.Generated by Claude Code