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

Manually merged
github merged 1 commit from gh-pr/173/head into gh-pr/173/base 2026-11-26 06:36:16 +00:00
Owner

@⁠JeffreyBytes on GitHub · 2026-11-25 14:59 UTC · original
JeffreyBytes:feat/vertex-table-parameter → main · +48 −0 · 3 files · 1 commits · merged 2026-11-25 18:00 UTC

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.

**@⁠JeffreyBytes** on GitHub · 2026-11-25 14:59 UTC · [original](https://github.com/brcly/TuxBox/pull/173) `JeffreyBytes:feat/vertex-table-parameter` → `main` · +48 −0 · 3 files · 1 commits · merged 2026-11-25 18:00 UTC ## 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.
root_table mapped a table register to a root parameter by a fixed base,
and for a vertex shader that starts with s_swappc_b64 it used the
chained-entry rule (tables seven registers after the swapped pair). That
rule 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 shader's used-resource records place descriptors in the
register, use the parameter they name. The chained-entry rule still
applies to registers the records do not mention.

Over 14,924 recorded ProjectScarlett requests: 83 outputs change, all
vertex shaders whose registers move to the ones their root declares; 38
requests that were refused now translate; none regress.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:36:14 +00:00
github manually merged commit 4b56c70711 into gh-pr/173/base 2026-11-26 06:36:16 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.