d3d12: reflect raster roots with several descriptor tables #168
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/168"
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 postblink on 2026-11-25T12:51:57Z.
Summary
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.