d3d12, dxbc: give literal sampler states the root lacks private registers above its own #241
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/241"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-26T15:33:44Z.
What was refused: the largest refusal group in the ProjectScarlett 1.0.2.1 shader cache:
mimg at 0x_: sN not a sampler descriptor (Some(InlineWord(N))). That is 458 of the 24,832 recorded requests, 21% of all refusals.Cause: the console compiles a static sampler's state into the program as literal words (
s_movk/s_mov/s_brev). A title can pair the program with a root that has no static sampler in that state, so the translation finds nothing to bind.missing_literal_samplers(#216) appends private samplers in that case, but:inline_sampler::privateaccepts the program: PSV and FSSM must agree, and every sampler must be a literal.s0is refused withstatic sampler sN overlaps another space. JeffreyBytes saw the same thing on the mesh path in #227: 43 of 126 programs.The multi-table raster root restores only what
omittedfinds.Change:
inline_sampler::unmatched(shader, stage, &root)lists each literal state that no static sampler visible to the stage has. Each one gets a register in space 32765, after every sampler register the root uses in any space (static samplers and sampler tables).compute_table::literal_samplerscallsunmatchedfirst and keepsmissing_literal_samplersfor anything it doesn't cover. It is used by the reflected compute root, the single-table raster root andsampler_root, which now also take 0x800 roots. The multi-table raster root callsunmatchedafteromitted.xshaderis unchanged. It already binds a literal state to any static sampler in that state, the title's own first.JeffreyBytes will build the mesh half on top of this (#227):
mesh_table::reflectedcopies the title's static samplers and adds none.Measured against the recorded requests, CPU only, without the game. The 458 refused requests were translated by the current
xshaderafter appending to each request's recorded root the samplers thatmainand this branch would add (literal_samplersfor compute, plusomittedfor pixel). Three requests have no root and are left out:mainInlineWord, 8overlaps another spaceunresolved image, 4PS attr1 has no signature register, 1 dynamicsoffsetNo
InlineWordrefusals remain. The 26 left are other gaps that the samplers had been hiding. This is an upper bound: at runtime, a root gets the samplers only wherereflectedorsampler_roothandles it, and raster pipelines whose layout isUnsupportedstill don't.python tuxbox.py checkpassed on this branch on AMD and NVIDIA (below).raster-samplers.Lanes: new scenario
raster-samplers, run by the existinglanes-raster-tablessuite afterraster-tables.raster_fixture.pyadds a third hand-written console program. The pixel program samples a 2x1 texture of 1.0 and 3.0 at table 1 slot 0, at u = 0.375. Its sampler is linear and clamped, built from literal words (s_movk/s_mov). It declares that sampler ass0.raster-tables, plus a point-filtered static sampler ats0. Every texel must read 1.5, the linear result.main, the translation binds the root'ss0, and every texel reads the point-filtered 1.0. The gate fails withtexel 0,0 is 1: point-filtered by the root's s0, not the program's literal linear state. That was checked on the AMD iGPU with this branch'scompute_table.rsreverted.created raster pipeline with 1 reflected FSSM descriptor slots), adds the private sampler, and the gate passes.raster_tablesandraster_samplersnow share the root and draw helpers inselftest.cpp.Unit tests cover the same case.
inline_sampler: a literal state with no matching static sampler takes a private register, and private registers follow every sampler register of the root.sampler_heap: the translation is refused against the title's root, and translates once the private static sampler is appended.Tested:
cargo test -p tuxbox-dxbc --features native-bindings: 68 passed.cargo testfortools/shader-compiler: 335 + 2 passed.cargo check --locked --target x86_64-pc-windows-msvc -p tuxbox-d3d12 --tests: clean.python -m unittest discover -s tests -q: 379 tests, OK (18 skipped).python tuxbox.py check --adapter 1002:13c0 --proton … --prefix … --windows-dxc …passed, 101 gates (includinglanes-raster-samplers), including Lanes and the fixtures, the D3D12 regression controls and the translator GPU checks.python tuxbox.py checkpassed, 102 gates, includinglanes-raster-samplers. This ran on the branch rebased onto3b8a220; the AMD run was onc6ce497.🤖 Generated with Claude Code