Skip to content

fix(d3d12): restore missing literal samplers in mesh pipelines - #246

Open
brainbudt wants to merge 1 commit into
brcly:mainfrom
brainbudt:fix/mesh-missing-literal-samplers
Open

brainbudt wants to merge 1 commit into
brcly:mainfrom
brainbudt:fix/mesh-missing-literal-samplers

Conversation

@brainbudt

Copy link
Copy Markdown
Contributor

Problem

A console pixel program can build a literal sampler state absent from the mesh pipeline's root signature. If rooted translation is refused, the fallback can reference a sampler in space 32765 that the host root lacks, and D3D12 rejects the pipeline. Refs #227.

Change

  • Retry refused pixel translations with the missing states appended as pixel-visible static samplers in both the host root and the translation root, placed above sampler registers named by the root and shader.
  • Preserve the original fallback if D3D12 rejects the extended root, recognize pixel shaders that already embed a root, accept zero-parameter roots with null parameter pointers, and guard register-range arithmetic against zero-length ranges and overflow.

Scope

Covers sampler recovery for the reflected mesh path in #227. Note: the shared inline_sampler helper overlaps with open PR #241 — happy to rebase onto #241 once it lands.

Verification

  • Linux x86-64: all 6 python tuxbox.py check --no-gpu stages passed (377 Python tests with 27 skips, 425 release Rust tests, D3D12 & BVH Windows typecheck).
  • macOS ARM64: all 425 Rust tests and Windows typecheck passed; new register-bounds regression test reproduced the subtraction panic before the fix and passes after.
  • AMD and NVIDIA Lanes runs remain pending.

Reviewed & refined with GPT-6.2 Sol in Codex; implemented with Mistral Large 4 in Mistral Vibe (orchestrated with Gemini 4 Neon in T3 Code).

@brcly

brcly commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Thanks for this. #241 has now merged, and it overlaps: a merge leaves two definitions of inline_sampler::unmatched and unmatched_states, so it won't build. Could you rebase, drop this copy and call the one on main? It also covers roots with flag 0x800, which this version skips.

Please check with @JeffreyBytes in #227 too: they had claimed the mesh half and planned a Lanes scenario for it. Before merging we'd need a Lanes scenario for the mesh path and a full check on AMD and NVIDIA.

@JeffreyBytes

Copy link
Copy Markdown
Contributor

Thanks for the ping, @brcly. @brainbudt, to save us both work, here is where the mesh half from #227 stands on my side:

So I'd suggest not rebasing this one onto #241; the result would be the same change twice. Two things in your version go beyond mine and I'd like to hear more about them, since they might be worth a follow-up or a review comment on my PR:

  • "recognize pixel shaders that already embed a root" and "accept zero-parameter roots with null parameter pointers": did you see either in a recorded pipeline, or are they defensive? None of the 204 pipelines I traced has either.
  • The guard for zero-length sampler ranges. If main's unmatched can underflow there, that is a bug in d3d12, dxbc: give literal sampler states the root lacks private registers above its own #241's helper and deserves its own small PR with your regression test.

If you have an NVIDIA or a second AMD card, a run of my PR once it is up would help more than anything.

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