Legacy multiply-add as RDNA 2 runs it (fused, sources flushed): faces' lips #454

Open
LofisMusk wants to merge 2 commits from upstream-pr/454 into main
LofisMusk commented 2026-11-27 10:31:16 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by LofisMusk on 2026-11-27T10:31:16Z.


Characters' lips looked pursed and pushed out on Linux under Wine (RX 7900 XTX). This came up as the follow-up to #449, once the head skin was back.

v_mac_legacy_f32 and v_mad_legacy_f32 were translated as a legacy multiply followed by an add. RDNA 2 decodes the legacy encoding as fused (v_fma_legacy_f32) and flushes its sources, keeping the legacy rule that a zero factor gives a zero product. This ports fxceless f6a09d3 (fork PR #1026).

Measured: 6,040 of the title's 25,790 shader translations change. With them the lips close and open naturally, in the same place and with the same moves as before. For comparison, the SDWA sext fix (upstream #3124) changes none of this title's translations.

The translator's output changes, so run victory shaders again (or delete the shader cache).

🤖 Generated with Claude Code

https://claude.ai/code/session_018VwqyDRnxhcvy1dojRs4Cr

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:5525108668 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/454). Originally posted by [LofisMusk](https://github.com/LofisMusk) on 2026-11-27T10:31:16Z. --- Characters' lips looked pursed and pushed out on Linux under Wine (RX 7900 XTX). This came up as the follow-up to #449, once the head skin was back. `v_mac_legacy_f32` and `v_mad_legacy_f32` were translated as a legacy multiply followed by an add. RDNA 2 decodes the legacy encoding as fused (`v_fma_legacy_f32`) and flushes its sources, keeping the legacy rule that a zero factor gives a zero product. This ports fxceless f6a09d3 (fork PR #1026). **Measured:** 6,040 of the title's 25,790 shader translations change. With them the lips close and open naturally, in the same place and with the same moves as before. For comparison, the SDWA sext fix (upstream #3124) changes none of this title's translations. The translator's output changes, so run `victory shaders` again (or delete the shader cache). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018VwqyDRnxhcvy1dojRs4Cr
UwUCammie commented 2026-11-27 10:54:13 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by UwUCammie on 2026-11-27T10:54:13Z.


I ran a generated v_mad_legacy_f32 fixture against this change on the RX 7900 XT with Wine 11.22, RADV 26.3.1 and vkd3d-proton 71cae091b06571e. (1 + 2^-23) * (1 - 2^-23) - 1 returned 0x00000000. The fused result is 0xa8800000 (-2^-46).

The same fixture hit this on vkd3d-proton 3.1 with the earlier fx change. Decorating the generated SPIR-V Fma with NoContraction made all four cases pass there. This is a game-free repro, so I can’t tell from it what happens to the mouth in-game.

Fixture · Earlier driver test

The follow-up on the current driver confirmed that the generated SPIR-V has one Fma and no NoContraction on its result. I added that single decoration to the fixture SPIR-V, ran spirv-val, and reran with the same executable and driver, with the driver cache disabled in both runs. All four cases passed. The override was scoped to the generated fixture. The Wine gameplay candidate is still held.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7216444516 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/454#issuecomment-7216444516). Originally posted by [UwUCammie](https://github.com/UwUCammie) on 2026-11-27T10:54:13Z. --- I ran a generated `v_mad_legacy_f32` fixture against this change on the RX 7900 XT with Wine 11.22, RADV 26.3.1 and vkd3d-proton `71cae091b06571e`. `(1 + 2^-23) * (1 - 2^-23) - 1` returned `0x00000000`. The fused result is `0xa8800000` (`-2^-46`). The same fixture hit this on vkd3d-proton 3.1 with the earlier fx change. Decorating the generated SPIR-V `Fma` with `NoContraction` made all four cases pass there. This is a game-free repro, so I can’t tell from it what happens to the mouth in-game. [Fixture](https://github.com/UwUCammie/VIctory-7900XTX/commit/2d6dfec8) · [Earlier driver test](https://github.com/fxceless/victory-fork/pull/1026#issuecomment-7187623405) The follow-up on the current driver confirmed that the generated SPIR-V has one `Fma` and no `NoContraction` on its result. I added that single decoration to the fixture SPIR-V, ran `spirv-val`, and reran with the same executable and driver, with the driver cache disabled in both runs. All four cases passed. The override was scoped to the generated fixture. The Wine gameplay candidate is still held.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/454:upstream-pr/454'
git switch 'upstream-pr/454'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/454'
git switch 'upstream-pr/454'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/454'
git switch 'upstream-pr/454'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/454'
git switch 'main'
git merge --squash 'upstream-pr/454'
git switch 'main'
git merge --ff-only 'upstream-pr/454'
git switch 'main'
git merge 'upstream-pr/454'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
avatarmanz/VIctory-7900XTX!454
No description provided.