Skip to content

GPU: wire DeserializeComputePipelineStateX to assemble ACCC - #2396

Open
makmatvey wants to merge 2 commits into
Marvisak:mainfrom
makmatvey:cursor/gpu-deserialize-compute-x-8766
Open

makmatvey wants to merge 2 commits into
Marvisak:mainfrom
makmatvey:cursor/gpu-deserialize-compute-x-8766

Conversation

@makmatvey

Copy link
Copy Markdown
Contributor

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.

cursoragent and others added 2 commits November 25, 2026 12:40
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: Marvisak#1468, Marvisak#887.
Co-authored-by: Matsvey Makushenka <matvey.myown@gmail.com>
CI failed on clippy::useless_vec for a fixed-size test buffer.

Co-authored-by: Matsvey Makushenka <matvey.myown@gmail.com>

@Xvania7 Xvania7 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

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

@HAL9000RELOADED

Copy link
Copy Markdown

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 (HAL9000RELOADED/victory-fork@4ecaa7a). Take it if you want it.

@arogan178

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants