xshader: keep a compute root's layout when the runtime appends its private root SRVs #296
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/296"
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-27T03:19:50Z.
The bug
The runtime appends two private root SRVs to a compute root when a program needs them: the heap index map (t0, space32766) and the buffer stride table (t1, space32766). The translator matched a compute root by its exact parameter count in two places:
sampler_heap::constantsacceptstable, constantsandtable, table, constants. With an SRV appended neither form matched, so the root constants were not declared and the registers they fill stayed 0.4 + nparams, and the two-table check), so an appended parameter could move them.The translation still compiled and ran, with zeros where the title's constants should be.
What it affects today
Of the 25,397 recorded ProjectScarlett requests, 127 are compute programs translated against a root with the stride table appended, and all 127 lose their root constants on
main. 123 areCS_RaytracingResolve; the others areCS_ComputeImposterTransform, the twoCS_EntityFireReduceClassificationvariants and one I could not name. In the resolve kernels the constants are four words: one is multiplied into a buffer index and one selects the kernel's mode.All 127 are among the compute programs that only translate since #216, the set whose replacement with no-ops got a run past the Xid 109 in #232. That is a correlation, not a finding. A ProjectScarlett run with only this change still hit the Xid 109 at the same point, so it doesn't fix the hang on its own (see #232). It is still wrong output for those 127 programs, and it would also hit the roots #294 gives the index map to, since most of those have root constants.
The change
sampler_heap::guest_paramsgives the root without its trailing space-32766 root SRVs. The console program was compiled without them, so they take no launch register. The compute forms ofconstantsand the dispatch-ID calculation use it. The pixel form, which names the index map itself, is unchanged.Tests
the_runtimes_private_root_srvs_leave_a_compute_roots_layout_alonetranslates a program undertable, constantswith the flag, then with the index map, the stride table, and both appended. It fails onmainat the first appended root (the constant buffer and its register load are missing).cargo testfortools/shader-compiler: 411 passed.python -m unittest discover -s tests -q: 426 ran, OK.mainand with this change: 0 recovered, 0 regressed (23,720 translated, 1,569 refused and 108 failed on both sides). Outputs: 23,701 byte-identical, 127 changed. Each changed output only gains thecbuffer TBIndex…declaration and its register loads.Checks
python tuxbox.py checkpassed on this branch, on AMD and NVIDIA:python tuxbox.py check --adapter 1002:13c0 --proton … --prefix … --windows-dxc …passed, 132 gates.🤖 Generated with Claude Code