GPU: wire DeserializeComputePipelineStateX to assemble ACCC #2396

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

@⁠makmatvey on GitHub · 2026-11-25 12:41 UTC · original
makmatvey:cursor/gpu-deserialize-compute-x-8766 → main · +168 −3 · 3 files · 2 commits · open

What's wrong

Device slot 67 (0x218, DeserializeComputePipelineStateX) is empty on main. The FidelityFX upscaler (amd_fidelityfx_upscaler_xbox.dll) calls it with precompiled FSPX sections; without a handler it falls through to create_compute_x and ends up with a pipeline that has no usable native code, so those dispatches are dropped.

ACCC containers already translate on main (translate_with / with_resources take the ACCC part when there is no DXIL). The remaining gap is assembling the deserialize call's sections into such a container.

What the change does

  • Wire slot 67 to deserialize_compute_x.
  • Assemble kind 0/1/6/7 FSPX sections into an ACCC container (same layout fspx_program already reads) and hand out a compute pipeline, so translation follows the existing ACCC path.
  • Make victory_shader::dxbc::build available outside tests for that assembly.
  • Unit tests: round-trip assembly through native_programs, and reject a null description.

Deliberately does not refuse FSPX in translate() — that would undo working ACCC translation (see maintainer note on #1468).

Related: #1468, #887.

Tests

On this Linux agent:

  • cargo xtask policy — ok
  • cargo test -p victory-shader --locked --lib — 144 passed
  • victory-gpu lib tests / Windows cross-compile — not run here (host_resource is cfg(windows); no ml64 for the Windows target)

Expect upstream windows-latest CI to exercise the new deserialize_compute_x_* tests.

Asset policy

No game data used.

**@⁠makmatvey** on GitHub · 2026-11-25 12:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/2396) `makmatvey:cursor/gpu-deserialize-compute-x-8766` → `main` · +168 −3 · 3 files · 2 commits · open ## What's wrong Device slot 67 (`0x218`, `DeserializeComputePipelineStateX`) is empty on `main`. The FidelityFX upscaler (`amd_fidelityfx_upscaler_xbox.dll`) calls it with precompiled FSPX sections; without a handler it falls through to `create_compute_x` and ends up with a pipeline that has no usable native code, so those dispatches are dropped. `ACCC` containers already translate on `main` (`translate_with` / `with_resources` take the `ACCC` part when there is no `DXIL`). The remaining gap is assembling the deserialize call's sections into such a container. ## What the change does - Wire slot 67 to `deserialize_compute_x`. - Assemble kind 0/1/6/7 FSPX sections into an `ACCC` container (same layout `fspx_program` already reads) and hand out a compute pipeline, so translation follows the existing ACCC path. - Make `victory_shader::dxbc::build` available outside tests for that assembly. - Unit tests: round-trip assembly through `native_programs`, and reject a null description. Deliberately does **not** refuse FSPX in `translate()` — that would undo working ACCC translation (see maintainer note on #1468). Related: #1468, #887. ## Tests On this Linux agent: - `cargo xtask policy` — ok - `cargo test -p victory-shader --locked --lib` — 144 passed - `victory-gpu` lib tests / Windows cross-compile — not run here (`host_resource` is `cfg(windows)`; no `ml64` for the Windows target) Expect upstream `windows-latest` CI to exercise the new `deserialize_compute_x_*` tests. ## Asset policy No game data used.
Device slot 67 (0x218) was empty, so the FidelityFX upscaler fell through
to create_compute_x with no usable shader. Assemble the FSPX sections into
an ACCC container so the existing translation path can run.

Related: #1468, #887.
Co-authored-by: Matsvey Makushenka <[email protected]>
CI failed on clippy::useless_vec for a fixed-size test buffer.

Co-authored-by: Matsvey Makushenka <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:04:37 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:03 UTC · original

Automated triage for the maintainers.

Needs work: evidence and wording. Wires device slot 67 (0x218) in crates/victory-gpu/src/device.rs to a new pipeline::deserialize_compute_x. That function reads a DeserializeComputeHead (a root signature, then pointer/size pairs for FSPX sections 0, 1, 6 and 7), repacks them as an FSPX blob in an ACCC container, and hands out a compute pipeline. The repacking matches what native.rs reads, and the round-trip test shows that. What is missing:

  1. The argument layout has no stated evidence. Nothing in the PR shows where the field order, the four section kinds, or the kind-0 thread-group offsets (0x0c-0x12) come from. Please cite the caller in the title's code (offsets and what it stores) or a captured call; a wrong layout reads arbitrary memory as pointers.
  2. Naming. main names these slots by our own function names and offsets, not by the console runtime's method names. Please drop DeserializeComputePipelineStateX from the doc comments and the log message (repo rule: no identifiers from the console SDK's headers) and describe it in your own words.
  3. The description says an empty slot "falls through to create_compute_x". Please check what an empty FUNCTIONS entry does in main, so the stated symptom is accurate.

CI: check passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/2396#issuecomment-7166223936) <!-- victory-triage v1 head=b5c0f6d95fb671cfcdbeb23d6d06b56353ee7223 verdict=needs-work at=2026-11-25T15:02:48Z --> Automated triage for the maintainers. **Needs work: evidence and wording.** Wires device slot 67 (0x218) in `crates/victory-gpu/src/device.rs` to a new `pipeline::deserialize_compute_x`. That function reads a `DeserializeComputeHead` (a root signature, then pointer/size pairs for FSPX sections 0, 1, 6 and 7), repacks them as an FSPX blob in an `ACCC` container, and hands out a compute pipeline. The repacking matches what `native.rs` reads, and the round-trip test shows that. What is missing: 1. **The argument layout has no stated evidence.** Nothing in the PR shows where the field order, the four section kinds, or the kind-0 thread-group offsets (0x0c-0x12) come from. Please cite the caller in the title's code (offsets and what it stores) or a captured call; a wrong layout reads arbitrary memory as pointers. 2. **Naming.** `main` names these slots by our own function names and offsets, not by the console runtime's method names. Please drop `DeserializeComputePipelineStateX` from the doc comments and the log message (repo rule: no identifiers from the console SDK's headers) and describe it in your own words. 3. The description says an empty slot "falls through to `create_compute_x`". Please check what an empty `FUNCTIONS` entry does in `main`, so the stated symptom is accurate. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠HAL9000RELOADED on GitHub · 2026-11-25 22:51 UTC · original

Data for the triage points, from the title on Windows 10: Radeon RX 7900 XTX (RDNA3), Adrenalin 32.0.32015.7029, main 13f91ca + this PR b5c0f6d, plus the Agility exports locally (Windows 10 needs them for SM 6.6).

1. The argument layout, from captured calls. I saved the first 24 descriptions the title hands to slot 0x218. There is one call site, return address +0x24800db in the title's image. Each description is 12 qwords: the root signature (one of our objects), then (pointer, size) for the four sections with sizes 0x1c, 0x14, the code's and the records', then two pointers and a 64-bit value. Section 0 holds the thread-group size at 0x0c-0x11 (8, 8, 1 in most). That is the order DeserializeComputeHead reads. The code section is the program as stored in shaders.rpf with one 12-byte instruction inserted after its first six dwords, plus 64 bytes of s_code_end.

3. On main without the PR the slot is the generic stub: method not implemented object="device" slot=0x218 caller="+0x24800db", logged once, then E_NOTIMPL. It does not reach create_compute_x.

With the PR, all 2,689 calls of a run assemble, and 8 minutes into the world nothing crashed. But 1,475 of them fail to translate with "an FSPX resource of an unknown root type". Those are CBVs as root constants (record byte 5 = 0). The records give no dword count. In all 1,469 distinct programs the constants are the last parameter, and COMPUTE_PGM_RSRC2.USER_SGPR leaves them 1-6 dwords. Taking them up to the next parameter or to USER_SGPR cleared those refusals in a second run: 394 → 0 at translation, and translated compute programs went from 157 to 178. Most of the rest then stop at "a descriptor changed after loading" (282), a translator limit outside this PR.

let user_sgprs = (u32_at(packet, PACKET_RSRC2)? >> 1) & 0x1f;
let starts: Vec<u8> = records.iter().take_while(|e| e[0] != 0x43)
    .filter(|e| e[0] == 0x41 && RootType::from_raw(e[5].into()) != RootType::ImmediateSampler)
    .map(|e| e[21]).collect();
// in the match on the root type:
RootType::Constants => {
    let end = starts.iter().map(|&s| u32::from(s)).filter(|&s| s > u32::from(u.user_data))
        .min().unwrap_or(user_sgprs);
    end.checked_sub(u.user_data.into()).filter(|&n| n > 0)
        .ok_or(Malformed("FSPX root constants past the user SGPRs"))?
}

It is commit 4ecaa7a on top of b5c0f6d, with a unit test, on HAL9000RELOADED/victory-fork branch fix/fspx-root-constants (github.com/HAL9000RELOADED/victory-fork@4ecaa7a0cc). Take it if you want it.

**@⁠HAL9000RELOADED** on GitHub · 2026-11-25 22:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/2396#issuecomment-7176860897) Data for the triage points, from the title on Windows 10: Radeon RX 7900 XTX (RDNA3), Adrenalin 32.0.32015.7029, `main` `13f91ca` + this PR `b5c0f6d`, plus the Agility exports locally (Windows 10 needs them for SM 6.6). **1. The argument layout, from captured calls.** I saved the first 24 descriptions the title hands to slot 0x218. There is one call site, return address `+0x24800db` in the title's image. Each description is 12 qwords: the root signature (one of our objects), then (pointer, size) for the four sections with sizes 0x1c, 0x14, the code's and the records', then two pointers and a 64-bit value. Section 0 holds the thread-group size at 0x0c-0x11 (8, 8, 1 in most). That is the order `DeserializeComputeHead` reads. The code section is the program as stored in `shaders.rpf` with one 12-byte instruction inserted after its first six dwords, plus 64 bytes of s_code_end. **3. On `main` without the PR** the slot is the generic stub: `method not implemented object="device" slot=0x218 caller="+0x24800db"`, logged once, then `E_NOTIMPL`. It does not reach create_compute_x. **With the PR,** all 2,689 calls of a run assemble, and 8 minutes into the world nothing crashed. But 1,475 of them fail to translate with "an FSPX resource of an unknown root type". Those are CBVs as root constants (record byte 5 = 0). The records give no dword count. In all 1,469 distinct programs the constants are the last parameter, and `COMPUTE_PGM_RSRC2.USER_SGPR` leaves them 1-6 dwords. Taking them up to the next parameter or to USER_SGPR cleared those refusals in a second run: 394 → 0 at translation, and translated compute programs went from 157 to 178. Most of the rest then stop at "a descriptor changed after loading" (282), a translator limit outside this PR. ```rust let user_sgprs = (u32_at(packet, PACKET_RSRC2)? >> 1) & 0x1f; let starts: Vec<u8> = records.iter().take_while(|e| e[0] != 0x43) .filter(|e| e[0] == 0x41 && RootType::from_raw(e[5].into()) != RootType::ImmediateSampler) .map(|e| e[21]).collect(); // in the match on the root type: RootType::Constants => { let end = starts.iter().map(|&s| u32::from(s)).filter(|&s| s > u32::from(u.user_data)) .min().unwrap_or(user_sgprs); end.checked_sub(u.user_data.into()).filter(|&n| n > 0) .ok_or(Malformed("FSPX root constants past the user SGPRs"))? } ``` It is commit `4ecaa7a` on top of `b5c0f6d`, with a unit test, on HAL9000RELOADED/victory-fork branch `fix/fspx-root-constants` (https://github.com/HAL9000RELOADED/victory-fork/commit/4ecaa7a0ccf35441b9a73e63a5a080c1d46fcf02). Take it if you want it.
Author
Owner

@⁠Xvania7 on GitHub · 2026-11-25 13:00 UTC · original · approved these changes

Verification on native Windows 10 x64, NVIDIA GeForce RTX 5060, Rust 1.98.1.

Checked out b5c0f6d into an isolated tree to cover the Windows host build and victory-gpu unit tests not runnable on Linux:

  • cargo test -p victory-gpu deserialize_compute_x:
    • pipeline::tests::deserialize_compute_x_rejects_a_null_description ... ok
    • pipeline::tests::deserialize_compute_x_assembles_an_accc_compute_pipeline ... ok
  • cargo clippy -p victory-gpu -- -D warnings: 0 warnings, clean.
  • cargo run -p xtask -- policy: clean (asset policy: 182 files ok).

Wired slot 67 cleanly hands out the assembled ACCC container and pipeline translation without regressing translate(). LGTM.

**@⁠Xvania7** on GitHub · 2026-11-25 13:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/2396#pullrequestreview-6058075334) · **approved these changes** Verification on native Windows 10 x64, NVIDIA GeForce RTX 5060, Rust 1.98.1. Checked out `b5c0f6d` into an isolated tree to cover the Windows host build and `victory-gpu` unit tests not runnable on Linux: - `cargo test -p victory-gpu deserialize_compute_x`: - `pipeline::tests::deserialize_compute_x_rejects_a_null_description ... ok` - `pipeline::tests::deserialize_compute_x_assembles_an_accc_compute_pipeline ... ok` - `cargo clippy -p victory-gpu -- -D warnings`: 0 warnings, clean. - `cargo run -p xtask -- policy`: clean (`asset policy: 182 files ok`). Wired slot 67 cleanly hands out the assembled `ACCC` container and pipeline translation without regressing `translate()`. LGTM.
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 13:19 UTC · original · reviewed

Wire DeserializeComputePipelineStateX to assembly (+166). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.

**@⁠catminou4** on GitHub · 2026-11-25 13:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2396#pullrequestreview-6058344926) · **reviewed** Wire DeserializeComputePipelineStateX to assembly (+166). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
Author
Owner

@⁠arogan178 on GitHub · 2026-11-26 09:29 UTC · original

In-game test on Series X 1.0.2.1: this fixes slot 67, but the pipelines it hands out do not translate, so the world loses most of its draws.

Setup: RX 9070 XT, Mesa RADV, Proton Experimental (vkd3d-proton 71cae0), cross-built diag builds. Tested on 63bcca4 plus #1722 and #3096, and on avatarmanz/VIctory-7900XTX 0ce46d5 with the slot-67 line resolved to deserialize_compute_x.

World, same build otherwise without this PR with this PR
slot=0x218 "not implemented" warnings yes none
Draws dropped without a host pipeline, average per frame 82 1,440
Compute shaders refused with malformed shader: an FSPX resource of an unknown root type (native.rs resource parsing) 0 328 distinct hashes

Without a handler, the title goes without these pipelines and takes a path that renders. With the handler, it uses them, every dispatch through them is dropped, and what reads their output is missing. On the 7900XTX fork the result is a black picture while the frame counter keeps running. There, about 2,600 draws and 900 indirect executions per frame were dropped.

So the slot is not used only by the FidelityFX upscaler, as the description assumes. The title creates hundreds of its own compute pipelines through it. The assembled ACCC probably lays out at least one resource's root type differently from what fspx_program expects. I have not traced which section kind carries it.

I'd suggest not merging until the assembled containers translate. Gating the handler to the upscaler's callers would also work. I can rerun any revision of this on the same setup.

**@⁠arogan178** on GitHub · 2026-11-26 09:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/2396#issuecomment-7188053550) In-game test on Series X 1.0.2.1: this fixes slot 67, but the pipelines it hands out do not translate, so the world loses most of its draws. Setup: RX 9070 XT, Mesa RADV, Proton Experimental (vkd3d-proton `71cae0`), cross-built diag builds. Tested on `63bcca4` plus #1722 and #3096, and on avatarmanz/VIctory-7900XTX `0ce46d5` with the slot-67 line resolved to `deserialize_compute_x`. | World, same build otherwise | without this PR | with this PR | |---|---|---| | `slot=0x218` "not implemented" warnings | yes | none | | Draws dropped without a host pipeline, average per frame | 82 | 1,440 | | Compute shaders refused with `malformed shader: an FSPX resource of an unknown root type` (`native.rs` resource parsing) | 0 | 328 distinct hashes | Without a handler, the title goes without these pipelines and takes a path that renders. With the handler, it uses them, every dispatch through them is dropped, and what reads their output is missing. On the 7900XTX fork the result is a black picture while the frame counter keeps running. There, about 2,600 draws and 900 indirect executions per frame were dropped. So the slot is not used only by the FidelityFX upscaler, as the description assumes. The title creates hundreds of its own compute pipelines through it. The assembled `ACCC` probably lays out at least one resource's root type differently from what `fspx_program` expects. I have not traced which section kind carries it. I'd suggest not merging until the assembled containers translate. Gating the handler to the upscaler's callers would also work. I can rerun any revision of this on the same setup.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2396/head:github-bot/gh-2396'
git switch 'github-bot/gh-2396'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2396'
git switch 'github-bot/gh-2396'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2396'
git switch 'github-bot/gh-2396'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2396'
git switch 'main'
git merge --squash 'github-bot/gh-2396'
git switch 'main'
git merge --ff-only 'github-bot/gh-2396'
git switch 'main'
git merge 'github-bot/gh-2396'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2396
No description provided.