shader: a 16-bit load at a dword's last byte reads the next dword (#450) #456
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!456
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-452"
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?
@gagarinyury on GitHub · 2026-11-27 20:17 UTC · original
gagarinyury:fix/half-across-dword→main· +213 −18 · 5 files · 1 commits · openWhat this changes
Refs #454
global_load_ushort/sshortandbuffer_load_ushort/sshortread only the dword that holds the field's first byte (// shortcut: the field is taken not to cross a dword.), so a 16-bit value at a byte address ending in 3 lost its high byte: it read 0, or the wrong sign forsshort.Both load sites in
crates/victory-shader/src/emit/lower.rs(Lower::flatand the buffer path) now also read the next dword, at+ 4in the same view. For title memory that goes through the same page lookup, as multi-dword loads already do. The two dwords are joined as(w0 >> 24) | (w1 << 8)before the 16-bit extension.straddles(TaynanGT/Vice-Tay).How it was tested
half_load_tests(victory-gpu, Metal) has a global case and a buffer case:ushortat byte offsets 0 to 3, andsshortat 3.mainboth fail at offset 3, reading0x44for0x8544.cargo test -p victory-shader: 402 + 5 passed.cargo test -p victory-gpu --lib split_wave_tests: 47 passed.cargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-msvc -- -D warnings: clean.cargo xtask policy: 399 files ok.b998bb65(sweep -j 4andtools/corpus/compare.sh, 25,985 containers from my own boot dump):buffer_load_ushortand 6global_load_ushortbetween them), so the change in each is the added read of the next dword.main.Not measured: whether the title reads halves at byte 3 at run time.
github-bot referenced this pull request2026-11-27 22:05:17 +00:00
github-bot referenced this pull request2026-11-27 22:22:56 +00:00
@Olima34 on GitHub · 2026-11-28 00:37 UTC · original · requested changes
Thanks for this PR! We're helping the maintainer clear the queue tonight, and main has moved a lot (the preview branch landed as
86cefd22, then a batch of PRs; main is nowa6a58361). This branch now conflicts with main incrates/victory-gpu/src/native/addr_tests.rs.Could you merge current
maininto the branch (a merge commit is fine, no need to rebase) and resolve the conflict? Main may now have a test helper of the same name (try_translate_native); if so, keep one copy. Once GitHub shows it as mergeable and CI is green on the new head, we'll read it through and merge it if it holds up.@Olima34 on GitHub · 2026-11-28 00:46 UTC · original
The maintainer is handling this one himself; please follow his lead rather than my review.
github-bot referenced this pull request2026-11-28 03:18:48 +00:00
github-bot referenced this pull request2026-11-28 05:41:16 +00:00
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.