shader: handle dword-straddling 16-bit typed buffer loads at byte offset 3 #1669
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!1669
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1669"
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?
@geiyiliyabumo on GitHub · 2026-11-24 20:36 UTC · original
geiyiliyabumo:fix/shader-tbuffer-16bit-straddle→main· +180 −2 · 2 files · 1 commits · openSummary
total == 16:16_*and8_8_*families) inLower::format_load(crates/victory-shader/src/emit/lower.rs) when the byte offset satisfiesoff & 3 == 3.format_loadalignedat = off & !3, loaded a single dword, and shifted right by(off & 3) * 8, which left bits[15:8]zeroed whenever a 16-bit element straddled into dwordat + 4.total == 16loads the second dword atselect(byte == 3, at + 4, at)and merges(w0 >> 24) | (w1 << 8)whenbyte == 3. Re-readingatwhenbyte != 3ensures loads atbuffer_end - 2never touch past the buffer end; 8-bit formats (total == 8) remain single-dword loads.Verification
cargo test -p victory-shader --lib: 121 passed, 0 failed, 1 ignored on both AMD Radeon RX 9060 XT (D3D12 hardware) and Microsoft Basic Render Driver (WARP), includingtbuffer_16bit_format_loads_handle_dword_straddling_and_tail_boundscovering16_UINTacross all byte offsets0..=6(including straddling offset 3 and tail offsetbuffer_end - 2on both 8-byte and 4-byte buffers),16_SINTnegative sign extension at offset 3,16_FLOATat offset 3, and 2-channel8_8_UINT(tbuffer_load_format_xy) at offset 3.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: pass (154 files).AI-assisted; synthetic tests only, no game files.
@Marvisak on GitHub · 2026-11-25 01:34 UTC · original · edited 2026-11-25 22:17 UTC
Automated triage for the maintainers.
Needs rebase. This PR no longer merges cleanly into
main(conflict incrates/victory-shader/src/emit/valu_tests.rs). It will be reviewed again once it is rebased.From the earlier needs-work note, still open: evidence (console capture or a title program) that 16-bit format loads at byte offset 3 straddle two dwords on the console.
Generated by Claude Code
@Headache3318 on GitHub · 2026-11-25 01:36 UTC · original
Tested on Linux (Arch, kernel 7.3.5, 3× RTX 4090 driver 620.73.04), Rust 1.98.1 (pinned). PR head
70d3a82applied cleanly onto currentmainccfb029.cargo test -p victory-shader --locked: 96 passed, 0 failed, 1 ignored. All tests pass.cargo clippy -p victory-shader --all-targets -- -D warnings: 2 unused-import errors in test code — these are pre-existing on main (ccfb029fails identically). The PR introduces no new clippy warnings.Not tested: Windows MSVC build, the title itself. AI-assisted.
@geiyiliyabumo on GitHub · 2026-11-25 02:25 UTC · original
Rebased cleanly onto \main\ (\
ccfb029). \cargo test -p victory-shader --locked tbuffer\ (verified on physical AMD RX 9060 XT + WARP + Microsoft \dxil.dll), \cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings, and \cargo xtask policy\ all pass.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.