d3d12: reflect raster roots with several descriptor tables #168
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/brcly--TuxBox!168
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/168/head"
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?
@postblink on GitHub · 2026-11-25 12:51 UTC · original
postblink:fix/raster-multi-table-roots→main· +336 −15 · 4 files · 1 commits · merged 2026-11-25 14:21 UTCSummary
ProjectScarlett creates most of its raster pipelines with root signatures that have several leading descriptor tables, for example
[table, table, constants]or[table, table, table, root SRV, constants]. For raster pipelines,compute_table::reflectedaccepted only[table]or[table, constants], so it returnedUnsupportedfor these. The pipeline then kept the guest root with the root-less prepared translations.Those translations name table slots the guest root doesn't cover, so vkd3d-proton refuses the stage with
dxil-spirv: Failed to remap <SRV|CBV|UAV> <space>:<register>(vkd3d result -3), and the title gets a stand-in.This change reflects those roots:
dxbc, table records: under a root with several leading tables, a raster FSSM descriptor record names its table in the high half of its location, as compute records already do, and table N is read from s8 + N.
root_bindingsresolves these records and fails closed on any record whose table and SGPR disagree. Root constants name their parameter the same way, and the existing user-data check confirms them.dxbc, more resource kinds under these roots only:
0x100, two SGPRs, user-data row[1, 0, 2]), read the waymesh_tablereads it. The shader names it with its own register, which can differ from the root's, so it is returned as aROOT_SRVbinding for its parameter.Root-less, single-table and compute results are unchanged.
dxbc, merging stages:
merge_raster_bindingsmerges the vertex and pixel bindings. It returnsNonewhen the stages disagree: one slot with two registers, or one register at two slots.d3d12:
reflectedaccepts raster roots with several leading tables followed by root descriptors and constants.stream: for these roots, the reflected (or original) root is used only when it can be built, both stages have a translation against it, and the pixel shader doesn't export a stencil reference (draws refuse stencil export with a reflected table). Otherwise the pipeline is created exactly as before.
trace: with
TUXBOX_TRACE_RASTER_ROOTS=1, the runtime logs running totals of how these pipelines were created, including which stage did not resolve.Results on ProjectScarlett
These come from an RTX 5080. Title data stayed local; only aggregate counts are given here.
A/B. Two unattended 900 s runs, back to back, branch first, same settings (
VKD3D_SHADER_DEBUG=warn,TUXBOX_TRACE_RASTER_ROOTS=1). The branch run used this commit before its later rebases:range-diffshows the two as identical, on529c52d. The stock run was on5dd0d84, four commits newer, including #165's faster cache lookups, which can only help stock.main0x800700570x80004001Failed to remaplog linesThe refusal codes are unchanged. Neither run logged a kernel
NVRM/Xidline.The branch's trace covered 2,816 multi-table raster pipelines:
Offline, on captured (shader, root) pairs. A run at
5678a2fcaptured 3,545 pairs withTUXBOX_CAPTURE_RASTER_ROOTSandTUXBOX_CAPTURE_SHADER_INPUTS. A local hook, not part of this PR, also captured the unresolved vertex stages.root_bindingsfor the raster stages under roots with two or three leading tables:mainThe three gaps the vertex stages hit were the root SRV (its register differs from the root's in every failing capture), four-dword UAV buffers, and typed SRV buffers.
A parity check on the same captures shows that compute, single-table raster and root-less
bindings()results are identical tomain. Every capture that resolved onmainstill resolves. Under multi-table roots, 2,664 bindings thatmainplaced in table 0 now name the table their record encodes.mainnever used those, becausereflectedrefused these roots.Not covered: if the host refuses the combined PSO after a rooted translation succeeds, this path does not retry with the guest root. The existing single-table path behaves the same way.
Verified on Lanes
python tuxbox.py checkpassed on this branchGPU, driver and backend: NVIDIA GeForce RTX 5080 (
10de:2c02), driver 620.73.04, Proton Experimental 11.0-20261112. Present checks ran in a private rootful Xwayland on CachyOS (kernel 7.3.6), KDE Wayland. All 62 GPU checks passed.This run used
--windows-dxcwith Microsoft's x64 DXC 1.8.2505.1. Xvfb isn't installed on this host, so the D3D12 regression controls ran through a localxvfb-run -astand-in backed by TigerVNC'sXvnc. It gives a private headless X server with no TCP and passes back the command's exit status, and I tested it under the samebwrapsandbox the controls use.Why there is no Lanes scenario yet. Lanes' one console shader (
shader_fixture.py) is a single-instruction compute program with an empty root. Exercising this path needs console vertex and pixel programs whose FSSM records and PSV rows name descriptors in several root tables, plus a pipeline stream with such a root, and all of it must be accepted by the translator. I'd rather add that as a separate pull request than hand-write it into this one. If you want it here, say so. Until then, the DXBC tests below build complete synthetic shaders for the new decoding rules.Checks
python -m unittest discover -s tests: 291 testsShader compiler: 279 + 2
dxbcwithnative-bindings: 58. That includes five new tests:leading_tables_counts_only_the_first_run_of_tablesmulti_table_raster_records_name_their_tableraster_stage_bindings_merge_only_when_they_agreemulti_table_root_srv_carries_the_shader_registermulti_table_raster_buffer_views_follow_psvThe last two build complete synthetic DXBC containers (DXIL with XDAT/FSSM, and PSV0), using test helpers made
pub(crate)inxdat.rs.xg-layout: 14cargo check --target x86_64-pc-windows-msvc -p tuxbox-d3d12Each of these mutations makes a new test fail:
No evidence JSON changed.
Prepared with an AI agent (Claude), with independent review passes by a second model (Codex) that found five fallback bugs, all fixed here. The numbers come from local runs and offline checks on the hardware listed.
ProjectScarlett creates most of its raster pipelines with roots that have several leading descriptor tables, such as [table, table, constants] or [table, table, table, root SRV, constants]. reflected() accepted only [table] and [table, constants] for raster pipelines, so these kept the guest root with the root-less prepared translations. Those translations name table slots the guest root does not cover, and vkd3d-proton refused the stage ("Failed to remap", result -3). - dxbc: under a root with several leading tables, a raster FSSM descriptor record names its table in the high half of its location, as compute records do, and table N is read from s8 + N. root_bindings resolves these records and fails closed on any record whose table and SGPR disagree. Raster root constants name their parameter the same way and are confirmed by the user-data check. - dxbc: under these roots only, also read what their vertex and pixel stages use: - a root SRV (FSSM class 0x100, two SGPRs, user-data row [1, 0, 2]), as mesh_table reads it. The shader names it with its own register, so it is returned as a ROOT_SRV binding for its parameter; - a four-dword UAV buffer, typed, raw or structured as PSV says, the rule compute records already use; - a four-dword typed SRV buffer when PSV names no structured view for the register. Root-less, single-table and compute results are unchanged. - dxbc: merge_raster_bindings merges the vertex and pixel bindings and returns None when the stages disagree (one slot with two registers, or one register at two slots). - d3d12: reflected() accepts raster roots with several leading tables followed by root descriptors and constants. Root SRVs keep their parameter and take the register the shader names, as the mesh layout does. Per-table state is sized to the root. - stream: for these roots the reflected (or original) root is used only when it can be built and both stages translate against it. Otherwise the pipeline is created exactly as before, so a pipeline that worked before is not refused now. - With TUXBOX_TRACE_RASTER_ROOTS=1, the runtime logs running totals of how these pipelines were created, including which stage did not resolve. Co-Authored-By: Claude Opus 5.5 <[email protected]>