shader: clamp record constant loads per dword (fixes torn faces, #18) #29
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem!29
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/29/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?
@Tom1tk on GitHub · 2026-11-30 12:56 UTC · original
Tom1tk:fix-face-record-bounds→main· +18 −4 · 2 files · 1 commits · merged 2026-11-30 15:36 UTCFixes #18: torn faces and colourful noise on characters' faces in cutscenes.
Cause
In records mode, scalar constant loads (
s_buffer_load_dwordx2..x16) go throughraw_dwords(), which clamped each group of up to four dwords as one unit (self.at(h, a, 4 * n)). If any dword ran past the end of the record, all of them read 0.The console checks each dword against the record size on its own, so the dwords before the end are still read. Face shaders read indices that sit just before a record's end. For example,
6b176df5514d9a3fdoes ans_buffer_load_dwordx4at 0x14 and uses s28–s30 as indices. Those came back 0, and the shader pulled the wrong face data.Change
crates/victory-shader/src/emit/lower.rs,raw_dwords():self.at(h, start, 4)).IULTcheck asat().TRANSLATOR_VERSIONgoes from 7 to 8, so cached translations are redone.The other smem path was already per-dword. The
WIDEpath is untouched (off by default).The bounds clamp stays on for every load, so there is no need to bring back the
VICTORY_REC_BOUNDSswitch or change any record lengths, the two options raised in #18.Before / after
Same frames, same build, with only this change reverted vs applied:
Testing
cargo test -p victory-shader --releaseon this branch: 276 passed, 0 failed.The in-game runs were done on a branch based on
2773fdf, before the latest main. On current main, this branch was only checked by the unit tests. Only the opening and therapist cutscenes were checked.@thedee8086 on GitHub · 2026-12-01 03:17 UTC · original
Confirmed on RDNA3 (RX 7900 XTX): before this clamp, wobbling "underwater" character faces at 1440p upscaled; after, completely gone. The symptom read as temporal wobble at reduced render scale rather than tearing, in case that helps anyone connect reports.
s_buffer_loadwith bounded records: one dword past the view zeroes the whole group #59