d3d12: restore static samplers a multi-table raster root leaves out #174

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

@⁠JeffreyBytes on GitHub · 2026-11-25 14:59 UTC · original
JeffreyBytes:feat/omitted-static-samplers → main · +153 −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: pixel stage untranslated" among the cases it leaves.

The console compiles a static sampler into the program as four literal words. ProjectScarlett creates many raster pipelines with a root signature that lacks a sampler its pixel shader declares in PSV and FSSM, most often a shadow comparison sampler ([0x30b6, 0xc00000, 0x18500000, 0x80000000]: border, border, clamp, LESS_EQUAL, opaque white). The translator finds no static sampler in the root for that state and refuses the shader:

mimg at 0x33c8: s56 not a sampler descriptor (Some(InlineWord(12470))) words [0x30b6, 0xc00000, 0x18500000, 0x80000000]

This change gives the root the sampler back:

  • dxbc: inline_sampler::omitted returns, for a pixel shader and a root, the literal sampler states that no static sampler of the root carries. Each takes a sampler register the shader declares and the root does not cover. It returns nothing when PSV and FSSM disagree about the shader's static samplers, when the shader uses the sampler heap, when the root has no static samplers (the existing pixel and private recoveries own that case), or when there are more missing states than free declared registers.
  • d3d12: the reflected root of a multi-table raster pipeline appends those samplers to the root's own. Until now recovered samplers replaced the root's list, which was right only because that path ran for roots with none.

The translator is unchanged. It is handed the reflected root, so it matches the literal state to the appended sampler the way it matches any other.

Results on ProjectScarlett

Offline, over 14,655 locally recorded requests (measured before the module split; the change is the same): omitted returns samplers for 269 pixel shaders (139 with one, 130 with two). All 269 were refused before and translate once the samplers are in the root. It returns nothing for every request that already translated.

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 + #173
Pipelines not delivered 2,440 2,184 1,797
VS+PS stand-ins 528 395 65

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

Not covered: 38 recorded shaders are still refused for a sampler state. In those the root does carry the declared register, with a different state from the shader's literal (for example linear where the literal is 8x anisotropic). Which side should win there is a separate question.

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: 303 + 2
  • dxbc with native-bindings: 62, including the new a_static_sampler_the_root_leaves_out_takes_its_declared_register
  • 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/174) `JeffreyBytes:feat/omitted-static-samplers` → `main` · +153 −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: pixel stage untranslated" among the cases it leaves. The console compiles a static sampler into the program as four literal words. ProjectScarlett creates many raster pipelines with a root signature that lacks a sampler its pixel shader declares in PSV and FSSM, most often a shadow comparison sampler (`[0x30b6, 0xc00000, 0x18500000, 0x80000000]`: border, border, clamp, `LESS_EQUAL`, opaque white). The translator finds no static sampler in the root for that state and refuses the shader: ```text mimg at 0x33c8: s56 not a sampler descriptor (Some(InlineWord(12470))) words [0x30b6, 0xc00000, 0x18500000, 0x80000000] ``` This change gives the root the sampler back: - **dxbc:** `inline_sampler::omitted` returns, for a pixel shader and a root, the literal sampler states that no static sampler of the root carries. Each takes a sampler register the shader declares and the root does not cover. It returns nothing when PSV and FSSM disagree about the shader's static samplers, when the shader uses the sampler heap, when the root has no static samplers (the existing `pixel` and `private` recoveries own that case), or when there are more missing states than free declared registers. - **d3d12:** the reflected root of a multi-table raster pipeline appends those samplers to the root's own. Until now recovered samplers replaced the root's list, which was right only because that path ran for roots with none. The translator is unchanged. It is handed the reflected root, so it matches the literal state to the appended sampler the way it matches any other. ### Results on ProjectScarlett **Offline**, over 14,655 locally recorded requests (measured before the module split; the change is the same): `omitted` returns samplers for 269 pixel shaders (139 with one, 130 with two). All 269 were refused before and translate once the samplers are in the root. It returns nothing for every request that already translated. **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 + #173 | | --- | --- | --- | --- | | Pipelines not delivered | 2,440 | 2,184 | 1,797 | | VS+PS stand-ins | 528 | 395 | 65 | No failed presents in any run, and the present rate is the same across builds (about 300 to 340 per 10 s). #173 alone gives 202 stand-ins; the two together reach 65 because some pipelines need both stages fixed before either can use the reflected root. **Not covered:** 38 recorded shaders are still refused for a sampler state. In those the root does carry the declared register, with a different state from the shader's literal (for example linear where the literal is 8x anisotropic). Which side should win there is a separate question. ## 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: 303 + 2 - `dxbc` with `native-bindings`: 62, including the new `a_static_sampler_the_root_leaves_out_takes_its_declared_register` - `xg-layout`: 14 - `cargo check --target x86_64-pc-windows-msvc -p tuxbox-d3d12` No evidence JSON changed.
The console compiles a static sampler into the program, so a title can
create a pipeline with a root signature that lacks a sampler its pixel
shader declares. The translation then finds no sampler for that literal
state and refuses the shader ("not a sampler descriptor").

inline_sampler::omitted returns those states for a pixel shader: literal
states no static sampler of the root carries, each given a sampler
register the shader declares in PSV and FSSM and the root does not
cover. The reflected root of a multi-table raster pipeline appends them
to the root's own samplers, and the translation, which reads that root,
binds them like any other static sampler.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:36:18 +00:00
github manually merged commit a2e5f35ac9 into gh-pr/174/base 2026-11-26 06:36:19 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.