shader: a 16-bit load at a byte address ending in 3 reads its high byte as 0 #454
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#454
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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:07 UTC · original
Two load sites in
crates/victory-shader/src/emit/lower.rstake a byte or 16-bit field from the single dword that holds its first byte (// shortcut: the field is taken not to cross a dword.):Lower::flat(global and flat loads such asglobal_load_ushort) and the buffer path (buffer_load_ushortandbuffer_load_sshortthrough a buffer descriptor). A 16-bit field whose byte address ends in 3 continues into the next dword, so its high byte reads as 0, and a signed load gets the wrong sign. Bytes cannot cross a dword.The VIctory forks on Windows fixed the same shortcut by also reading the next dword (TaynanGT/Vice-Tay,
crates/victory-shader/src/emit/lower.rs,straddles).I have not measured yet whether the title hits it. Plan: a Metal test of 16-bit loads at byte offsets 0 to 3 that fails on main at offset 3; the fix for loads only (byte and half stores keep their two-atomic form for now); and a corpus sweep with no regressions.
@gagarinyury on GitHub · 2026-11-27 20:07 UTC · original
/claim
@github-actions[bot] on GitHub · 2026-11-27 20:07 UTC · original
Claimed by @gagarinyury. Open a draft pull request with
Refs #450in its description within 24 hours, or the claim expires.