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

Open
opened 2026-11-26 21:19:40 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1984
Author: @ImLele69
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: fspx-unpack-auto-backend


📝 Commits (2)

  • 70315b5 tools: add auto fallback to python disassembler in shader_disasm and shader_library
  • 64ac9de fspx_unpack: --backend auto, and make_game uses it for the FidelityFX programs

📊 Changes

8 files changed (+125 additions, -11 deletions)

View changed files

📝 make_game.py (+1 -1)
📝 tests/test_fspx_shaders_stage.py (+3 -2)
📝 tests/test_fspx_unpack.py (+15 -2)
📝 tests/test_shader_disasm.py (+42 -0)
📝 tests/test_shader_library.py (+41 -0)
📝 tools/fspx_unpack.py (+6 -2)
📝 tools/shader_disasm.py (+11 -3)
📝 tools/shader_library.py (+6 -1)

📄 Description

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).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1984 **Author:** [@ImLele69](https://github.com/ImLele69) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fspx-unpack-auto-backend` --- ### 📝 Commits (2) - [`70315b5`](https://github.com/ubiquitarianism/leonida/commit/70315b5fdfadf08f0b67d474d8e465c658a036b6) tools: add auto fallback to python disassembler in shader_disasm and shader_library - [`64ac9de`](https://github.com/ubiquitarianism/leonida/commit/64ac9de0846b31a688c7ba4697b420cc76725486) fspx_unpack: --backend auto, and make_game uses it for the FidelityFX programs ### 📊 Changes **8 files changed** (+125 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `make_game.py` (+1 -1) 📝 `tests/test_fspx_shaders_stage.py` (+3 -2) 📝 `tests/test_fspx_unpack.py` (+15 -2) 📝 `tests/test_shader_disasm.py` (+42 -0) 📝 `tests/test_shader_library.py` (+41 -0) 📝 `tools/fspx_unpack.py` (+6 -2) 📝 `tools/shader_disasm.py` (+11 -3) 📝 `tools/shader_library.py` (+6 -1) </details> ### 📄 Description Claimed in the coordination issue as FSPX-UNPACK-AUTO-BACKEND ([#1608](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7169483079)). **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). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1991
No description provided.