Skip to content

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

Merged
brcly merged 2 commits into
brcly:mainfrom
JeffreyBytes:fix/mesh-rootless-literal-samplers
Nov 27, 2026
Merged

brcly merged 2 commits into
brcly:mainfrom
JeffreyBytes:fix/mesh-rootless-literal-samplers

Conversation

@JeffreyBytes

@JeffreyBytes JeffreyBytes commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

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). d3d12: give a mesh pipeline's pixel stage the literal samplers its root leaves out #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.

…ith no static samplers

A console pixel program builds its samplers from literal words, so a title's
root can leave them out entirely. Against a root with no static samplers the
translation reads each literal state from a private sampler (space 32765).
The vertex and pixel roots add those samplers when they are reflected
(inline_sampler::pixel, then inline_sampler::private), but the mesh path asked
only inline_sampler::unmatched, which leaves a root without static samplers to
those two. The mesh root then lacked the sampler the pixel translation names,
and vkd3d-proton rejected the pipeline with "Failed to remap sampler 32765:0"
(E_INVALIDARG).

When the root the pixel stage is translated against has no static samplers,
build the mesh table again with the samplers the vertex and pixel roots
recover: the program's one declared sampler at its own register, or else its
private samplers from register 0, which is where the translation against a
root holding exactly those reads them. As before, the extended root is kept
only if the pixel program translates against it.
Add the `mesh-sampler-rootless` scenario. It draws through the `mesh-samplers`
mesh program under the two-table root without its static samplers, with two
pixel programs that sample with the literal linear state: the `raster-samplers`
program, which declares only s0, and the two-sampler program with an empty
feature part (SFI0), which shows it reads no sampler from the heap. The
provider recovers the first program's sampler at its declared register and
the second's at a private register, so the scenario covers both.

The provider has to add those samplers to the mesh root it builds, so every
texel reads the linear 1.5. Without that the pixel translation names a
private sampler the root lacks, the host rejects the pipeline (0x80070057)
and the target keeps its clear value.

The `lanes-raster-tables` verify suite runs it after `mesh-sampler-single`
under the same gate: the mesh pipeline and its one reflected descriptor slot,
no stand-in, and no translation of a pixel program without a root. Like the
other mesh scenarios it stays out of `all`.
@NickStallman

Copy link
Copy Markdown
Contributor

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.

@JeffreyBytes
JeffreyBytes marked this pull request as ready for review November 27, 2026 01:54
@brcly
brcly merged commit f48ce02 into brcly:main Nov 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants