Skip to content

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

Open
ImLele69 wants to merge 2 commits into
ProjectLeonida:mainfrom
ImLele69:fspx-unpack-auto-backend
Open

ImLele69 wants to merge 2 commits into
ProjectLeonida:mainfrom
ImLele69:fspx-unpack-auto-backend

Conversation

@ImLele69

Copy link
Copy Markdown
Contributor

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 tools: add auto fallback to python disassembler in shader_disasm and shader_library #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).

Tortoche and others added 2 commits November 25, 2026 10:15
… programs

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 (ProjectLeonida#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.
@qhukz13

qhukz13 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

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 tools: add auto fallback to python disassembler in shader_disasm and shader_library #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).

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants