fspx_unpack: --backend auto, used by the FSPX stage (FSPX-UNPACK-AUTO-BACKEND) #1984

Open
github-bot wants to merge 2 commits from github-bot/gh-1984 into main AGit
Owner

@⁠ImLele69 on GitHub · 2026-11-25 17:25 UTC · original
ImLele69:fspx-unpack-auto-backend → main · +125 −11 · 8 files · 2 commits · open

Claimed in the coordination issue as FSPX-UNPACK-AUTO-BACKEND (#1608). Depends on #1712, which adds backend="auto" to tools/shader_disasm.py. This branch is #1712 plus one commit.

What and why

With llvm-mc 21 or 22, five of the 29 FSPX programs of amd_fidelityfx_upscaler_xbox.dll (05, 06, 08, 09, 28) are disassembled with invalid words, and the translator refuses them. The title then reads through the missing pipeline: the access violation at amd_fidelityfx_upscaler_xbox.dll+0x65ff (read of 0x10) reported in #1608 by CLHelper, kurrutako and Snooozs. Here it showed up as soon as the boot ran with LEONIDA_DEVICE_TYPE=6. #1862 fixes the two programs that llvm-mc 23 leaves out; it doesn't help older llvm-mc builds. The Linux packages and scripts/build_llvm_mc.ps1's default are 21.1.8.

#1712's auto backend decodes those five with the pure-Python decoder and no invalid words. This change:

  • tools/fspx_unpack.py: a --backend {llvm-mc,python,auto} option for --disasm, passed to shader_disasm.disasm. The default stays llvm-mc, so direct uses and the existing tests are unchanged.
  • make_game.py: the FSPX stage runs fspx_unpack.py ... --disasm --backend auto, as #1712 does for the pipeline library. fspx_unpack.py is already in FSPX_TOOLS, so a cached FSPX set is rebuilt once.

Tested

  • Real DLL: the FidelityFX DLL of a 1.0.2.1 package, llvm-mc 22.1.8 (Fedora), rdna2spirv.py --no-asm --wave64-emulate.
    • Before: 24 of 29 translated.
    • After: 29 of 29 translated, 29 pass spirv-val. The five listings report 0 invalid words.
  • Retail boot, Linux/Wine (RTX 2070 SUPER, LEONIDA_DEVICE_TYPE=6):
    • With 24 of 29: the process died at amd_fidelityfx_upscaler_xbox.dll+0x65ff right at the world start.
    • With 29 of 29: the next boot went past it, with 0 no translated compute shader for FSPX lines, to a later and unrelated stop.
  • Unit tests: python -I tests/test_fspx_unpack.py (35, including the new test_auto_backend_replaces_a_listing_with_invalid_words, which fails without the change), test_fspx_shaders_stage.py, test_fspx_unpack_out.py, test_shader_disasm.py and test_shader_library.py pass.
  • test_fspx_shaders_stage.py changes in two places:
    • It now expects --backend auto on the unpack command line.
    • The "failed disassembly leaves no marker" test runs the unpack with llvm-mc alone. With auto, the Python decoder would read its program and the stage would not fail, which is the point of the change but not what that test checks.

No game files in the change or the tests.

AI-assisted (Claude Code).

**@⁠ImLele69** on GitHub · 2026-11-25 17:25 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1984) `ImLele69:fspx-unpack-auto-backend` → `main` · +125 −11 · 8 files · 2 commits · open Claimed in the coordination issue as FSPX-UNPACK-AUTO-BACKEND ([#1608](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608)). **Depends on #1712**, which adds `backend="auto"` to `tools/shader_disasm.py`. This branch is #1712 plus one commit. ### What and why With llvm-mc 21 or 22, five of the 29 FSPX programs of `amd_fidelityfx_upscaler_xbox.dll` (05, 06, 08, 09, 28) are disassembled with invalid words, and the translator refuses them. The title then reads through the missing pipeline: the access violation at `amd_fidelityfx_upscaler_xbox.dll+0x65ff` (read of 0x10) reported in #1608 by CLHelper, kurrutako and Snooozs. Here it showed up as soon as the boot ran with `LEONIDA_DEVICE_TYPE=6`. #1862 fixes the two programs that llvm-mc 23 leaves out; it doesn't help older llvm-mc builds. The Linux packages and `scripts/build_llvm_mc.ps1`'s default are 21.1.8. #1712's `auto` backend decodes those five with the pure-Python decoder and no invalid words. This change: - `tools/fspx_unpack.py`: a `--backend {llvm-mc,python,auto}` option for `--disasm`, passed to `shader_disasm.disasm`. The default stays `llvm-mc`, so direct uses and the existing tests are unchanged. - `make_game.py`: the FSPX stage runs `fspx_unpack.py ... --disasm --backend auto`, as #1712 does for the pipeline library. `fspx_unpack.py` is already in `FSPX_TOOLS`, so a cached FSPX set is rebuilt once. ### Tested - **Real DLL:** the FidelityFX DLL of a 1.0.2.1 package, llvm-mc 22.1.8 (Fedora), `rdna2spirv.py --no-asm --wave64-emulate`. - Before: 24 of 29 translated. - After: **29 of 29 translated, 29 pass spirv-val**. The five listings report `0 invalid words`. - **Retail boot, Linux/Wine** (RTX 2070 SUPER, `LEONIDA_DEVICE_TYPE=6`): - With 24 of 29: the process died at `amd_fidelityfx_upscaler_xbox.dll+0x65ff` right at the world start. - With 29 of 29: the next boot went past it, with 0 `no translated compute shader for FSPX` lines, to a later and unrelated stop. - **Unit tests:** `python -I tests/test_fspx_unpack.py` (35, including the new `test_auto_backend_replaces_a_listing_with_invalid_words`, which fails without the change), `test_fspx_shaders_stage.py`, `test_fspx_unpack_out.py`, `test_shader_disasm.py` and `test_shader_library.py` pass. - `test_fspx_shaders_stage.py` changes in two places: - It now expects `--backend auto` on the unpack command line. - The "failed disassembly leaves no marker" test runs the unpack with `llvm-mc` alone. With `auto`, the Python decoder would read its program and the stage would not fail, which is the point of the change but not what that test checks. No game files in the change or the tests. AI-assisted (Claude Code).
llvm-mc 21 and 22 leave invalid words in five of the 29 programs of
amd_fidelityfx_upscaler_xbox.dll (05, 06, 08, 09, 28), so they are not translated and the
upscaler later reads through a missing pipeline (amd_fidelityfx_upscaler_xbox.dll+0x65ff).
shader_disasm.py's auto backend (#1712) decodes those five with no invalid words; with it
all 29 translate and pass spirv-val with llvm-mc 22.1.8 and --wave64-emulate. The command
line default stays llvm-mc; the FSPX stage asks for auto.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:13:52 +00:00
Author
Owner

@⁠qhukz13 on GitHub · 2026-11-25 22:23 UTC · original

Independent run of the tests at 64ac9de08 (this PR on top of #1712), Linux, Python 3, no game files and no llvm-mc on this machine:

  • tests/test_fspx_unpack.py 35 (1 skipped: the Windows-only exclusive-lock case), test_fspx_shaders_stage.py 24, test_fspx_unpack_out.py 5, test_shader_disasm.py 34, test_shader_library.py 23: all pass.
  • With tools/fspx_unpack.py put back to #1712's version and the tests left at this head, test_auto_backend_replaces_a_listing_with_invalid_words fails and the other 34 pass, so the new test does check the change.
  • The branch merges into current main without conflicts.

The real-DLL numbers (29 of 29 FSPX programs) need a package; I can repeat them on Windows 10 / GTX 1050 Ti once mine is unpacked.

AI-assisted (Claude Code).

**@⁠qhukz13** on GitHub · 2026-11-25 22:23 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1984#issuecomment-7176310425) Independent run of the tests at `64ac9de08` (this PR on top of #1712), Linux, Python 3, no game files and no llvm-mc on this machine: - `tests/test_fspx_unpack.py` 35 (1 skipped: the Windows-only exclusive-lock case), `test_fspx_shaders_stage.py` 24, `test_fspx_unpack_out.py` 5, `test_shader_disasm.py` 34, `test_shader_library.py` 23: all pass. - With `tools/fspx_unpack.py` put back to #1712's version and the tests left at this head, `test_auto_backend_replaces_a_listing_with_invalid_words` fails and the other 34 pass, so the new test does check the change. - The branch merges into current main without conflicts. The real-DLL numbers (29 of 29 FSPX programs) need a package; I can repeat them on Windows 10 / GTX 1050 Ti once mine is unpacked. AI-assisted (Claude Code).
This pull request has changes conflicting with the target branch.
  • tools/fspx_unpack.py
  • tools/shader_disasm.py
  • tools/shader_library.py
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.
git fetch -u origin '+refs/pull/1984/head:github-bot/gh-1984'
git switch 'github-bot/gh-1984'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1984'
git switch 'github-bot/gh-1984'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1984'
git switch 'github-bot/gh-1984'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1984'
git switch 'main'
git merge --squash 'github-bot/gh-1984'
git switch 'main'
git merge --ff-only 'github-bot/gh-1984'
git switch 'main'
git merge 'github-bot/gh-1984'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.