Make compute pipelines from programs the title compiled itself (device method 0x218) #98

Closed
Castyan wants to merge 43 commits from upstream-pr/98 into main
Castyan commented 2026-11-26 20:05:04 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by Castyan on 2026-11-26T20:05:04Z.


Stacked on #64 (itself on #61). The changes to review are the 19 commits after 53f1f19, from 5fe8cb6 to 60ff2e8. Split out of #64, where they were reviewed in its comments.

What

At start the title builds compute pipelines from programs it compiled itself, through device method 0x218. Until now that method returned E_NOTIMPL and the title went without them.

  • Decoder (native_build.rs): the program is read from the 0x60-byte description (registers, console resource table, code) and its root signature, wrapped in a container of its own, then translated and cached like the title's own containers. What the decoder reads: resource tables as the title writes them, root descriptors, root constants counted from the signature, 32-lane programs from their depth word, and directly indexed heaps placed past the root parameters (only when the count matches exactly). A description that cannot be read still gets E_NOTIMPL with a null output, and the reason is logged.
  • Capture: VICTORY_DUMP_NATIVE=<folder> saves descriptions that are not read or do not translate, with their root signatures, for offline replay.
  • Translator, for what these programs use: src_scc, s_pack_*_b32_b16, s_bfm_b64, s_bitreplicate_b64_b32, image_store with any channel mask (port of fxceless/victory-fork#146 by Davi713), typed buffer stores of fewer than four channels, v_ldexp_f32, a structured buffer made raw for the descriptor it is loaded as, and the src_scc carry into an address's high half.
  • 0x1c8 (native graphics pipelines) is still refused: it needs the draw's render-target formats.

Nothing is guessed: a program whose semantics are not reproduced exactly is still refused, with its reason. Each change comes with a test.

Results (RTX 5060)

before 60ff2e8
Replay, first 200 captured descriptions reaching a hardware pipeline 2 88
Replay, second 200 (programs that decode but don't translate) 5 23
In game: 0x218 descriptions turned down at decode over 1024 0
In game: 0x218 pipelines made about 512 over 2048
In game: errors, crashes, device losses 0 0

Checks

cargo clippy with and without --all-features (-D warnings) and cargo test --workspace --locked pass on the branches stacked on this one.

🤖 Generated with Claude Code

<!-- greyfinch-sync:DexNom/VIctory:issue:5516458188 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/98). Originally posted by [Castyan](https://github.com/Castyan) on 2026-11-26T20:05:04Z. --- **Stacked on #64** (itself on #61). The changes to review are the 19 commits after `53f1f19`, from `5fe8cb6` to `60ff2e8`. Split out of #64, where they were reviewed in its comments. ## What At start the title builds compute pipelines from programs it compiled itself, through device method 0x218. Until now that method returned `E_NOTIMPL` and the title went without them. - **Decoder** (`native_build.rs`): the program is read from the 0x60-byte description (registers, console resource table, code) and its root signature, wrapped in a container of its own, then translated and cached like the title's own containers. What the decoder reads: resource tables as the title writes them, root descriptors, root constants counted from the signature, 32-lane programs from their depth word, and directly indexed heaps placed past the root parameters (only when the count matches exactly). A description that cannot be read still gets `E_NOTIMPL` with a null output, and the reason is logged. - **Capture**: `VICTORY_DUMP_NATIVE=<folder>` saves descriptions that are not read or do not translate, with their root signatures, for offline replay. - **Translator**, for what these programs use: `src_scc`, `s_pack_*_b32_b16`, `s_bfm_b64`, `s_bitreplicate_b64_b32`, `image_store` with any channel mask (port of fxceless/victory-fork#146 by Davi713), typed buffer stores of fewer than four channels, `v_ldexp_f32`, a structured buffer made raw for the descriptor it is loaded as, and the `src_scc` carry into an address's high half. - 0x1c8 (native graphics pipelines) is still refused: it needs the draw's render-target formats. Nothing is guessed: a program whose semantics are not reproduced exactly is still refused, with its reason. Each change comes with a test. ## Results (RTX 5060) | | before | `60ff2e8` | |---|---|---| | Replay, first 200 captured descriptions reaching a hardware pipeline | 2 | 88 | | Replay, second 200 (programs that decode but don't translate) | 5 | 23 | | In game: 0x218 descriptions turned down at decode | over 1024 | 0 | | In game: 0x218 pipelines made | about 512 | over 2048 | | In game: errors, crashes, device losses | 0 | 0 | ## Checks `cargo clippy` with and without `--all-features` (`-D warnings`) and `cargo test --workspace --locked` pass on the branches stacked on this one. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
andrewDoing commented 2026-11-26 22:46:50 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by andrewDoing on 2026-11-26T22:46:50Z.


Independent RTX 5070 end-to-end check at 60ff2e8: generated a synthetic 0x218 description with 32 threads, register/table metadata, descriptor load, arithmetic and per-thread UAV store; called the real device slot 0x218, translated the returned compute container, created a PSO and dispatched it. All 32 output DWORDs matched 33 through 64. A zero-length-code negative case returned E_NOTIMPL and a null output. This covers one synthetic metadata layout, not captured title programs or gameplay.

Verification was AI-assisted with GPT-6.2 Astra.

<!-- greyfinch-sync:DexNom/VIctory:comment:7204978520 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/98#issuecomment-7204978520). Originally posted by [andrewDoing](https://github.com/andrewDoing) on 2026-11-26T22:46:50Z. --- Independent RTX 5070 end-to-end check at `60ff2e8`: generated a synthetic 0x218 description with 32 threads, register/table metadata, descriptor load, arithmetic and per-thread UAV store; called the real device slot 0x218, translated the returned compute container, created a PSO and dispatched it. All 32 output DWORDs matched 33 through 64. A zero-length-code negative case returned `E_NOTIMPL` and a null output. This covers one synthetic metadata layout, not captured title programs or gameplay. Verification was AI-assisted with GPT-6.2 Astra.
Castyan commented 2026-11-27 07:40:26 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by Castyan on 2026-11-27T07:40:26Z.


Merged into #64 (83bfddc), where this work continues. Closing as superseded.

<!-- greyfinch-sync:DexNom/VIctory:comment:7212703857 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/98#issuecomment-7212703857). Originally posted by [Castyan](https://github.com/Castyan) on 2026-11-27T07:40:26Z. --- Merged into #64 (`83bfddc`), where this work continues. Closing as superseded.

Pull request closed

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
DexNom/VIctory!98
No description provided.