d3d12: give a mesh pipeline's pixel stage the literal samplers its root leaves out #266

Merged
JeffreyBytes merged 3 commits from upstream-pr/266 into main 2026-11-26 21:27:17 +00:00
JeffreyBytes commented 2026-11-26 20:05:11 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by JeffreyBytes on 2026-11-26T20:05:11Z.


Summary

The mesh half of #227, on top of #241's inline_sampler::unmatched. Three commits:

  1. d3d12: give a mesh pipeline's pixel stage the literal samplers its root leaves out (38 lines). On main, 204 distinct mesh + pixel pipelines in ProjectScarlett 1.0.2.1 fail with 0x80070057 between the Account Picker and the story loading screen. Their pixel program builds a sampler from literal words that no static sampler of the pipeline root matches. The translation against the root is refused (mimg … not a sampler descriptor (InlineWord)), the mesh path falls back to the root-less translation, and that reads samplers in space 32765, which nothing adds to a mesh pipeline's root: dxil-spirv: Failed to remap sampler 32765:0. When the translation is refused, stream.rs now builds the mesh table again with the unmatched literal states appended as private static samplers, to both the host root and the root the pixel stage is translated against, and uses it if the pixel program then translates.
  2. lanes: draw through a mesh pipeline whose pixel sampler the root lacks: the scenario mesh-samplers.
  3. d3d12: add a mesh pixel program's unmatched literal samplers when it translates too, with the scenario mesh-sampler-single. This is a second fault found while writing the first scenario, and it is on main today: when the pixel program declares exactly one sampler, the translation binds the literal state to that register whatever state the root gives it. The translation succeeds, the pipeline is accepted, and it samples with the root's state instead of the program's. The vertex + pixel roots already append unmatched states every time (#241); this makes the mesh path do the same, keeping the root as declared only if the program does not translate against the extended one.

Commit 3 changes the pixel root of mesh pipelines that are accepted today, so it is the one to look at hardest. It is separate so that 1 and 2 can be taken without it.

Measured, RX 6700 XT, ProjectScarlett from the Account Picker to the story loading screen, two or more runs per row with identical counts. Distinct pipelines, creations in parentheses:

kind main commit 1 all three
mesh + pixel 0x80070057 417 (930) 213 (483) 213 (483)
mesh + pixel 0x80004001 / 0x80004005 184 / 29 184 / 29 184 / 29
vertex + pixel stand-in 48 (75) 48 (75) 48 (75)
compute stand-in 248 248 248

Commit 3 recompiled 7 pixel variants on its first launch and changed no count. The 213 that remain are almost all pixel programs with no translation yet (breakdown in #227).

Not verified: what these pipelines draw in the game. Every AMD run still ends at the page-remap device loss from #191 about two minutes after the picker, so I can't see past the loading screen. A run on NVIDIA past that point would be very welcome, in particular for commit 3.

Verified on Lanes

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

Both scenarios run in the lanes-raster-tables suite after raster-samplers. Everything in them is written by hand for the test; nothing comes from a title.

  • mesh-samplers: #241's console pixel program (a linear clamp sampler built from literal words), declaring two samplers that the root has as point-filtered statics. The mesh program is a console container with records only (its code is one s_endpgm); its records name a root constant at another register than the root does, so the provider builds a mesh table. Its translation is a prepared desktop mesh shader, mesh_samplers.hlsl, a fullscreen triangle. Every texel must read the linear value.
    • on main: lanes-selftest FAIL mesh-samplers: create pipeline from console raster programs failed: 0x80070057
    • with commit 1: lanes-selftest PASS pci=1002:73df scenario=mesh-samplers passed=1
  • mesh-sampler-single: the same, with only s0 declared and a point-filtered s0 in the root.
    • on main and with commits 1 and 2: texel 0,0 is 1: point-filtered by the root's s0, not the program's literal linear state
    • with commit 3: passes

GPU, driver and backend: AMD Radeon RX 6700 XT (1002:73df), Mesa RADV 26.3.1, Linux 7.3.6, Proton backend with GE-Proton11-14. The game runs used the ANONONLY preload from #191.

  • This changes code both vendors run, and the check passed on an AMD and an NVIDIA card. AMD: RX 6700 XT, below. NVIDIA: RTX 5090, run by @NickStallman on c6a4887 (114 gates, comment).
  passed   Build the shader compiler (0s)
  passed   Python tests (4s)
  passed   Shader compiler tests (0s)
  passed   DXBC tests (0s)
  passed   XG layout tests (1s)
  passed   D3D12 Windows typecheck (0s)
  passed   Build (21s)
  passed   Lanes and fixtures on the GPU (173s)
  passed   D3D12 regression controls (527s)
  passed   Shader translator on the GPU (1205s)

All checks passed.

The check ran on this branch at facfaab. main has moved since; nothing merged after that touches these files.

Checks

The CI commands pass locally: tuxbox-dxbc 68 tests, shader compiler 371, and the tuxbox-d3d12 Windows typecheck. No evidence JSON changes.

<!-- greyfinch-sync:brcly/TuxBox:issue:5516459531 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/266). Originally posted by [JeffreyBytes](https://github.com/JeffreyBytes) on 2026-11-26T20:05:11Z. --- ## Summary The mesh half of #227, on top of #241's `inline_sampler::unmatched`. Three commits: 1. **`d3d12: give a mesh pipeline's pixel stage the literal samplers its root leaves out`** (38 lines). On `main`, 204 distinct mesh + pixel pipelines in ProjectScarlett 1.0.2.1 fail with `0x80070057` between the Account Picker and the story loading screen. Their pixel program builds a sampler from literal words that no static sampler of the pipeline root matches. The translation against the root is refused (`mimg … not a sampler descriptor (InlineWord)`), the mesh path falls back to the root-less translation, and that reads samplers in space 32765, which nothing adds to a mesh pipeline's root: `dxil-spirv: Failed to remap sampler 32765:0`. When the translation is refused, `stream.rs` now builds the mesh table again with the unmatched literal states appended as private static samplers, to both the host root and the root the pixel stage is translated against, and uses it if the pixel program then translates. 2. **`lanes: draw through a mesh pipeline whose pixel sampler the root lacks`**: the scenario `mesh-samplers`. 3. **`d3d12: add a mesh pixel program's unmatched literal samplers when it translates too`**, with the scenario `mesh-sampler-single`. This is a second fault found while writing the first scenario, and it is on `main` today: when the pixel program declares exactly one sampler, the translation binds the literal state to that register whatever state the root gives it. The translation succeeds, the pipeline is accepted, and it samples with the root's state instead of the program's. The vertex + pixel roots already append unmatched states every time (#241); this makes the mesh path do the same, keeping the root as declared only if the program does not translate against the extended one. Commit 3 changes the pixel root of mesh pipelines that are accepted today, so it is the one to look at hardest. It is separate so that 1 and 2 can be taken without it. **Measured**, RX 6700 XT, ProjectScarlett from the Account Picker to the story loading screen, two or more runs per row with identical counts. Distinct pipelines, creations in parentheses: | kind | `main` | commit 1 | all three | | --- | --- | --- | --- | | mesh + pixel `0x80070057` | 417 (930) | 213 (483) | 213 (483) | | mesh + pixel `0x80004001` / `0x80004005` | 184 / 29 | 184 / 29 | 184 / 29 | | vertex + pixel stand-in | 48 (75) | 48 (75) | 48 (75) | | compute stand-in | 248 | 248 | 248 | Commit 3 recompiled 7 pixel variants on its first launch and changed no count. The 213 that remain are almost all pixel programs with no translation yet (breakdown in #227). **Not verified:** what these pipelines draw in the game. Every AMD run still ends at the page-remap device loss from #191 about two minutes after the picker, so I can't see past the loading screen. A run on NVIDIA past that point would be very welcome, in particular for commit 3. ## Verified on Lanes - [x] `python tuxbox.py check` passed on this branch - [x] Changed or new behavior is covered by a Lanes scenario, or the reason it cannot be is stated below Both scenarios run in the `lanes-raster-tables` suite after `raster-samplers`. Everything in them is written by hand for the test; nothing comes from a title. - **`mesh-samplers`**: #241's console pixel program (a linear clamp sampler built from literal words), declaring two samplers that the root has as point-filtered statics. The mesh program is a console container with records only (its code is one `s_endpgm`); its records name a root constant at another register than the root does, so the provider builds a mesh table. Its translation is a prepared desktop mesh shader, `mesh_samplers.hlsl`, a fullscreen triangle. Every texel must read the linear value. - on `main`: `lanes-selftest FAIL mesh-samplers: create pipeline from console raster programs failed: 0x80070057` - with commit 1: `lanes-selftest PASS pci=1002:73df scenario=mesh-samplers passed=1` - **`mesh-sampler-single`**: the same, with only `s0` declared and a point-filtered `s0` in the root. - on `main` and with commits 1 and 2: `texel 0,0 is 1: point-filtered by the root's s0, not the program's literal linear state` - with commit 3: passes GPU, driver and backend: AMD Radeon RX 6700 XT (`1002:73df`), Mesa RADV 26.3.1, Linux 7.3.6, Proton backend with GE-Proton11-14. The game runs used the `ANONONLY` preload from #191. - [x] This changes code both vendors run, and the check passed on an AMD and an NVIDIA card. AMD: RX 6700 XT, below. NVIDIA: RTX 5090, run by @NickStallman on `c6a4887` (114 gates, [comment](https://github.com/brcly/TuxBox/pull/266#issuecomment-7203110648)). ```text passed Build the shader compiler (0s) passed Python tests (4s) passed Shader compiler tests (0s) passed DXBC tests (0s) passed XG layout tests (1s) passed D3D12 Windows typecheck (0s) passed Build (21s) passed Lanes and fixtures on the GPU (173s) passed D3D12 regression controls (527s) passed Shader translator on the GPU (1205s) All checks passed. ``` The check ran on this branch at `facfaab`. `main` has moved since; nothing merged after that touches these files. ## Checks The CI commands pass locally: `tuxbox-dxbc` 68 tests, shader compiler 371, and the `tuxbox-d3d12` Windows typecheck. No evidence JSON changes.
NickStallman commented 2026-11-26 20:49:33 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-26T20:49:33Z.


NVIDIA run of c6a4887 (this PR's head on facfaab): full python tuxbox.py check --adapter 10de:2b85 --proton … --prefix … --windows-dxc … passed, 114 gates, including lanes-mesh-samplers and lanes-mesh-sampler-single.

  • RTX 5090 (10de:2b85), driver 620.70.10, GE-Proton11-14, Linux 7.0.
  • All groups passed: Lanes and the fixtures (273 s), the D3D12 regression controls (330 s) and the shader translator on the GPU (789 s).

I'll do a ProjectScarlett run past the loading screen on this branch after my baseline runs on main, and post what the mesh pipelines draw.

<!-- greyfinch-sync:brcly/TuxBox:comment:7203110648 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/266#issuecomment-7203110648). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-26T20:49:33Z. --- NVIDIA run of `c6a4887` (this PR's head on `facfaab`): full `python tuxbox.py check --adapter 10de:2b85 --proton … --prefix … --windows-dxc …` passed, 114 gates, including `lanes-mesh-samplers` and `lanes-mesh-sampler-single`. - RTX 5090 (10de:2b85), driver 620.70.10, GE-Proton11-14, Linux 7.0. - All groups passed: Lanes and the fixtures (273 s), the D3D12 regression controls (330 s) and the shader translator on the GPU (789 s). I'll do a ProjectScarlett run past the loading screen on this branch after my baseline runs on main, and post what the mesh pipelines draw.
Valdi320 commented 2026-11-26 21:01:10 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by Valdi320 on 2026-11-26T21:01:10Z.


Independent NVIDIA verification of c6a4887 (unmodified PR head): RTX 4080 (10de:2704), GE-Proton11-14, Linux. Built the shader compiler, provider and Lanes locally; all six non-GPU groups passed, then 12/12 selected Lanes checks passed with null pipelines disabled, including lanes-raster-tables, lanes-raster-samplers, lanes-mesh-samplers and lanes-mesh-sampler-single. Used an isolated fixture prefix and private headless display. No game capture or retail assets were used. This confirms the synthetic sampler scenarios on NVIDIA in addition to the reported AMD run; not a new game replay or full translator suite.

<!-- greyfinch-sync:brcly/TuxBox:comment:7203302269 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/266#issuecomment-7203302269). Originally posted by [Valdi320](https://github.com/Valdi320) on 2026-11-26T21:01:10Z. --- Independent NVIDIA verification of c6a4887 (unmodified PR head): RTX 4080 (10de:2704), GE-Proton11-14, Linux. Built the shader compiler, provider and Lanes locally; all six non-GPU groups passed, then 12/12 selected Lanes checks passed with null pipelines disabled, including lanes-raster-tables, lanes-raster-samplers, lanes-mesh-samplers and lanes-mesh-sampler-single. Used an isolated fixture prefix and private headless display. No game capture or retail assets were used. This confirms the synthetic sampler scenarios on NVIDIA in addition to the reported AMD run; not a new game replay or full translator suite.
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!266
No description provided.