tombox-xshader: take the user-data base from the FSSM stage slot #330
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!330
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/330/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@GDAgent on GitHub · 2026-11-23 20:16 UTC · original
GDAgent:feat/xshader-fssm-stage-user-base→main· +955 −10 · 9 files · 3 commits · closed without mergingStacked on #289 (head
714efcc); only12902f3belongs to this PR. Please reviewgit diff 714efcc..until #289 lands; I will rebase ontomainthen.Library / area:
tombox-xshader(hlsl.rs,translate_linked_with).Exports changed: None.
Builds on #289. Unlike #289's fallback, this changes the default path, but only when a shader's FSSM table parses and agrees with its root signature.
Problem
The static root-signature path guesses the first user-data SGPR from the API stage: VS s8, GS s22, MS s16, CS s4, or
s_swappc_b64target + 7. A vertex shader compiled as the ES half of a merged ES/GS program (hardware stage slot0x28) withouts_swappc_b64receives user data after 8 system SGPRs. The guess of s8 then names the wrong root parameter. On The Matrix Awakens this hits 42 vertex shaders (#289's--fssm-checksweep):mubuf ...: buffer in table of kind Some(..);Change
fssm_user_base(ex): if the shader has a root signature (RTS0 or the PSO root signature passed at runtime), its FSSM table parses,Bindings::disagreementsis empty (same parameter kinds, registers, SGPR layout and used descriptors), and the hardware stage slot is known, the user-data base isfirst slot + system SGPRsfrom the table (8 for slots0x28/0x30/0x58, 0 for0x38/0x40/compute). Otherwise the old guess and itss_swappcretry stay unchanged. No new switch: the table must agree with the root signature, so it only replaces a guess with the layout the console compiler recorded.Evidence
vs_6_5.714efcc): 35,442 shaders compared; 35,376 byte-identical, 36 failing before and translating now, 6 translating before and changed, 24 failing in both with the same message. No shader that translated before fails now. Translated 35,382 -> 35,418 (99.83% -> 99.93%); all 36mubuf ...: buffer in table of kind Some(..)refusals are gone, the remaining 26 are unrelated (ds_permute with LDS, constant-buffer MUBUF forms, no DXIL chunk). All 42 changed shaders are vertex shaders.Tests
tests/fssm_bind.rs:merged_es_vertex_shader_reads_user_data_where_the_stage_slot_puts_it: slot0x28, table at slot 8, RTS0 with one SRV table; the load from s[16:17] bindsregister(t0), and DXC compiles it.without_an_agreeing_table_the_static_guess_stays: hardware-VS slot, no table, or a root signature with an extra parameter all keep the old refusalbuffer in table of kind None.cargo test --locked -p tombox-xshader --test fssm_bind: 7/7. Fullcargo test --locked -p tombox-xshader --no-fail-fast(debug, native Windows 11): 360 passed, 0 failed, 18 ignored (lib 122/0/3,tests/exec.rs128/0/2).714efcc): 0 problems.Not verified in a title
No title was run; offline translation only. GS (
0x30) and MS (0x58) shaders on Matrix already gave identical HLSL from the table and from the guess. AAA GS shaders would get base 8 + slot instead of 22 at runtime, which is unverified. HS/DS/AS stage slots have never been seen, and their shaders keep the guess (an unknown slot makesBindings::user_basereturn an error, which falls back). Native Windows 11; not run under Proton.Merge notes
No conflict with #278 (merged vertex shader seeding) or #302. #183 touches
tests/synthetic.rsonly.The static root-signature path guesses where user data starts from the API stage (VS s8, GS s22, MS s16, CS s4, s_swappc target + 7). A merged ES vertex shader without s_swappc gets user data at s8 + slot, not at s8, so the guess reads its root parameters from the wrong SGPRs: some refuse ("buffer in table of kind ..."), others translate against the wrong parameter. The FSSM header names the hardware stage, and the root-binding table gives each parameter's user-data slot. When a shader has a root signature and its FSSM table parses and agrees with it (same parameters, registers and used descriptors), the user-data base now comes from the table. Without a table, or when the table disagrees, the old guess and its s_swappc retry stay.@omonkeyz on GitHub · 2026-11-25 13:50 UTC · original
Applied on main in
b96523a(cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.Pull request closed