xshader: take a vertex shader's table parameter from its own records #173

Merged
JeffreyBytes merged 1 commit from upstream-pr/173 into main 2026-11-25 18:00:06 +00:00
JeffreyBytes commented 2026-11-25 14:59:11 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by JeffreyBytes on 2026-11-25T14:59:11Z.


Summary

Draft, opened early so nobody duplicates it. Follow-up to #168, which lists "guest root kept: vertex stage untranslated" among the cases it leaves.

root_table maps a table register to a root parameter by a fixed base. For a vertex shader that starts with s_swappc_b64 it used the chained-entry rule (tables seven registers after the swapped pair), which is for shaders built to feed a geometry shader. A vertex shader with a generated fetch call also starts with s_swappc_b64, but keeps its tables where FSSM says: s8 for parameter 0, s9 for parameter 1, and so on. Only the s8 case was recognised, and only when every record sat in s8.

With a table in s9 the lookup landed on the wrong parameter, found no range for the slot and fell back to the slot number in space 0 (register(b5) where the root has b22, space1). The driver then rejected the pipeline for a binding the root does not have, or the translation was refused with buffer in table of kind None.

When the vertex shader's used-resource records place descriptors in the register, the parameter they name is used. The chained-entry rule still applies to registers the records do not mention. Only vertex shaders are affected.

Results on ProjectScarlett

Offline, translator before and after over 14,924 locally recorded requests (measured at 1d821cb, before the module split; the change is the same): 83 outputs change, all vertex shaders whose registers move to the ones their root declares; 38 requests that were refused now translate; none are lost.

In the game, RX 6700 XT on RADV (Mesa 26.3.1), Intel i5-12600K, Proton Experimental, offline. Each build got its own --prepare-only pass and a warm-up run, then a run stopped at 300 s. Counts are from the pipeline failure file; main is 7b22d71.

main + this change + this change + #174
Pipelines not delivered 2,440 2,038 1,797
VS+PS stand-ins 528 202 65

No failed presents in any run, and the present rate is the same across builds (about 300 to 340 per 10 s). #174 alone gives 395 stand-ins; the two together reach 65 because some pipelines need both stages fixed before either can use the reflected root.

Verified on Lanes

  • python tuxbox.py check passed on this branch
  • Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below

Not run yet; this is why the pull request is a draft.

Checks

Run on this branch, rebased onto 7b22d71 (after the test and module split):

  • python -m unittest discover -s tests: 348 tests
  • Shader compiler: 304 + 2, including the new vertex_table_parameter_follows_the_shaders_own_records
  • dxbc with native-bindings: 61
  • xg-layout: 14
  • cargo check --target x86_64-pc-windows-msvc -p tuxbox-d3d12

No evidence JSON changed.

<!-- greyfinch-sync:brcly/TuxBox:issue:6607381161 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/173). Originally posted by [JeffreyBytes](https://github.com/JeffreyBytes) on 2026-11-25T14:59:11Z. --- ## Summary Draft, opened early so nobody duplicates it. Follow-up to #168, which lists "guest root kept: vertex stage untranslated" among the cases it leaves. `root_table` maps a table register to a root parameter by a fixed base. For a vertex shader that starts with `s_swappc_b64` it used the chained-entry rule (tables seven registers after the swapped pair), which is for shaders built to feed a geometry shader. A vertex shader with a generated fetch call also starts with `s_swappc_b64`, but keeps its tables where FSSM says: `s8` for parameter 0, `s9` for parameter 1, and so on. Only the `s8` case was recognised, and only when every record sat in `s8`. With a table in `s9` the lookup landed on the wrong parameter, found no range for the slot and fell back to the slot number in space 0 (`register(b5)` where the root has `b22, space1`). The driver then rejected the pipeline for a binding the root does not have, or the translation was refused with `buffer in table of kind None`. When the vertex shader's used-resource records place descriptors in the register, the parameter they name is used. The chained-entry rule still applies to registers the records do not mention. Only vertex shaders are affected. ### Results on ProjectScarlett **Offline**, translator before and after over 14,924 locally recorded requests (measured at `1d821cb`, before the module split; the change is the same): 83 outputs change, all vertex shaders whose registers move to the ones their root declares; 38 requests that were refused now translate; none are lost. **In the game**, RX 6700 XT on RADV (Mesa 26.3.1), Intel i5-12600K, Proton Experimental, offline. Each build got its own `--prepare-only` pass and a warm-up run, then a run stopped at 300 s. Counts are from the pipeline failure file; `main` is `7b22d71`. | | `main` | + this change | + this change + #174 | | --- | --- | --- | --- | | Pipelines not delivered | 2,440 | 2,038 | 1,797 | | VS+PS stand-ins | 528 | 202 | 65 | No failed presents in any run, and the present rate is the same across builds (about 300 to 340 per 10 s). #174 alone gives 395 stand-ins; the two together reach 65 because some pipelines need both stages fixed before either can use the reflected root. ## Verified on Lanes - [ ] `python tuxbox.py check` passed on this branch - [ ] Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below Not run yet; this is why the pull request is a draft. ## Checks Run on this branch, rebased onto `7b22d71` (after the test and module split): - `python -m unittest discover -s tests`: 348 tests - Shader compiler: 304 + 2, including the new `vertex_table_parameter_follows_the_shaders_own_records` - `dxbc` with `native-bindings`: 61 - `xg-layout`: 14 - `cargo check --target x86_64-pc-windows-msvc -p tuxbox-d3d12` No evidence JSON changed.
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
brcly/TuxBox!173
No description provided.