d3d12: pipeline direct index fix #610
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/610"
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 s3rius on 2026-12-01T02:52:50Z.
Summary
Until now, a pipeline whose root signature sets
CBV_SRV_UAV_HEAP_DIRECTLY_INDEXEDcould not be served by the guest root unchanged once descriptors are paged: the
draw path had no layout to bind, so draws (and, in the compute path, dispatches)
for such pipelines were dropped at the consumer with "its root indexes the
resource heap directly". In ProjectScarlett this skipped thousands of draws.
This adds the missing reflected-table construction to the two graphics paths,
mirroring what the compute path and the vertex/pixel stream path already do:
graphics.rs) — the regular pathnever built a reflected table. For direct-indexed roots it now builds the
reflected table (guest root + index map appended), translates VS/PS against
it (with the heap-stride retry), and creates the pipeline with the table's
native root, so the draw binds through the paged layout. The screen-rectangle
path, unparseable roots, stencil-exporting pixel shaders and untranslatable
stages keep the previous guest-root/skip behaviour.
mesh_table.rs) — the mesh path only built areflected table when the mesh program rewrote declared resources, and never
appended the index map, so direct-indexed mesh pipelines carried no table at
all. It now builds the reflected table whenever the root is direct-indexed —
including the no-rewrite case — appending the index map to both the host root
and the root the pixel program is translated against (same layout as the
raster/compute tables, including the room check and pixel-root inclusion).
Tested
Run the checks relevant to this change.
GPU, driver and backend: nvidia-open-dkms-620.73.04-1
The
Evidence:linetuxbox.py checkprints last, one per card (it names the commit it tested; run it on this pull request's head):Commands run and their results:
Checks
CI runs the code checks: the Python and Rust unit tests, the translator tests through DXC, a Windows typecheck, clippy, formatting, rustdoc, and Miri on the providers. It has no GPU.
If this pull request changes evidence JSON, regenerate the results table and the progress map and include both files:
Imported from brcly/TuxBox. Originally posted by s3rius on 2026-12-01T02:53:12Z.
Needs AMD gpu run.
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-01T03:22:13Z.
@s3rius we have this overlap: it's the same class of skipped draws we chased today, with a separate fix in our integration branch (an extra commit on #390's). I'll drop ours if this goes in. Some measurements, a code question, and the AMD run you asked for.
Measured with our version (RTX 5090, 620.70.10, GE-Proton11-15, ProjectScarlett's world): one depth-only cascade-shadow mesh pipeline was skipped about 338 times a frame for exactly this reason (no table changes, so
mesh_table::reflectedreturned none, withdirect_resourcesset). With a table carrying only the map, it is drawn 344 times a frame and skipped 0, and skipped calls fell from 236,000–307,000 to 58,000 in 18 minutes (that build has other changes too). Details on #390.A question, from reading
2a09f062, not from a test. The mesh path appends the map to the native root and to the pixel root, butstream.rs:289still translates the mesh stage withmesh_stage(code, stage, guest_root.payload()), the title's root, without the map. So a mesh program that itself reads the heap would, as I read it, be drawn using the title's raw indices, where today the draw is skipped. #390 translates the mesh (and amplification) stage against the mapped root, and our commit uses the table only if that translation exists. Similarly,rooted[1]staysNoneif the pixel stage doesn't translate against the new pixel root, and the pipeline then keeps the earlier pixel code, which has no map either. Is either handled somewhere I haven't seen? Your Lanes case can't show it (its mesh program doesn't read the heap).AMD and NVIDIA checks of
2a09f062are queued behind our running game runs, and I'll post the results here; the evidence line in the description is from b40cffca, which is not the head.Imported from brcly/TuxBox. Originally posted by JeffreyBytes on 2026-12-01T03:24:59Z.
@brcly this went in 41 seconds after Nick's comment above, so I think his question got missed. From reading main at
717a74c4(not from a run), it's still there:stream.rs:296translates the mesh stage withmesh_stage(code, stage, guest_root...), andstream.rs:1002links withmesh_link_source(mesh_code, guest_root...), both on the title's root without the map. Now thatindex_mapis set, these draws aren't skipped anymore, so a mesh program that reads the heap directly runs with the title's raw indices as visible slots under paging. Before this it was skipped.pixel_root,rooted[1]staysNoneand the pipeline keeps the pixel code without the map too.The Lanes case added here doesn't read the heap from the mesh program, so neither shows up in
check.This also matters for AMD. #390's description says that once these terrain mesh draws run, RADV hung on the first terrain draw with a non-zero packed root constant (
MS_VS_TransformTerrainNormalTint) in 3 of 5 runs, with a hard recovery and no memory fault. On my RX 6700 XT a failed ring reset like that has needed a reboot. Nothing about that was tested on AMD before this merged, so I'd treat world runs on main past717a74c4on AMD as risky until it's checked.Could the mesh half either use #390's approach (translate the mesh and amplification stages on the mapped root and only use the table when that translation exists, which is what Nick's integration branch does) or be reverted to the skip until that lands? The graphics half can stay as it is.
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-01T03:56:36Z.
The AMD run of
2a09f062(this PR's head; it merged while the check ran). GE-Proton11-15, AMD iGPU (1002:13c0, RADV): 207 pass, 0 fail,lanes-mesh-direct-indexedincluded.Evidence: TuxBox check of
2a09f062a6, no uncommitted changes, GPU 1002:13c0: 17 passed, 0 failed, 0 not runI stopped the 5090 half when it merged, so there is no NVIDIA check of this head from me. This doesn't answer the question above: the mesh program in that Lanes case doesn't read the heap, and nothing in the check does from a mesh stage. Our integration build on main translates the mesh, amplification and pixel stages on the mapped root and carries the map only when all translate; I can put that up as a PR if you'd take it.
Imported from brcly/TuxBox. Originally posted by s3rius on 2026-12-01T20:49:38Z.
@NickStallman, @JeffreyBytes yeah, you're both right.
Sorry, wasn't available today, so I didn't see your comment. However, I see that @NickStallman has filled the gap in #617 and resolved the issue. Thanks!