d3d12: recover a mesh pixel program's literal samplers under a root with no static samplers #291

Merged
JeffreyBytes merged 2 commits from upstream-pr/291 into main 2026-11-27 01:54:42 +00:00
JeffreyBytes commented 2026-11-27 01:19:02 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by JeffreyBytes on 2026-11-27T01:19:02Z.


Summary

A follow-up to #266 that finishes the literal-sampler part of #227. Two commits:

  1. d3d12: recover a mesh pixel program's literal samplers under a root with no static samplers (15 lines across stream.rs and compute_table.rs). #266 appends a mesh pixel program's unmatched literal samplers through inline_sampler::unmatched, which returns nothing for a root with no static samplers at all and leaves that case to inline_sampler::pixel and inline_sampler::private. The vertex + pixel roots call those two; the mesh path did not. So under such a root the pixel translation still names a private sampler the mesh root lacks, and vkd3d-proton rejects the pipeline: dxil-spirv: Failed to remap sampler 32765:0, 0x80070057. The mesh path now uses the same recovery as the vertex + pixel roots, through one shared helper, and as before keeps the extended root only if the pixel program translates against it.
  2. lanes: draw through mesh pipelines whose root has no static samplers: the scenario mesh-sampler-rootless.

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

kind main (8c56463) this branch
Failed to remap sampler 32765:0 lines 4 0
mesh + pixel 0x80070057 123 (284) 121 (282)
mesh + pixel 0x80004001 / 0x80004005 43 / 5 43 / 5
vertex + pixel stand-in 42 (57) 42 (57)
compute stand-in 227 (228) 227 (228)

Two pixel variants were compiled on the first launch and none on the second. It is a small number in this part of the game; the 121 that remain are pixel programs with no translation yet, not samplers.

Known gaps, the same ones the vertex + pixel path has: inline_sampler::private returns nothing for a pixel container without an SFI0 part, so such a program under a root with no static samplers is still not recovered. The block also only runs when a mesh table already exists, as in #266.

Not verified: what these two pipelines draw in the game.

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

mesh-sampler-rootless runs in the lanes-raster-tables suite after mesh-sampler-single. It uses the mesh-samplers mesh program under the two-table root without its static samplers, with two pixel programs that sample with a literal linear state: the raster-samplers program, which declares one sampler (recovered at its own register), and the two-sampler program with an empty SFI0 part (recovered at private registers). Everything in it is written by hand for the test; nothing comes from a title.

  • on main: lanes-mesh-sampler-rootless FAIL, slot 86 pipeline stage failure #1 0x80070057
  • with commit 1: passes, together with lanes-mesh-samplers, lanes-mesh-sampler-single and lanes-raster-samplers

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 f3ed825 (128 gates, comment).
  passed   Build the shader compiler (0s)
  passed   Python tests (4s)
  passed   Shader compiler tests (10s)
  passed   DXBC tests (1s)
  passed   XG layout tests (1s)
  passed   D3D12 Windows typecheck (2s)
  passed   Build (22s)
  passed   Lanes and fixtures on the GPU (214s)
  passed   D3D12 regression controls (80s)
  passed   Shader translator on the GPU (266s)

All checks passed.

The check ran on this branch at ab644f0. main has moved since; the branch still merges cleanly.

Checks

The CI commands pass locally: the tuxbox-dxbc tests, the Python tests (414) and the tuxbox-d3d12 Windows typecheck. No evidence JSON changes.

<!-- greyfinch-sync:brcly/TuxBox:issue:5519519359 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/291). Originally posted by [JeffreyBytes](https://github.com/JeffreyBytes) on 2026-11-27T01:19:02Z. --- ## Summary A follow-up to #266 that finishes the literal-sampler part of #227. Two commits: 1. **`d3d12: recover a mesh pixel program's literal samplers under a root with no static samplers`** (15 lines across `stream.rs` and `compute_table.rs`). #266 appends a mesh pixel program's unmatched literal samplers through `inline_sampler::unmatched`, which returns nothing for a root with no static samplers at all and leaves that case to `inline_sampler::pixel` and `inline_sampler::private`. The vertex + pixel roots call those two; the mesh path did not. So under such a root the pixel translation still names a private sampler the mesh root lacks, and vkd3d-proton rejects the pipeline: `dxil-spirv: Failed to remap sampler 32765:0`, `0x80070057`. The mesh path now uses the same recovery as the vertex + pixel roots, through one shared helper, and as before keeps the extended root only if the pixel program translates against it. 2. **`lanes: draw through mesh pipelines whose root has no static samplers`**: the scenario `mesh-sampler-rootless`. **Measured**, RX 6700 XT, ProjectScarlett 1.0.2.1 from the Account Picker to the story loading screen, two runs with identical counts. Distinct pipelines, creations in parentheses: | kind | `main` (`8c56463`) | this branch | | --- | --- | --- | | `Failed to remap sampler 32765:0` lines | 4 | 0 | | mesh + pixel `0x80070057` | 123 (284) | 121 (282) | | mesh + pixel `0x80004001` / `0x80004005` | 43 / 5 | 43 / 5 | | vertex + pixel stand-in | 42 (57) | 42 (57) | | compute stand-in | 227 (228) | 227 (228) | Two pixel variants were compiled on the first launch and none on the second. It is a small number in this part of the game; the 121 that remain are pixel programs with no translation yet, not samplers. **Known gaps, the same ones the vertex + pixel path has:** `inline_sampler::private` returns nothing for a pixel container without an `SFI0` part, so such a program under a root with no static samplers is still not recovered. The block also only runs when a mesh table already exists, as in #266. **Not verified:** what these two pipelines draw in the game. ## 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 `mesh-sampler-rootless` runs in the `lanes-raster-tables` suite after `mesh-sampler-single`. It uses the `mesh-samplers` mesh program under the two-table root without its static samplers, with two pixel programs that sample with a literal linear state: the `raster-samplers` program, which declares one sampler (recovered at its own register), and the two-sampler program with an empty `SFI0` part (recovered at private registers). Everything in it is written by hand for the test; nothing comes from a title. - on `main`: `lanes-mesh-sampler-rootless FAIL`, `slot 86 pipeline stage failure #1 0x80070057` - with commit 1: passes, together with `lanes-mesh-samplers`, `lanes-mesh-sampler-single` and `lanes-raster-samplers` 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 `f3ed825` (128 gates, [comment](https://github.com/brcly/TuxBox/pull/291#issuecomment-7207606397)). ```text passed Build the shader compiler (0s) passed Python tests (4s) passed Shader compiler tests (10s) passed DXBC tests (1s) passed XG layout tests (1s) passed D3D12 Windows typecheck (2s) passed Build (22s) passed Lanes and fixtures on the GPU (214s) passed D3D12 regression controls (80s) passed Shader translator on the GPU (266s) All checks passed. ``` The check ran on this branch at `ab644f0`. `main` has moved since; the branch still merges cleanly. ## Checks The CI commands pass locally: the `tuxbox-dxbc` tests, the Python tests (414) and the `tuxbox-d3d12` Windows typecheck. No evidence JSON changes.
NickStallman commented 2026-11-27 01:49:29 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-27T01:49:29Z.


NVIDIA run of f3ed825 (this PR's head): the full python tuxbox.py check --adapter 10de:2b85 --proton … --prefix … --windows-dxc … passed, 128 gates, including the mesh sampler Lanes scenarios. Every group passed: Lanes and the self-tests, the D3D12 regression controls and the translator on the GPU.

RTX 5090 (10de:2b85), driver 620.70.10 (open kernel module), GE-Proton11-14, Linux 7.0. This was the check only; I didn't do a game run on this branch.

<!-- greyfinch-sync:brcly/TuxBox:comment:7207606397 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/291#issuecomment-7207606397). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-27T01:49:29Z. --- NVIDIA run of `f3ed825` (this PR's head): the full `python tuxbox.py check --adapter 10de:2b85 --proton … --prefix … --windows-dxc …` passed, 128 gates, including the mesh sampler Lanes scenarios. Every group passed: Lanes and the self-tests, the D3D12 regression controls and the translator on the GPU. RTX 5090 (10de:2b85), driver 620.70.10 (open kernel module), GE-Proton11-14, Linux 7.0. This was the check only; I didn't do a game run on this branch.
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!291
No description provided.