Skip to content

D3D12.X: a console MS in the AS slot is translated as the mesh shader it is - #541

Open
ryosen0 wants to merge 7 commits into
xcl-dev:mainfrom
ryosen0:as-slot-ms
Open

ryosen0 wants to merge 7 commits into
xcl-dev:mainfrom
ryosen0:as-slot-ms

Conversation

@ryosen0

@ryosen0 ryosen0 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

A retail title's minimap pipelines carry their console MS container in the AS subobject with no MS subobject. translated_mesh_stream refused them before (a black screen every run, which was kept as a workaround), and the stand-in path refused them too, for two separate reasons, both fixed here:

  1. fallback_stream built a PS-only stand-in. It decided "mesh" by an MS subobject; these streams have none, so the stand-in had a PS but neither a VS nor an MS and the driver refused it (E_INVALIDARG). go_background returned None and every such pipeline was built in the title's call (NishantParajuli on RTX 5060 Ti, Chrysana on RX 9070 XT: black frames, ~57k pipelines queued; thehollowedone's native fixture: D3D12 message 1022).
  2. The stand-in kept the console's target formats. The title's depth-only mesh pipelines use D16_UNORM_S8_UINT (118); copied as they were, the driver refused the stand-in (E_INVALIDARG, message 685) and those pipelines were also built in the call — the three no stand-in lines Chrysana saw at 52.56 s were this case (NishantParajuli's follow-up, reproduced natively by thehollowedone on ad2118d).

That black screen was the translated mesh shaders failing their ms_6_6 output budget — fixed by the DXC vertex-chunk budget in #304. The slot itself was never the problem. With the budget in place the same shaders translate, the driver accepts the pipelines, and the title keeps rendering.

Stacked on #304; the branch carries its head merge under the change.

What is in it (crates/xcl/src/hle/d3d12x/real.rs)

  • mesh_shader_slots(ms_slot, as_slot) — a console MS container alone in the AS slot becomes the MS to translate and is not an AS any more; a real AS (console or PC), an MS already present, or a PC shader in the AS slot are left as they are. The refusal block is removed. Test a_console_ms_in_the_as_slot_is_the_mesh_shader covers all five cases.
  • The attempt defers a moved MS (dxc::defer under pso_async::lazy), as a console compute pipeline: the title gets a stand-in at once, the worker / first bind translates. Sparse counter log (first 5 + every 1000th). Test a_moved_ms_defers_in_the_attempt_only.
  • fallback_stream: the stand-in of such a stream retypes the AS subobject to MS with the dummy mesh shader and uses the mesh dummy's PS (console_ms_in_as_slot helper). Test the_stand_in_of_a_moved_ms_is_a_mesh_pipeline (fails without the change).
  • fallback_stream: RENDER_TARGET_FORMATS / DEPTH_STENCIL_FORMAT go through device_x::pc_target_format, as the real pipeline's do (118 → 45, 115/86 → 28). Test the_stand_in_of_a_stream_has_the_pcs_target_formats (fails without the change; no DXC or GPU needed).

Tested

  • RTX 3060 Ti 8 GB (wave32), Ryzen 7 9800X3D, driver 32.0.16.1742, Windows 11, release build of 6bd8f64 (rebased onto a1672ef; same changes as 303b346).
  • cargo test --release --workspace --no-fail-fast -- --test-threads=4 on 6bd8f64: 721 passed, 0 failed, 41 ignored (earlier on 303b346, threads=1: 690 passed, 0 failed, 41 ignored) (2 GPU SKIPPED — no wave64 on this adapter). One earlier full run had a single failure in writes_land_after_the_queue (WARP fence timing); it passed isolated and in the clean full rerun — a flake unrelated to this change.
  • 120 s retail run with both fixes (XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_RUN_SECONDS=120, XCL_FRAME_DUMP=240, scripted A presses 16–112): clean exit, steady 60 presents / 2 s, no device removal, 0 no stand-in pipeline lines. First bright capture frame 980 (= main's 980 in the same schedule; the first-fix-only head had 1100). Frames 1700–2660 (t≈57–89 s) are the black world-load window; the title returns to its artwork screen at frame 2900 — no crash, no watchdog stop within 120 s.
  • AMD (wave64/split path): Chrysana verified the first fix on RX 9070 XT (a163648: first lit frame 380, steady 600–720 draws); the second fix is verified natively on NVIDIA (thehollowedone, RTX 3080 Ti) and on this machine by stream-level tests; an AMD re-run of 303b346 is requested in the thread.

Regression run
Main a1672ef (current main at rebase):

xcl-smoke v1
commit: a1672ef21c396d8edc9c4b0e3747f671bd40f528
gpu: NVIDIA GeForce RTX 3060 Ti
title: ScarlettGame
seconds: 90
exit: 0x0
frames shown: 2411 (PresentX 2411)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14489 MB

Head 6bd8f64:

xcl-smoke v1
commit: 6bd8f641040071b8a388c0ec3053c2b1483ddcdf
gpu: NVIDIA GeForce RTX 3060 Ti
title: ScarlettGame
seconds: 90
exit: 0x0
frames shown: 2325 (PresentX 2325)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14720 MB

Both reach the menus at a steady 60 presents / 2 s; the frame-count difference is within run-to-run variance we see between identical builds.

Not tested

AI use
GPT-6.2 Astra (API model selector) in DSH wrote the changes and the tests, ran the builds, tests and runs above, and drafted this description; the human contributor reviewed the diff and the numbers before posting. The two stand-in fixes follow NishantParajuli's diagnoses and proposed diffs, credited in the commit messages and the thread.

@shdann shdann left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This stack still has the mesh-output failure from #304. At emit.rs:4734, an 80-vertex, one-triangle record with 22 float4 output rows computes one group in compact mode. At line 4670, the emitter uses that count to choose the original layout and declares 80 vertices. DXC charges for 96 vertices and rejects the shader because the output exceeds 32,768 bytes. I previously verified this with SDK 10.0.26100 DXC. Please carry the layout choice separately from the dispatch group count before enabling these pipelines. See #304 (review) . Reviewed ce41f94 with OpenAI Codex (GPT-6.2 Sol).

@ghost

ghost commented Nov 24, 2026

Copy link
Copy Markdown

Wave64 hardware run, since Not tested lists it: ce41f94 merged onto main 9ce2070 (clean merge): pass. AMD Radeon RX 9060 XT (RDNA4, native 64-lane waves), driver 32.0.32029.2010; Ryzen 7 5800X3D; Windows 11 Pro 26200; Rust 1.100.0 MSVC; DXC 1.9.2602.17; debug.

  • .\scripts\test.ps1: 686 passed, 0 failed, 41 ignored; no SKIPPED GPU tests, mesh tests included.
  • a_console_ms_in_the_as_slot_is_the_mesh_shader and mesh_split_accounts_vertex_chunks pass.

AI use

  • Claude Code (Claude Opus 5.5) ran the commands and wrote this report from the logs; I checked it before posting.

@futurepro62

Copy link
Copy Markdown

Tested exact head ce41f94 (this PR over #304's 8c7413c) on Blackwell.

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (32-lane waves, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug. D3D12 debug layer installed.

  • .\scripts\test.ps1 (--test-threads=4): 682 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware. The new tests passed: hle::d3d12x::real::mesh_slot_tests::a_console_ms_in_the_as_slot_is_the_mesh_shader and Recompiler: the mesh pass-through budget accounts DXC’s vertex chunks #304's gpu::recomp::tests::mesh_split_accounts_vertex_chunks.

  • XCL_REQUIRE_GPU=mesh cargo test -p xcl --lib -- --test-threads=4, repeated with a 180 s limit per run, alternating this head and main 508a0c7:

    passed (642 / 640 tests, 0 failed) hung
    this PR 3 of 7 4 of 7
    main 508a0c7 4 of 5 1 of 5

    Every hang, on both commits, stops at the same four tests ("has been running for over 60 seconds", process idle): gpu_uma_import_check_at_init, gpu_typed_buffer_loads_and_stores, gpu_valu_16_and_64_bit, gpu_valu_float_and_int. Those are the tests and the real::init() → sparse::init path described in D3D12.X: replacing the sparse state deadlocks when the old state still holds placed buffers #344, so I read it as that deadlock, already on main, not something this PR adds. I did not take a stack dump to confirm it. 7 and 5 runs are too few to say whether the PR changes how often it happens.

  • I did not see the 8 parallel failures from the description (gpu_sparse_vram_descriptors_buffers_and_xmem, gpu_wave64_*, poisoned-lock panics): in runs that finished, nothing failed.

Not tested

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and the repeated runs and wrote this report. I checked it before posting.

@ryosen0

ryosen0 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

On the mesh-output budget: fixed in the new head of #304 (this PR is stacked on it). The emitter now chooses the declaration by the vertex budget alone, independently of the dispatch group count, so a record of 80 vertices / 1 triangle / 22 float4 rows declares the compact verts[3] and compiles instead of verts[80] (accounted as 96, 33792 B > 32768 B, refused). New test mesh_layout_independent_of_group_count pins exactly that asymmetric case.

I'll re-run the retail regression here once #304's new head is in, and report the AS-slot minimap pipelines against the corrected budget — that was the failure mode this PR was refused for, so it deserves a fresh measurement rather than the earlier one.

AI use: GPT-6.2 Astra (API model selector) in DSH; the human contributor reviewed it.

@imnicho

imnicho commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Test report with frame captures, since Not tested lists the visual side: ce41f94 merged onto main 9ce2070 (clean merge), release. On this card the title's frames are black with this PR, from its first screen on; main 9ce2070 alone draws them.

Machine: Intel Core i7-7700K (4 cores / 8 threads), 16 GB RAM, NVIDIA GeForce RTX 5080 16 GB (driver 610.47, 32-lane waves), Windows 10 22H2 (19045), DXC 1.9.2602, rustc 1.100.0. The newer retail title of the README, XCL_NETWORK=0, XCL_FRAME_DUMP=100, one pad press (XCL_PRESS_AT=45:A), one run each.

main 9ce2070, 75 s with this PR, 60 s
frame captures that are not entirely black 11 of 15: every one from frame 420 (~30 s) on 0 of 14 (frames 20 – 1320)
presents in the first 60 s (the log's 2 s activity lines) 1 139 1 402
report.json: translated / failed pipelines 12 / 8 1 012 / 8
"MS … in the AS slot" log lines 39 refused (39 shaders) 1 060 translated as MS (431 shaders)

Not tested: the PR without #304 under it; which of the translated pipelines blackens the frame; a debug-layer run; AMD; the test suite on this head.

AI use: Claude Code with Claude Fable 5.2 ran the builds and runs and wrote this report; every number is from a run on the machine named. No game files or captures are attached.

Update for 24635db (merged onto main f4ce27c, clean merge; same machine and switches, 90 s): still black – all 15 captures (frames 20 – 1420) are the same black frame. 1 499 presents, report.json 614 translated / 8 failed pipelines, and only 5 "translated as MS" lines now (2 shaders, against 1 060 lines at ce41f94), so the deferral is at work but the first screen does not come up within 90 s here. A shader pre-compile was running on the same CPU during this run, so its timing is not comparable with the table above (where main shows its first screen by frame 420); the frames themselves are. I have not tried the stand-in fix proposed above.

@Chrysana

Chrysana commented Nov 24, 2026 •

Copy link
Copy Markdown

Update for 24635db (RX 9070 XT), with @NishantParajuli's stand-in fix tried on AMD: still black at 24635db on this card; with the fix from their comment applied, the title draws again on RDNA4.

Both runs: 24635db (already on main 9ce2070), release, 90 s, XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_FRAME_DUMP=120 XCL_PRESS_A_AT=14,17,21, an empty DXIL cache each (XCL_DXIL_CACHE to a new folder), same saved state.

build captures lit (R+G+B > 30) first lit capture draws per 2 s at the end background_pipelines
24635db 0 of 21 none in 90 s 180 4, 0, 56889
24635db + the fix (applied cleanly, +53 / −1) 17 of 20, 100 % each (the 3 before 16 s are dark, as on main) frame 380 (21.9 s), then every capture 600–720 13, 0, 61227
  • 24635db alone logs no stand-in pipeline (0x80070057) – building this one in the call at 8.77 s, for the AS-slot MS d7c434f73b4b811c (as in NishantParajuli's report).
  • With the fix, those at 8.7 s are gone, but three no stand-in pipeline lines remain at 52.56 s (the line is capped at 3), right before translated as MS for 4b799df70d125a0a, 2e9f2ec40925c4ee and af32492a62fcd9cb. This run pressed A and reached the intro video, which NishantParajuli's no-input runs may not have. Those pipelines were built in the call, but the picture didn't suffer: 60 presents per 2 s around them, and the capture at 55.2 s is lit. main has no no stand-in line in any of my runs.
  • No crash or device removal; no in two passes line with the fix (the menus and the video don't bind one).

Not tested: why those three streams still get no stand-in; the fix's own test on this machine (I ran the title only); a warm-cache run with the fix.

Test report for 3d7604b (this PR over #304's b884f3c, already on main 9ce2070) on AMD RDNA4, with frame captures: on this card the title's frames stay black for the whole run, and the window title showed 57163 pipelines queued. #304 alone does not do this. This matches what imnicho reported on an RTX 5080 for ce41f94, but on AMD and at the new head.

Setup: AMD Radeon RX 9070 XT 16 GB (RDNA4, 64-lane waves), driver 32.0.32015.2008, Ryzen 7 9800X3D, 31 GB RAM, Windows 11 25H2 build 26200.9974, rustc 1.100.0 x86_64-pc-windows-msvc, DXC 1.9.2602.17. Retail title 1.0.2.1, XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_RUN_SECONDS=60 XCL_PRESS_A_AT=14,17,21, release builds, the same saved state for every run.

Tests: cargo test --workspace --no-fail-fast -- --test-threads=4 at 3d7604b: 687 passed, 0 failed, 41 ignored. a_console_ms_in_the_as_slot_is_the_mesh_shader, mesh_layout_independent_of_group_count and mesh_split_accounts_vertex_chunks pass. SKIPPED: the two debug-layer tests (the D3D12 debug layer isn't installed here).

Frames (XCL_FRAME_DUMP=120, share of sampled pixels brighter than R+G+B 30):

build 4–15 s 19–60 s draws per 2 s at the end
main 9ce2070 0 % 100 % from 21 s 1307–1326
#304 b884f3c (on 9ce2070) 0 % 100 % from ~23 s 1242–1261
this PR 3d7604b 0 % 0 % (all 14 captures) 180
  • The window title during the 3d7604b run: compiling shaders: 4 running, 52 done, 57163 pipelines queued. On the other builds it reads 0 running.
  • No in the AS slot – refused line (40 on main). 264 different MS were translated, with 1014 translated as MS lines in 60 s, and two pipeline from the console MS in two passes lines.
  • The title doesn't reach the video's texture reads it reaches on main (no BCPack reads at ~28 s), and peak commit is 12.5–13.2 GB against ~16 GB.
  • ce41f94 merged onto 9ce2070 gave the same: black in every capture, 0 refusals, peak commit 10.6–12.5 GB, 1620–1645 frames.

The smoke check doesn't catch this: the run below shows 60 presents per 2 s, no crash and no device removal while every frame is black.

main 9ce2070:

xcl-smoke v1
commit: 9ce2070eccf436d7bd38601c90407da447df34f3
gpu: AMD Radeon RX 9070 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1536 (PresentX 1536)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16054 MB

PR:

xcl-smoke v1
commit: 3d7604bb167c9c85c0849782eb6917f57b76b6ec
gpu: AMD Radeon RX 9070 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1595 (PresentX 1596)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 12552 MB

Not tested: why the queue grows (whether the same pipelines are queued again and again); the minimap itself (the run never shows a picture); NVIDIA at 3d7604b; runs longer than 60 s.

AI use: Claude Code with Claude Opus 5.5 built the commits, ran the tests and the title runs, measured the frame captures and the logs, and wrote this report. I read the window title off the screen.

@ryosen0

ryosen0 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Reproduced the black frames on NVIDIA with your exact setup — thank you for the frame captures, they caught what the smoke block can't. RTX 3060 Ti 8 GB, Ryzen 7 9800X3D, driver 32.0.16.1742, release, XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_RUN_SECONDS=60 XCL_FRAME_DUMP=120 XCL_PRESS_A_AT=14,17,21, same share-of-bright-pixels measure (R+G+B > 30, every 8th texel):

build black frames first bright frame draws per 2 s at the end
main dd2ae9a frames 20–860 (0 %) frame 980 (~39 s), 99.8 % 780
this PR 3d7604b frames 20–980 (0 %) frame 1100 (~44 s), 99.8 % 780
this PR, XCL_LAZY_PSO=0 all 10 captures (0 %) none within 60 s 189–207

So on this card the PR is not black forever — the picture arrives ~5 s later than main's and then renders at the same rate; on your RX 9070 XT it never arrives within 60 s. The eager-build run shows why the window matters: with every AS-slot MS translated synchronously the title's own thread stalls in DXC (15 presents at t=20 s vs 56–60 on the other builds) and the intro never starts in time.

What I think is happening, from the logs:

  • The title creates tens of thousands of these pipelines during boot; on main each is refused in microseconds, with the PR each goes through translation (cached-only attempt + worker build). The 57163 "pipelines queued" is pso_async's lazy queue — those are stand-ins never bound, normal for this title (main has the same queue for its other pipelines), but the PR adds ~1500 distinct MS containers to it (2930 detection lines in my earlier 120 s run = attempt + build per pipeline).
  • The intro/menu transition is delayed by that work, and the delay scales with how long translation takes on the machine. On AMD wave64 the MS programs take the split path (more work per shader), which would explain 60 s never being enough there.

Two things I've done on the branch:

  1. The translated as MS log line moved from the detection (which runs twice per deferred pipeline) to a sparse counter at the build — the 1014/2930-line spam is gone, first 5 + every 1000th.
  2. Measuring whether the translation can be skipped for pipelines the title never binds (the lazy queue already defers the build; the cached-only attempt still translates on the calling thread — that's the part that stalls the title).

I'd rather not merge this as-is given your captures: the refusal on main is load-bearing for boot time. Next step is to make the AS-slot path cost nothing until first bind, then re-run your 60 s capture protocol on both cards. Will report here.

AI use: GPT-6.2 Astra (API model selector) in DSH ran the captures and wrote this comment; the human contributor reviewed it.

@ryosen0

ryosen0 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Fix pushed: 4b1af01 — the moved MS is now translated when first bound, not in the creation call.

Root cause of the delay your captures caught: the title creates tens of thousands of these pipelines during boot and uses few, and the cached-only attempt translated each one on the title's own thread (translation is the expensive part; the DXIL cache miss was already deferred). On wave64 the split path makes each translation heavier, which is why 60 s was never enough on your card while this RTX 3060 Ti only lost ~5 s.

The attempt now defers a moved MS exactly like a console compute pipeline (dxc::defer under pso_async::lazy): go_background hands the title a stand-in immediately and the worker — or the first bind — runs the translation. The translated as MS log line became a sparse counter at the build (first 5 + every 1000th); the 1014/2930-line spam is gone.

On this machine (RTX 3060 Ti, XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_RUN_SECONDS=60 XCL_FRAME_DUMP=120 XCL_PRESS_A_AT=14,17,21): 7 moved-MS translations in 60 s (was ~1500 attempts), first bright frame 1100 in that run — main's was 980, and a second capture run of the pre-fix build also landed at 1100, so that difference is run-to-run variance, not the fix. A 150 s scripted-input run: 4086 frames, steady 60 presents / 2 s, no crash. Full suite on 4b1af01: 688 passed, 0 failed, 41 ignored (--test-threads=1).

Could you re-run your 60 s capture protocol on 4b1af01? If the frames are still black on the RX 9070 XT I'd want the translated as MS (#n) counter and the window title's queued number from that run — with the deferral the queue should look like main's.

AI use: GPT-6.2 Astra (API model selector) in DSH wrote the fix and the test, ran the captures and wrote this comment; the human contributor reviewed the diff and the numbers.

@ryosen0

ryosen0 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Test report for 4b1af01 (this PR over #304's b884f3c) on NVIDIA, following the deferral fix for the black-frame delay Chrysana measured on RDNA4.

Setup: RTX 3060 Ti 8 GB (wave32), Ryzen 7 9800X3D, 32 GB RAM, driver 32.0.16.1742, Windows 11, rustc stable x86_64-pc-windows-msvc, release builds, retail title 1.0.2.1.

Tests: cargo test --workspace --no-fail-fast -- --test-threads=1 at 4b1af01: 688 passed, 0 failed, 41 ignored; SKIPPED: the two wave64 GPU tests (no wave64 on this adapter). a_moved_ms_defers_in_the_attempt_only, a_console_ms_in_the_as_slot_is_the_mesh_shader, mesh_layout_independent_of_group_count pass. One earlier full run had a single failure in writes_land_after_the_queue (WARP fence timing, asserts [7, 9] == [7, 9] — a visibility race in the test itself); it passed 3/3 isolated and in the clean full rerun counted above.

Frame captures (XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_RUN_SECONDS=60 XCL_FRAME_DUMP=120 XCL_PRESS_A_AT=14,17,21, share of sampled pixels brighter than R+G+B 30, every 8th texel):

build first bright frame moved-MS translations in 60 s
main dd2ae9a 980 (99.8 %) 0 (refused)
3d7604b (pre-fix) 1100 ~1500 attempts (2930 log lines / 120 s)
4b1af01 1100 7

The ~5 s first-frame difference vs main is within run-to-run variance on this card (a second pre-fix capture run also landed at 1100); the point of the fix is the calling-thread cost, which is what scales on wave64. A 150 s scripted-input run on 4b1af01 (XCL_PRESS_AT A presses through the menus): 4086 frames, steady 60 presents / 2 s to the end, no crash, no device removal.

Not tested: wave64 hardware (Chrysana's re-run of the 60 s capture protocol on 4b1af01 is the one that matters); the minimap's visual content (unattended runs, no screenshot comparison); runs longer than 150 s.

AI use: GPT-6.2 Astra (API model selector) in DSH built the commits, ran the tests and the title runs, measured the frame captures and the logs, and wrote this report; the human contributor reviewed the numbers before posting.

@NishantParajuli

Copy link
Copy Markdown

Test report for head 4b1af01 with frame captures on an RTX 5060 Ti, and the reason the deferral in 4b1af01 does not take effect yet: the stand-in of these streams is refused by the driver, so every one is still built in the title's call. A small fix for that is below; with it the first screen comes up as on main.

What happens at 4b1af01

  • The attempt defers a moved MS and go_background asks standin_stream for a stand-in. fallback_stream decides "mesh" by the presence of an MS subobject. These streams have none (the MS sits in the AS subobject), so it empties the AS (24 => put(&[])) and keeps the plain dummy PS. The stream then holds a PS and neither an MS nor a VS.
  • The driver refuses it: D3D12.X: no stand-in pipeline (0x80070057) – building this one in the call (first at 6.69 s; the line is capped at 3). go_background returns None and dev_create_pipeline_state calls translated_mesh_stream again outside the attempt, on the title's thread.

Fix (on top of 4b1af01): in the stand-in of such a stream the AS subobject becomes an MS with the dummy mesh shader, and the PS is the mesh dummy's. A real AS beside an MS is emptied as before. The test fails without the change (left: [(24, 0, 0), (2, …)]).

diff (crates/xcl/src/hle/d3d12x/real.rs, +53 / -1 with the test)
diff --git a/crates/xcl/src/hle/d3d12x/real.rs b/crates/xcl/src/hle/d3d12x/real.rs
index cfc5d4d..369f3c3 100644
--- a/crates/xcl/src/hle/d3d12x/real.rs
+++ b/crates/xcl/src/hle/d3d12x/real.rs
@@ -4244,6 +4244,42 @@ mod mesh_slot_tests {
         assert!(missed, "the attempt is missed: the caller takes the background path");
         assert!(!crate::gpu::recomp::dxc::defer(), "outside: the build translates");
     }
+
+    /// The stand-in of such a stream is a mesh pipeline: the AS subobject becomes an MS with the
+    /// dummy mesh shader and the PS is the mesh dummy's. (As an AS without a shader the stream
+    /// had a PS alone, which the driver refuses.) A real AS beside an MS stays an AS, emptied.
+    #[test]
+    fn the_stand_in_of_a_console_ms_in_the_as_slot_is_a_mesh_pipeline() {
+        use super::{dummy_mesh, fallback_stream, stream_subobjects};
+        if crate::gpu::recomp::dxc::location().is_err() {
+            crate::gpu::recomp::runner::skip_test("no DXC");
+            return;
+        }
+        let ms = sample(13, &[fssm(&CODE, &[(8, 13)])]);
+        let as_ = sample(14, &[fssm(&CODE, &[(8, 14)])]);
+        let ps = [1u8; 32];
+        let stream = |subs: &[(u32, &[u8])]| -> Vec<u8> {
+            let mut v = Vec::new();
+            for (ty, b) in subs {
+                v.extend_from_slice(&ty.to_le_bytes());
+                v.extend_from_slice(&[0; 4]);
+                v.extend_from_slice(&(b.as_ptr() as u64).to_le_bytes());
+                v.extend_from_slice(&(b.len() as u64).to_le_bytes());
+            }
+            v
+        };
+        // (type, shader pointer, length) of each subobject of the stand-in's stream
+        let stand_in = |s: &[u8]| -> Vec<(u32, usize, usize)> {
+            let desc: [usize; 2] = [s.len(), s.as_ptr() as usize];
+            let (out, _) = unsafe { fallback_stream(desc.as_ptr() as *const u8) }.expect("a stand-in stream");
+            let word = |p: &[u8], k: usize| u64::from_le_bytes(p[8 * k..8 * k + 8].try_into().unwrap()) as usize;
+            stream_subobjects(&out).unwrap().iter().map(|(ty, p)| (*ty, word(p, 0), word(p, 1))).collect()
+        };
+        let (dms, dps) = dummy_mesh().expect("DXC compiles the stand-in mesh shaders");
+        let (dms, dps) = ((dms.as_ptr() as usize, dms.len()), (dps.as_ptr() as usize, dps.len()));
+        assert_eq!(stand_in(&stream(&[(24, &ms), (2, &ps)])), vec![(25, dms.0, dms.1), (2, dps.0, dps.1)]);
+        assert_eq!(stand_in(&stream(&[(24, &as_), (25, &ms), (2, &ps)])), vec![(24, 0, 0), (25, dms.0, dms.1), (2, dps.0, dps.1)]);
+    }
 }
 
 /// CreatePipelineState with a console MS: Some(hr) when it was a console mesh pipeline
@@ -4403,6 +4439,13 @@ unsafe fn translated_gs_pso(this: *mut c_void, d: &D3D12_GRAPHICS_PIPELINE_STATE
     finish_two_pass(this, &out, tp, rs, "GS", riid, ppv)
 }
 
+/// A console MS container in the stream's AS subobject and no MS subobject (`mesh_shader_slots`).
+unsafe fn console_ms_in_as_slot(subs: &[(u32, &[u8])]) -> bool {
+    let shader = |ty: i32| subs.iter().find(|s| s.0 == ty as u32).and_then(|s| payload_shader(s.1));
+    shader(D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_MS.0).is_none()
+        && shader(D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_AS.0).is_some_and(|a| crate::gpu::recomp::pso::is_console(a) && crate::gpu::xbox::parse(a).is_some_and(|sh| sh.stage == "MS"))
+}
+
 /// Rewrite a pipeline state stream with stand-in shaders. None if not possible.
 unsafe fn fallback_stream(desc: *const u8) -> Option<(Vec<u8>, [usize; 2])> {
     let size = *(desc as *const usize);
@@ -4412,7 +4455,12 @@ unsafe fn fallback_stream(desc: *const u8) -> Option<(Vec<u8>, [usize; 2])> {
     }
     let mut buf = std::slice::from_raw_parts(base as *const u8, size).to_vec();
     let d = dummy();
-    let mesh = stream_subobjects(&buf).is_some_and(|subs| subs.iter().any(|s| s.0 == D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_MS.0 as u32));
+    // A console MS alone in the AS slot is the stream's mesh shader (`mesh_shader_slots`), so its
+    // stand-in is a mesh pipeline too, with the dummy MS in that subobject as an MS. Left an AS
+    // without a shader, the stream had a PS and neither an MS nor a VS: the driver refused it
+    // (E_INVALIDARG) and every such pipeline was built in the title's call.
+    let ms_in_as = stream_subobjects(&buf).is_some_and(|subs| console_ms_in_as_slot(&subs));
+    let mesh = ms_in_as || stream_subobjects(&buf).is_some_and(|subs| subs.iter().any(|s| s.0 == D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_MS.0 as u32));
     let dm = if mesh { Some(dummy_mesh()?) } else { None };
     let mut off = 0usize;
     while off + 8 <= size {
@@ -4431,6 +4479,10 @@ unsafe fn fallback_stream(desc: *const u8) -> Option<(Vec<u8>, [usize; 2])> {
             1 => put(&mut buf, &d.vs),
             2 => put(&mut buf, dm.map_or(&d.ps[..], |m| &m.1[..])),
             6 => put(&mut buf, &d.cs),
+            24 if ms_in_as => {
+                buf[off..off + 4].copy_from_slice(&(D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_MS.0 as u32).to_le_bytes());
+                put(&mut buf, &dm?.0)
+            }
             3 | 4 | 5 | 24 => put(&mut buf, &[]),
             25 => put(&mut buf, &dm?.0),
             12 | 19 => buf[at..at + 16].fill(0), // input layout, cached PSO

Tested

  • NVIDIA GeForce RTX 5060 Ti 16 GB (driver 32.0.16.2114, 32-lane waves), Ryzen 7 7700, 31 GB RAM, Windows 11 Pro 26300, rustc 1.100.0 MSVC, DXC 1.8.2502.11 (SDK 10.0.26100), release.
  • Retail title 1.0.2.1, XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_RUN_SECONDS=90 XCL_FRAME_DUMP=60, no input, the same saved state, an empty DXIL cache for each run (XCL_DXIL_CACHE to a new folder), one run each. "Bright": mean of R, G, B over every 20th texel of the capture above 30.
build captures first bright capture draws per 2 s at the end background_pipelines (built, failed, pending) "no stand-in" lines
main 91f9a5e 42 frame 140 (10.7 s) 780 6, 0, 57 817 0
91f9a5e + this PR 4b1af01 43 none in 90 s (frames 20 – 2540 all black) 180 4, 0, 57 161 (658 translated in the call) 3 (capped)
the same + the fix 42 frame 200 (12.7 s) 780 6, 0, 60 747 0
  • So with the fix the title's first screen is one capture (2 s) later than main's and it then draws at main's rate; the 2 930 more pending entries are the stand-ins of AS-slot pipelines the title made and did not bind.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 91f9a5e + 4b1af01 + the fix: 697 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware. mesh_slot_tests: 3 passed (yours two and the_stand_in_of_a_console_ms_in_the_as_slot_is_a_mesh_pipeline).
  • Earlier, on ce41f94 + the same fix (main 9ce2070): empty cache, first screen at about 20 s (16 s on that main). ce41f94 alone showed nothing in an 80 s run with an empty cache nor in the 200 s run after it, and its first screen at 80 s in a third run, with the cache those had filled.

Not tested

AI use
Claude Code (Claude Fable 5.2) found the cause, wrote the change and its test, ran the builds, the tests and the runs above and wrote this comment from the logs; the human contributor reviewed it before posting.

@thehollowedone

thehollowedone commented Nov 24, 2026 •

Copy link
Copy Markdown

Native stand-in check on the rebased head

On 24635db, I reproduced the earlier stand-in rejection with a synthetic stream on the RTX 3080 Ti. The fixture called XCL’s stock standin_stream and the native D3D12 driver. With the console MS container in the AS slot and no MS subobject, the call returned E_INVALIDARG. D3D12 message 1022 reported that the submitted stream specified no VS, CS, or MS. Moving the same synthetic container to the MS slot let the stock stand-in path create the pipeline successfully. The device remained healthy.

The scratch test passed 1/1 with both outcomes asserted. Windows 11 build 26300, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, debug with Graphics Tools enabled. cargo test --offline --locked -p xcl --lib scratch_native_moved_mesh_stand_in -- --nocapture --test-threads=1. This checks stand-in creation only. First-bind output, retail captures, and native wave64 remain untested.

Codex with GPT-6.2 Sol wrote the scratch fixture, ran the test, and drafted this update.

Earlier integrated workspace result

Tested

I ran the same serial workspace check on main at f4ce27c and that revision with 4b1af01 integrated cleanly. This baseline includes the recent texture-read, sparse-memory, and write-watch merges.

  • Main: 701 passed, 0 failed, 41 ignored.
  • Integrated tree: 705 passed, 0 failed, 41 ignored. The moved-MS slot and deferral tests passed. The existing synthetic two-pass mesh GPU test passed on both trees.

Both totals include two tests that returned early for lack of native wave64: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware.

cargo build --offline --locked --workspace, then cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=1. RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC, debug.

Not tested

Retail frame captures, game-specific moved mesh pipelines, or native wave64.

AI use

Codex with GPT-6.2 Sol ran the tests and drafted this report.

@mastrr9

mastrr9 commented Nov 24, 2026

Copy link
Copy Markdown

Code audit + NVIDIA RTX 5080 test run on 24635db4d250ea30631d892c0a94ba35edd9bb65:

Review

Looks clean:

  • Switching mesh_passthrough_for from split == 1 to mv <= cap (emit.rs:4673) fixes the DXC output-budget refusal for low-triangle records whose vertex count exceeds cap.
  • mesh_shader_slots cleanly promotes a lone console MS in the AS slot while leaving real AS / paired MS+AS / PC shaders untouched, and deferring moved MS builds via pso_async::lazy() && dxc::defer() avoids stalling boot on tens of thousands of unused pipelines.

Tested

  • Hardware / OS / toolchain: NVIDIA GeForce RTX 5080 (driver 617.42), AMD Ryzen 7 9800X3D, Windows 11 25H2 (build 26200.9711), rustc 1.100.0 (MSVC), debug build.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4: 688 passed, 0 failed, 41 ignored.
  • New tests mesh_split_accounts_vertex_chunks, mesh_layout_independent_of_group_count, a_console_ms_in_the_as_slot_is_the_mesh_shader, a_moved_ms_defers_in_the_attempt_only: all passed.
  • SKIPPED GPU/D3D12 tests: gpu_geometry_wave32_prefix_count_over_a_mask / gpu_wave32_program_in_wave64_hardware (no wave64), plus 2 D3D12 debug-layer tests (no d3d12SDKLayers.dll).

Not tested

  • Retail title / scripts/smoke.ps1 run (test suite only).
  • AMD / Intel GPUs.

AI use: code review and test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above.

abilliontokens added a commit to abilliontokens/xcl that referenced this pull request Nov 24, 2026
…d in the call

With ivall#541, a stream with a console MS in the AS slot and no MS subobject is
translated as a mesh pipeline. Its stand-in (fallback_stream) still decided
"mesh" from an MS subobject only, so it nulled the AS and kept a plain PS:
no VS and no MS, which the driver refuses (E_INVALIDARG). go_background then
fell back to building each of those pipelines in the title's call.

Measured on a retail title (RTX 5060 Ti, cold DXIL cache, 240 s, same input):
five title threads sat in dev_create_pipeline_state -> translated_mesh_stream
-> dxc::compile at every thread dump, and 2947 programs were compiled. With
the stand-in turned into an MS subobject with the stand-in MS, no title thread
is in DXC at any dump, 804 programs are compiled (the rest wait for their
first bind, as other pipelines do) and translation errors stay at 0.

Assisted-by: Claude Code (Claude Opus 5.5)
@NishantParajuli

Copy link
Copy Markdown

Follow-up to my report above, for @Chrysana's open point ("why those three streams still get no stand-in"): their stand-in keeps a console-only depth format. A second small fix is below; with both, the stand-in refusals of a run into world loading go from over 500 to 4.

What those streams are
I logged the subobjects of every stand-in stream the driver refused (a local diagnostic, not in the diff). With the first fix applied, all of them looked like this:

stand-in stream refused (0x80070057): 0 25 2 3 4 5 8 9 10 21 17 12 14  15[0 0 0 0 0 0 0 0 | 0]  16[76]
  • 15 (RENDER_TARGET_FORMATS): no render target. 16 (DEPTH_STENCIL_FORMAT): 0x76 = 118, the console's D16_UNORM_S8_UINT. They are the title's depth-only mesh pipelines.
  • translated_mesh_stream gives the real pipeline the PC's formats (pc_target_format: 118 → D24_UNORM_S8_UINT). fallback_stream copied the title's as they were, so the driver refused the stand-in, go_background returned None and the pipeline was built in the title's call – the lines you saw at 52.56 s. In an earlier run of mine the same three MS (4b799df70d125a0a, 2e9f2ec40925c4ee, af32492a62fcd9cb) stood next to them.
  • The title makes hundreds of these as its world loads, not three: the no stand-in pipeline line is capped at 3.

Fix (on top of the first one): the stand-in's RENDER_TARGET_FORMATS and DEPTH_STENCIL_FORMAT go through pc_target_format, as the real pipeline's do. The test needs no DXC or GPU.

diff (crates/xcl/src/hle/d3d12x/real.rs, +33 with the test)
diff --git a/crates/xcl/src/hle/d3d12x/real.rs b/crates/xcl/src/hle/d3d12x/real.rs
index 189863d..ed2ef8b 100644
--- a/crates/xcl/src/hle/d3d12x/real.rs
+++ b/crates/xcl/src/hle/d3d12x/real.rs
@@ -4313,6 +4313,29 @@ mod mesh_slot_tests {
         assert_eq!(stand_in(&stream(&[(24, &ms), (2, &ps)])), vec![(25, dms.0, dms.1), (2, dps.0, dps.1)]);
         assert_eq!(stand_in(&stream(&[(24, &as_), (25, &ms), (2, &ps)])), vec![(24, 0, 0), (25, dms.0, dms.1), (2, dps.0, dps.1)]);
     }
+
+    /// The stand-in's target formats are the PC's, as the real pipeline's: the console's
+    /// D16_UNORM_S8_UINT (118) is D24_UNORM_S8_UINT (45) and a B4G4R4A4 target (115) is
+    /// R8G8B8A8 (28). With the console's the driver refuses the stand-in.
+    #[test]
+    fn the_stand_in_of_a_stream_has_the_pcs_target_formats() {
+        use super::{fallback_stream, stream_subobjects};
+        let mut s = Vec::new();
+        // RENDER_TARGET_FORMATS: 8 formats and their number
+        s.extend_from_slice(&15u32.to_le_bytes());
+        for f in [115u32, 28, 0, 0, 0, 0, 0, 0, 2] {
+            s.extend_from_slice(&f.to_le_bytes());
+        }
+        // DEPTH_STENCIL_FORMAT
+        s.extend_from_slice(&16u32.to_le_bytes());
+        s.extend_from_slice(&118u32.to_le_bytes());
+        let desc: [usize; 2] = [s.len(), s.as_ptr() as usize];
+        let (out, _) = unsafe { fallback_stream(desc.as_ptr() as *const u8) }.expect("a stand-in stream");
+        let subs = stream_subobjects(&out).unwrap();
+        let word = |p: &[u8], k: usize| u32::from_le_bytes(p[4 * k..4 * k + 4].try_into().unwrap());
+        assert_eq!((subs[0].0, word(subs[0].1, 0), word(subs[0].1, 1), word(subs[0].1, 8)), (15, 28, 28, 2));
+        assert_eq!((subs[1].0, word(subs[1].1, 0)), (16, 45));
+    }
 }
 
 /// CreatePipelineState with a console MS: Some(hr) when it was a console mesh pipeline
@@ -4518,6 +4541,16 @@ unsafe fn fallback_stream(desc: *const u8) -> Option<(Vec<u8>, [usize; 2])> {
             }
             3 | 4 | 5 | 24 => put(&mut buf, &[]),
             25 => put(&mut buf, &dm?.0),
+            // RENDER_TARGET_FORMATS, DEPTH_STENCIL_FORMAT: the console's formats as the PC's, as
+            // the real pipeline gets them (`translated_mesh_stream`) – with a console-only one
+            // (a retail game's depth-only mesh pipelines: D16_UNORM_S8_UINT) the driver refuses
+            // the stand-in (E_INVALIDARG) and the pipeline is built in the title's call
+            15 | 16 => {
+                for k in 0..if ty == 15 { 8 } else { 1 } {
+                    let f = super::device_x::pc_target_format(u32::from_le_bytes(buf[at + 4 * k..at + 4 * k + 4].try_into().ok()?));
+                    buf[at + 4 * k..at + 4 * k + 4].copy_from_slice(&f.to_le_bytes());
+                }
+            }
             12 | 19 => buf[at..at + 16].fill(0), // input layout, cached PSO
             7 => buf[at..at + 32].fill(0),        // stream output
             _ => {}

Tested

  • The same machine as above (RTX 5060 Ti 16 GB, driver 32.0.16.2114, Ryzen 7 7700, Windows 11 Pro 26300, DXC 1.8.2502.11), release, main f4ce27c + this PR 24635db + both fixes. Retail title 1.0.2.1, XCL_NETWORK=0 XCL_ACTIVITY=1, 110 s, scripted A presses into world loading, the same saved state (first-run setup done). One run each; another process was using the CPU during both, so I give counts only, no timings.
refused stand-in streams background_pipelines (built, failed, pending) translated_pipelines
first fix only over 500 (first at 44 s, #500 at 66 s) 14, 0, 83 480 754 (so about 740 made in the title's call)
both fixes 4 (all at 49 s) 846, 0, 83 392 846 (all in the background)
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 707 passed, 0 failed, 41 ignored; SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware. mesh_slot_tests: 4 passed, with the new the_stand_in_of_a_stream_has_the_pcs_target_formats. (The tree also carried two local-only helpers of mine that are not part of either diff: a scripted stick and an optional limit on a draw's wait.)

The 4 that remain are not a stand-in problem

stand-in stream refused (0x80070057): … 15[43 0 0 0 0 0 0 0 | 1]  16[0]

One render target of format 0x43 = 67, R9G9B9E5_SHAREDEXP, which the PC cannot render to. The real pipeline is refused too, right after, once per run here: the driver rejected the mesh pipeline from the console MS (0x80070057). That needs a PC format for the target itself (resource, views and pipeline), so it is a separate change; I have not looked for other pipelines with that format.

Not tested

AI use
Claude Code (Claude Fable 5.2) found the cause, wrote the change and its test, ran the builds, the tests and the runs and wrote this comment from the logs; the human contributor reviewed it before posting.

@ryosen0

ryosen0 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

@NishantParajuli @Chrysana — the stand-in fix is in as ad2118d, and your diagnosis was exactly right.

fallback_stream decided "mesh" by an MS subobject; these streams have none, so the stand-in was a PS with neither a VS nor an MS and the driver refused it (E_INVALIDARG), go_background fell through and every pipeline was built in the call. The stand-in now retypes the AS subobject to MS with the dummy mesh shader and uses the mesh dummy's PS, as @NishantParajuli's diff proposed — kept minimal in fallback_stream (+17 lines with the helper), with the test the_stand_in_of_a_moved_ms_is_a_mesh_pipeline (fails without the change: the output stream still holds (24, empty AS), (2, plain PS)).

Measured on the RTX 3060 Ti (wave32), release ad2118d:

  • 60 s run, XCL_FRAME_DUMP=120, A presses 14/17/21: 0 no stand-in pipeline lines (the refusals that made 24635db build everything in the call), steady 60 presents / 2 s, no device removal. First bright capture frame 980 — main's number in the same schedule, where 24635db had 1100.
  • Full suite cargo test --workspace --no-fail-fast -- --test-threads=1: 689 passed, 0 failed, 41 ignored (2 SKIPPED, no wave64 here).
  • Smoke blocks (main 9ce2070 + head ad2118d) are in the description.

@thehollowedone your native fixture result (message 1022, no VS/CS/MS) matches what the new test asserts on the stream level; the driver-level outcome on your RTX 3080 Ti would be a good cross-check.

@Chrysana could you re-run the RX 9070 XT captures on ad2118d (same empty-cache 90 s setup as your last report)? That is the wave64/split path where 24635db stayed black — the stand-in should now be accepted there too. The three no stand-in lines you saw at 52.56 s were this same refusal (the log caps at 3), so I expect them gone.

AI use: GPT-6.2 Astra (API model selector) in DSH wrote the change and its test, ran the suite and the runs above, and drafted this comment; the human contributor reviewed the diff and the numbers before posting.

@thehollowedone

Copy link
Copy Markdown

Native RTX 3080 Ti cross-check for the requested retest. I ran the same synthetic stream through XCL’s standin_stream and the D3D12 driver on 24635db and ad2118d.

  • A console mesh shader in the AS slot returned E_INVALIDARG with message 1022 on the parent and created a pipeline with zero D3D12 errors on the new head. An explicit MS-slot control passed on both.

  • On the new head, the synthetic depth-only stream also passed with D24_UNORM_S8_UINT. Changing only its format to console value 118 still returned E_INVALIDARG with message 685. This independently reproduces the depth-format follow-up at stand-in creation. The device remained healthy in all cases.

Windows 11 build 26300, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11, debug with Graphics Tools enabled. cargo test --offline --locked -p xcl --lib scratch_native_moved_mesh_stand_in -- --nocapture --test-threads=1 passed 1/1 on each revision, zero skips. First-bind rendering and retail use were outside this test. AI-assisted. Codex (GPT-6, exact variant unavailable) wrote and ran the fixture and drafted this reply.

@NishantParajuli

Copy link
Copy Markdown

Thanks for folding the first fix into ad2118d. One thing is still open on that head: the stand-in keeps the console depth format 118, so the title's depth-only mesh pipelines are still built in the call. The diff for it is in my follow-up, and thehollowedone reproduced it on ad2118d just above (E_INVALIDARG, message 685). The three lines at 52.56 s were that case, not the first one.

@thehollowedone

Copy link
Copy Markdown

Confirmed the target-format follow-up on 303b346. The same depth-only stream with console format 118 that failed on ad2118d now creates a native D3D12 pipeline on the RTX 3080 Ti. A separate stream with color format 115 also succeeds. All five cases, including the PC-format and explicit-MS controls, returned S_OK with zero D3D12 errors. The device stayed healthy.

Windows 11 build 26300, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11, debug with Graphics Tools. cargo test --offline --locked -p xcl --lib <filter> -- --nocapture --test-threads=1 passed 1/1 each for scratch_native_moved_mesh_stand_in and the_stand_in_of_a_stream_has_the_pcs_target_formats, zero skips. Synthetic pipeline creation only. AI-assisted. Codex (GPT-6, exact variant unavailable) extended and ran the fixture and drafted this reply.

@ryosen0

ryosen0 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

@NishantParajuli the second fix is in as 303b346 — the stand-in's RENDER_TARGET_FORMATS / DEPTH_STENCIL_FORMAT now go through pc_target_format, exactly as your follow-up proposed, with the stream-level test the_stand_in_of_a_stream_has_the_pcs_target_formats (verified it fails without the change: 118 stays 118, 115 stays 115; no DXC/GPU needed).

Measured on the RTX 3060 Ti (wave32), release 303b346:

  • Full suite cargo test --workspace --no-fail-fast -- --test-threads=1: 690 passed, 0 failed, 41 ignored (2 SKIPPED, no wave64).
  • 120 s run with scripted presses into the load window (XCL_FRAME_DUMP=240): 0 no stand-in pipeline lines, steady 60 presents / 2 s, no device removal. The world-load window (t≈57–89 s) is still black in the captures, then the title returns to its artwork screen — no crash within 120 s. First bright frame 980, main's number.
  • Smoke blocks (main 9ce2070 + head 303b346) refreshed in the description; both steady 60/2 s.

@thehollowedone your native pair (message 685 before / S_OK with the mapping) matches the stream-level assertions — if you have a moment, the same fixture on 303b346 end-to-end would close the loop on the driver side.

@Chrysana 303b346 now has both stand-in fixes — an RX 9070 XT re-run of your empty-cache 90 s setup should show the three 52.56 s refusals gone as well; your earlier a163648 captures already confirmed the first fix on the split path.

AI use: GPT-6.2 Astra (API model selector) in DSH wrote the change and its test, ran the suite and the runs above, and drafted this comment; the human contributor reviewed the diff and the numbers before posting.

@Royalflamejlh

Copy link
Copy Markdown
Contributor

Linux (Wine + vkd3d-proton) + NVIDIA test of 6bd8f64 merged onto main 1ec4c98 (no conflicts), 2 runs of 75 s each way: main refused 40 mesh pipelines in both runs, the merge refused none and the driver took every stand-in. None of the moved pipelines was bound in 75 s, so their translation did not run here.

Setup: Fedora 44 (kernel 7.2.9), Wine 11.21 Staging (Wayland driver), vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch, VKD3D_CONFIG=ignore_shared_fence. RTX 4070 12 GB (driver 615.71.09, 32-lane waves), Ryzen 9 9950X3D, 64 GB RAM. Release, cross-compiled to x86_64-pc-windows-gnu (rustc 1.98.0), DXC 1.9.2609.5, XCL_NETWORK=0, warm DXIL cache. Retail title 1.0.2.1, the first-run screens completed once and no story progress, one A press at 44.8 s through XCL_PRESS_AT. The runs alternated main, merge, main, merge.

Tested

  • cargo test --release -p xcl --lib for mesh_slot_tests, mesh_layout and mesh_split under Wine, on the merge: 7 passed, 0 failed.
main 1ec4c98, run 1 / 2 1ec4c98 + 6bd8f64, run 1 / 2
mesh pipeline with its MS … in the AS slot – refused 40 / 40 (16.9 s to 18.0 s) 0 / 0
no stand-in pipeline lines 0 / 0 0 / 0
… in the AS slot – translated as MS lines – 0 / 0
translated pipelines (report.json) 1466 / 1469 1466 / 1471
first frame dump that is not black (one dump per 30 frames) 200 / 200 230 / 200
frames presented in 75 s 1640 / 1666 1739 / 1673
faults, device removals 0 / 0 0 / 0

Read

  • real.rs:4451: in the cached-only attempt a moved MS returns before anything is translated, and the translated as MS line at real.rs:4457 is only reached on the worker or the first bind. That matches the runs: 0 such lines, and the same number of translated pipelines as main. So a run that stays on the title's first screens shows the stand-in path of this change and not its translated mesh shaders.
  • real.rs:4621: the stand-in's target formats now go through pc_target_format for every stream that gets a stand-in, not only for a moved MS. In these runs no stand-in was refused on either tree, so they show no difference from it.
  • emit.rs:4847 and emit.rs:4897 are Recompiler: the mesh pass-through budget accounts DXC’s vertex chunks #304's commits (301adae, d42b820, 2915f22), which this branch carries; Recompiler: the mesh pass-through budget accounts DXC’s vertex chunks #304 is still open. I tested the two together.

Not tested: the title's world, where these pipelines are bound and where the device removals on 8 GB cards were reported; the rest of the test suite; a cold DXIL cache; AMD and Intel. A backup was reading and writing the same disk during all four runs, so the frame counts are not a clean timing.

AI use: Claude Code (Claude Fable 5.2) read the diff, built both trees, ran the title four times with XCL_PRESS_AT, compared the logs and wrote this report.

@crosettiremi

Copy link
Copy Markdown

RX 7900 XT, Windows, Series X saved profile. I repeated the AS-slot comparison on a newer downstream stack that includes direct texture uploads, #1453 and #1464. One run per build, same starting application caches, two DXC workers, 1 ms pipeline wait, 28 GiB whole-job limit, and Player1 selection at 33 s.

Control #541 + #743 + PC render-target/depth format adaptation
Reported AS-slot refusals 40 0
Presents in final report 1,939 2,048
Last two-second sample with a present 194.1 s 186.1 s
DRED GPU fault VA 0x1ae27d000 0x6000

The mesh build logged five distinct console MS hashes entering the AS-slot translation path. Its final report included a mesh pipeline creation error returning DXGI_ERROR_DEVICE_REMOVED, as well as compute and root-signature errors. DRED reported the fault at 191.1 s with no named allocation; the list records printed in this run did not identify a partially completed dispatch. Peak sampled process commit was 27,475 MB. The final captured frame remained dark. This confirms the earlier refusal is removed on this stack. It does not establish which pipeline faulted or demonstrate visible terrain.

marquezinii added a commit to marquezinii/xcl that referenced this pull request Nov 24, 2026
DRED's breadcrumbs give the operations a list got through but not which
pipeline was bound, so a page fault in a translated shader (the mesh
shader faults reported on xcl-dev#541) names no console shader.

With XCL_DRED=1, each SetPipelineState XCL records for the title (and
ClearState, a list's initial pipeline, a mid-list split's next segment)
is followed by a SetMarker, and the pipeline's label (the fnv64 hashes
of its console shaders, as in the translation log) is kept per list in
order. On an RTX 5070 (driver 621.40, Windows 26300) DRED kept no marker
text (breadcrumb contexts empty) and gave the list's debug name but a
null pointer, so the markers are counted in the list's operation history
and each marked list is named "xcl list 0x...". The title's own markers
are counted without a label. DRED's count lagged the GPU there (a fault
in the second dispatch left the first one not done), so the labels bound
after that operation are logged too.

A list may be Reset while an earlier submission of it still runs, so
the last 4 recordings of a list are kept and a DRED node is matched to
the newest one with as many markers as its history. Labels and marks go
with the released pipeline or list.
@ThiagoAlexsander

Copy link
Copy Markdown

Windows + NVIDIA datapoint: most AS-slot refusals go away, and the driver rejects one of the new mesh pipelines.

Setup: Windows 11 Pro 26300, RTX 5080 16 GB (driver 32.0.16.1088, 32-lane waves), Ryzen 7 9800X3D, 62 GB. Rust 1.100.0, release, DXC 1.8.2502 from the SDK. Retail title 1.0.2.1. The build was a local tree of main b7aa9f3 with this PR (6bd8f64), #1273 and #681 merged, plus an unpublished stall-dump switch of mine. It is not this PR alone.

Result: one run of about 60 s, from the first-run screens into loading. The log had:

  • console shaders in the PSO without a translation: mesh pipeline with its MS … in the AS slot – refused: 5 times.
  • console shaders in the PSO without a translation: the driver rejected the mesh pipeline from the console MS (0x80070057): once, at 27.2 s.

Earlier runs on main 930e8b4 without this PR, reaching about the same point, logged the AS-slot refusal about 40 times per run. The bases differ, so treat the drop as indicative rather than a clean A/B.

The E_INVALIDARG is the part that may be NVIDIA-specific. I don't have the debug layer installed here (no Graphics Tools), so I can't name the field the runtime refused. I can rerun with XCL_D3D12_DEBUG=1 if someone wants that output.

Not tested: this PR on its own, AMD, the regression-run pair, and whether the five remaining refusals are a different case.

AI use: Claude Code (Claude Opus 5.5) built and ran this and wrote the report. Posted with my approval.

@ivall

ivall commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Test and review of 6bd8f64, merged on main e9e94ce: the suite passes, but this should not go in before an execution path for two-pass pipelines (#724). Without one, I think the moved pipelines explain the device removals reported here.

Tested: AMD RDNA4 (native wave64), Windows, DXC 1.8.2502.11, debug. Clean merge.

  • cargo test --workspace --no-fail-fast -- --test-threads=4: 898 passed, 0 failed, 42 ignored. SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • XCL_DIRECT_DXIL=all cargo test -p xcl --lib gpu:: -- --test-threads=4: 377 passed, 0 failed, 19 ignored, none SKIPPED.

The problem, from reading the code at that merge. A pipeline made here is a compute pass that writes records into u1, and a mesh pass that reads them. Nothing on main runs the pair:

  • two_pass_of has no caller outside tests, except one diagnostic log line in bind::graphics_bound.
  • DispatchMesh is not hooked on the list.
  • finish_two_pass notes the pipeline's root signature (note_pso_rs), but does not add the pipeline to TRANSLATED_GRAPHICS. So once such a pipeline is built, bind::execute_indirect sees neither a translated graphics nor a translated compute pipeline. It takes the "PC pipeline" branch, sets the title's graphics root signature and calls the PC ExecuteIndirect. The mesh pass was built with XCL's signature, so u1 and the memory windows are not bound.

While the pipeline is still being built the call is skipped, so it depends on when the build finishes. That fits what is reported here:

  • @spiedz's dump: a mesh shader reading GPU VA 0, 2 of 2 runs;
  • @ryosen0's removals on 8 GB, 1 of 6 and then 0 of 8;
  • 60–180 s runs that stay in the menus are clean, because nothing binds these pipelines there (0 translated as MS lines in @Royalflamejlh's runs, 0 two passes lines in @HQasper's).

I have not reproduced a removal myself, so the link to those reports is an inference. The missing execution path is not.

What I suggest: #724 first, with its open review points fixed, then this on top. If you want to keep this one independent, one way is to skip ExecuteIndirect and mesh dispatches while two_pass_of(pso) is set, with a log line, as for a pipeline without a translation. The refusals would be gone and nothing unbound would reach the GPU; the geometry still would not be drawn until #724.

The #304 part does not depend on any of this.

Not tested: a title run, NVIDIA, the debug layer on a bound two-pass pipeline (message 953 would confirm the mismatch).

AI use: Claude Code (Claude Opus 5.5) merged, ran the tests, read the code and wrote this, on the maintainer's behalf.

marquezinii added a commit to marquezinii/xcl that referenced this pull request Nov 24, 2026
DRED's breadcrumbs give the operations a list got through but not which
pipeline was bound, so a page fault in a translated shader (the mesh
shader faults reported on xcl-dev#541) names no console shader.

With XCL_DRED=1, each SetPipelineState XCL records for the title (and
ClearState, a list's initial pipeline, a mid-list split's next segment)
is followed by a SetMarker, and the pipeline's label (the fnv64 hashes
of its console shaders, as in the translation log) is kept per list in
order. On an RTX 5070 (driver 621.40, Windows 26300) DRED kept no marker
text (breadcrumb contexts empty) and gave the list's debug name but a
null pointer, so the markers are counted in the list's operation history
and each marked list is named "xcl list 0x...". The title's own markers
are counted without a label. DRED's count lagged the GPU there (a fault
in the second dispatch left the first one not done), so the labels bound
after that operation are logged too.

A list may be Reset while an earlier submission of it still runs, so
the last 4 recordings of a list are kept and a DRED node is matched to
the newest one with as many markers as its history. Labels and marks go
with the released pipeline or list.
@brandostrong

Copy link
Copy Markdown
Contributor

Test report — 6bd8f64 (head)

RTX 4090 (wave32 host), i9-13900K, 32 GB RAM, Windows 11 26200, cargo 1.100.0, debug.

  • cargo build --workspace + cargo test --workspace -- --test-threads=4: 723 passed, 0 failed, 41 ignored; 2 SKIPPED (adapter limits). The branch base is older than today's main, so the counts are below a current-main run (986 tests) — worth a rebase before merge.
  • I added a stream-level test for the shape this PR fixes — real console containers from a shader pack (XCL_SAMPLE_RPF), mesh typed as AS (24), no MS subobject, driven through CreatePipelineState on the hooked device: 3/3 accepted (the refusal is gone; the test is not in the tree, offered to fold in).

Decode facts (all 40 refused containers, xcl disasm, findings on #1269): every one is a single-stage NGG (API MS) mesh program — 128 threads, one s_sendmsg (GS_ALLOC_REQ), no AS program, no container with two hardware stages — and no "unknown subobject type 23" ever appears in the runtime log. That matches #630's reading (console numbering, MS_VS_*_Wrapped) and says the guard comment's "minimap" label was wrong.

An alternative host shape, measured: routing the same stream shape into the existing two-pass record path (compute pass + synthetic mesh pass + the title's PS) also builds 3/3 through the hook and passes the full suite (987 passed, 0 failed, 45 ignored). If the stand-in path still shows trouble on a title run, that is a second shape with evidence behind it.

Not tested: a title run (no smoke blocks from me), AMD.

AI use: Claude Code, Claude Opus 5.5 — ran the tests and wrote this report; the user reviewed the results.

@IAmTheSween

Copy link
Copy Markdown

Test report on a desktop RTX 5070 (Blackwell), head 6bd8f641040071b8a388c0ec3053c2b1483ddcdf.

Setup

  • GPU: NVIDIA GeForce RTX 5070 (11 943 MiB), driver 32.0.16.2114
  • CPU / RAM: AMD Ryzen 5 5600X (6C/12T), 31.9 GB
  • OS: Windows 11 26H2, build 26300.9974
  • rustc 1.100.0 x86_64-pc-windows-msvc, DXC 1.8.2502.11 (SDK 10.0.26100.0)
  • Built from the PR head as it is — it is CONFLICTING with main, so not rebased. cargo build --release -p xcl.
  • Retail 1.0.2.1, unmodified (exe SHA-256 e95020b2…). Scripted route, identical in both arms: Enter (= pad A) every 4 s from 20 s to 130 s, XCL_NETWORK=0, XCL_ACTIVITY=1, XCL_FRAME_DUMP=2, 300 s a run.

Result: the refusals are gone, and it costs ~70 % of the frame rate on this card

main cbc296ab65 this PR 6bd8f64
console shaders in the PSO without a translation 40 (capped there) 0
no stand-in failures 0 0
frames / 300 s 8 771 2 650 (30 % of main)
presents per 2 s, steady 60 10–14
draws per frame ~13 (780 draws / 60 presents) ~12 (174 draws / 14 presents)
device removals / crashes 0 / 0 0 / 0
peak process commit 15 083 MB 15 598 MB (+3.4 %)
last sampled frame, non-dark samples 517 959 / 518 400 517 959 / 518 400

So on this title the PR does what it says — the 40 mesh pipelines that main refuses are translated and drawn, the run stays alive, and the end frame is the same picture as main's (same dominant texels, same 99.9 % non-dark count). Two things to note for the smoke rule:

  • Frames are 30 % of main's, under the 80 % floor. Draws per frame barely move, so this is per-frame cost, not fewer draws being issued.
  • @badoomtch's three no stand-in (0x80070057) lines on RTX 5080 did not reproduce here: zero stand-in failures in 300 s.

Tested

  • cargo test --workspace -- --test-threads=4: 721 passed, 0 failed, 41 ignored (680 of them in the lib). A first run had 3 failures — title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels (assertion cubemap extra_pages must be reused at same va, title_textures.rs:1902), and title_textures::tests::transitions_apply_when_their_list_is_submitted and vram::tests::d32s8_targets_take_their_own_size_of_video_memory (PoisonError). All three pass alone with --test-threads=1 and the full suite passed on a rerun, so they look like a 4-thread ordering flake rather than this change.
  • SKIPPED on this adapter: 24 no wave64 (Blackwell is wave32-only), const_mask, wave64, and one cannot disable the driver cache (no Developer Mode).

Not tested

  • AMD / RDNA (no RDNA GPU in this machine), wave64, other titles, and laptop parts.
  • Where the frame-rate loss comes from — whether the translated MS cost, the stand-in path, or the lazy build at first bind. Not separated here.

AI use

  • OpenCode with DeepSeek V4.1 Flash Abliterated (deepseek-v4-pro-uncensored); ran the builds, the suite and the two runs, wrote the tables from the logs, wrote this comment.

@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
IvyNotFound added a commit to IvyNotFound/xcl that referenced this pull request Nov 25, 2026
# Conflicts:
#	crates/xcl/src/gpu/recomp/emit.rs
#	crates/xcl/src/hle/d3d12x/real.rs
IvyNotFound added a commit to IvyNotFound/xcl that referenced this pull request Nov 25, 2026
…cl-dev#630's slot handling

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.