Skip to content

D3D12.X: a console MS in the AS slot gets a mesh stand-in - #743

Closed
abilliontokens wants to merge 6 commits into
xcl-dev:mainfrom
abilliontokens:stream-standin-ms-in-as
Closed

abilliontokens wants to merge 6 commits into
xcl-dev:mainfrom
abilliontokens:stream-standin-ms-in-as

Conversation

@abilliontokens

Copy link
Copy Markdown

Stacked on #541 (head 24635db); only the top commit (8273a36) belongs here.

With #541, a pipeline stream with a console MS in the AS slot and no MS subobject is translated as a mesh pipeline. Its stand-in did not follow: fallback_stream still decided "mesh" from an MS subobject only. So it nulled the AS and kept a plain PS, a stream with no VS and no MS that the driver refuses with E_INVALIDARG (no stand-in pipeline (0x80070057), logged only 3 times). go_background then fell back to building each of those pipelines in the title's call. That serialised the title's pipeline-creating threads on DXC.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs:
    • console_ms holds the check mesh_shader_slots already made.
    • fallback_stream uses it: a console MS alone in the AS slot becomes an MS subobject with the stand-in MS (and the stand-in mesh PS).
    • Unit test the_stand_in_of_a_console_ms_in_the_as_slot_has_a_mesh_shader. It fails without the change (left: [(24, 0), (2, …)]: a null AS and the plain PS) and passes with it.

Tested

  • RTX 5060 Ti 16 GB (32-lane waves), driver 621.24; Ryzen 5 7600X; 32 GB RAM; Windows 11 26200; Rust 1.100.0; SDK DXC 1.8.2502.11. Tests in a debug build, title runs in a release build.
  • cargo test --workspace -- --test-threads=4 on 8273a36: 689 passed, 0 failed, 41 ignored. SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64).
  • Retail title 1.0.2.1, cold DXIL cache, 240 s, XCL_NETWORK=0, the same scripted input (XCL_PRESS_AT), XCL_THREAD_DUMP_AT=20,40,70,110,160:
#541 head ce41f94 this change (a68ad44, same diff as fcfe511 before the rebase)
title threads inside dxc::compile (dev_create_pipeline_state → translated_mesh_stream) at the 5 dumps 5 at every dump 0 at every dump
DXC workers busy at the dumps 4–5 of 11 0 of 11
DXIL programs compiled in 240 s 2947 804 (the rest wait for their first bind, as other pipelines do)
translation_errors / failed_pipelines 0 / 0 0 / 0

Regression run
Main f4ce27c:

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

This PR 8273a36:

xcl-smoke v1
commit: 8273a369f37739512d4ee4e05d63325a83590ade
gpu: NVIDIA GeForce RTX 5060 Ti
title: ScarlettGame
seconds: 90
exit: 0x0
frames shown: 2484 (PresentX 2484)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14701 MB

Not tested

AI use
Claude Code (Claude Opus 5.5) traced the stall from thread dumps, wrote the change and the test, ran the tests and runs above on my machine, and drafted this description.

ryosen0 and others added 6 commits November 24, 2026 05:21
A retail title's NGG transform programs (128 vertices / 128 primitives,
21 params + SV_ClipDistance0 = 352 B per vertex) all failed ms_6_6 with
"vertex plus primitive output size is greater than 32768": the split
budget divided 32768 by the stride, but DXC accounts whole chunks of 32
vertices even when fewer are declared - verts[78] at 352 B is accounted
as 96 (33792 B) and refused. Measured with dxc 1.8.2502 on this machine:
every boundary from 9 to 26 float4 rows agrees with the chunk model.

passthrough_split now floors the vertex budget to a multiple of 32
(capped at 256); the wide records go out in 7 groups of 19 triangles
instead of 5 groups of 26 that DXC refuses. Test: the wide record splits
and compiles, a 96-vertex group at 320 B compiles, a narrow record stays
whole; fails without the change (5 != 7).

Assisted-by: DSH (GPT-6.2 Astra)
The emitter picked the whole-record layout from passthrough_split == 1, but
that count is the dispatch's: a record of 80 vertices with 22 float4 rows
does not fit the mesh output budget as a whole (DXC accounts 96 vertices,
33792 B > 32768) while its single triangle's compact copies fit one group,
so the count is 1 and verts[80] was declared and refused. The declaration
now follows the vertex budget independently of the group count; the compact
form covers every record over the budget, including the one-group ones.

mesh_layout_independent_of_group_count covers the asymmetric limits (80
vertices, 1 triangle, 22 rows): compact declaration, count 1, DXC accepts.
Found in review by shdann (PR xcl-dev#304).

Assisted-by: DSH (GPT-6.2 Astra)
Review nits (Parakeet-Wheat): mesh_layout_independent_of_group_count ended with a block that rebuilt the same MsInterface and asserted verts[3] again; it now compiles the whole-record declaration (verts[80], accounted as 96: 33792 B) and asserts DXC refuses it. passthrough_split's doc claimed a comparison of the two forms it does not make; the doc now states what it does. Tests only plus a doc line; no behaviour change.

Assisted-by: DSH (GPT-6.2 Astra)
… it is

A retail title's minimap pipelines carry their console MS container in the AS
subobject with no MS subobject. They were refused: translated, the title had
rendered nothing from then on. That black screen was the translated mesh
shaders failing their ms_6_6 output budget, fixed by the DXC vertex-chunk
budget (xcl-dev#304); the slot itself was never the problem. With the budget in
place the same shaders translate and the title keeps rendering.

mesh_shader_slots moves the container to the MS slot (and it is not an AS any
more); a real AS, an MS already present, or a PC shader are left as they are.
Unit test covers all five cases.

Assisted-by: DSH (GPT-6.2 Astra)
…e call

The title creates tens of thousands of console-MS-in-AS-slot pipelines during boot and uses few. Translating each in the cached-only attempt ran on the title's thread: on RTX 3060 Ti the intro's first bright frame came ~5 s later than main (frame 1100 vs 980 at XCL_FRAME_DUMP=120), and on RX 9070 XT (wave64, the split path) Chrysana's 60 s captures stayed black throughout with 57163 pipelines queued. The attempt now defers a moved MS like a console compute pipeline (dxc::defer under pso_async::lazy): go_background hands the title a stand-in and the worker or the first bind translates. The detection log moved to a sparse counter at the build (first 5 + every 1000th); it used to fire twice per deferred pipeline (2930 lines in 120 s).

Assisted-by: DSH (GPT-6.2 Astra)
…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)
@crosettiremi

Copy link
Copy Markdown

Radeon RX 7900 XT / Windows 11 build 26100 / SDK DXC 1.9.2602.17. I tested #541 + #743 (8273a36) with the stand-in target/depth format fix from the #541 discussion, in a local Series S integration build. Same saved profile, A at 37 s and independent copies of the same starting application caches in both runs.

Result Before mesh changes With mesh changes
Recorded shader translation errors 40, all lone console MS in the AS slot 0
Presents 1,718 1,755
Stand-in draws 622 1,709
Device removals 0 0

Both runs showed the account picker and loading artwork. Both eventually crashed during world loading at different title instructions. These totals cover different run lengths. This confirms the reported AS-slot refusal disappeared on this adapter. Playable world rendering remains unverified, and this comparison includes the linked depth-format change.

The integration workspace reported 737 passed, 0 failed, 41 ignored. Both the shader slot and PC target-format regressions passed. One counted pass skipped at runtime because xgameruntime.dll was unavailable for the debug-layer draw test.

Codex (GPT-6) ran the tests and drafted this report.

@JoaoPauluu

Copy link
Copy Markdown

Test report: #743 under Wine (Linux, NVIDIA): GTA VI's refused mesh pipelines are gone on vkd3d-proton

Mesh shaders under Wine go DXC → DXIL → vkd3d-proton's dxil-spirv → VK_EXT_mesh_shader on NVIDIA's Vulkan driver. On this PR's head (which includes #541), GTA VI's 40 refused mesh pipelines are no longer refused, nothing fails to build, and the title runs a little faster than on main.

Setup

Unit tests (lib test binary under Wine, filter mesh_slot_tests): 3 passed, 0 failed, in 2 of 2 runs, including the_stand_in_of_a_console_ms_in_the_as_slot_has_a_mesh_shader. A first run without XCL_DXC_DIR set printed SKIPPED … no DXC; that was my setup, not the test.

GTA VI 1.0.2.1 (my own dump; 60 s runs with scripts/linux/smoke.sh from #257, XCL_NETWORK=0, alternating base / PR / PR / base, warm DXIL and vkd3d-proton caches from earlier runs)

build frames shown … mesh pipeline with its MS … in the AS slot – refused draws removals / crashes
64b3f35 969, 970 40, 40 12387, 12344 0 / 0
8273a36 1030, 1028 0, 0 12621, 12543 0 / 0
  • Neither build logs no stand-in pipeline (…) or stand-in mesh shaders: …, so here the stand-ins were built (or weren't needed with warm caches; the log doesn't say which).
  • One difference I didn't look into: the main runs log the pipelines of N shader sets an earlier run used are built ahead of their first use and N pipelines built ahead of their first use, and the PR runs don't. So the two builds may not have started with the same prebuilt pipelines. The PR still shows more frames.
xcl-smoke v1
commit: 64b3f35599bb7102f55d640e1a791e7d6dd3b175
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 969 (PresentX 969)
presents per 2 s (last 3): 47 33 0
device removals: 0
crashes: 0
peak commit: 0 MB
xcl-smoke v1
commit: 8273a369f37739512d4ee4e05d63325a83590ade
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1030 (PresentX 1030)
presents per 2 s (last 3): 42 44 60
device removals: 0
crashes: 0
peak commit: 0 MB

(The first pair. peak commit: 0 MB is XCL reading 0 MB committed under Wine, see #257.)

Not tested

AI use: Claude Code (Claude Opus 5.5) built both commits, ran everything above on the machine above and wrote this report. The blocks, counts and log lines are pasted from those runs. The account owner asked for test reports to be posted while they were away and has not reviewed this one.

@mastrr9

mastrr9 commented Nov 24, 2026

Copy link
Copy Markdown

Code audit + NVIDIA RTX 5080 test run on 8273a369f37739512d4ee4e05d63325a83590ade:

Review

Looks clean — rewriting subobject tag 24 (AS) in-place to 25 (MS) with the dummy mesh shader bytecode when ms_in_as is true cleanly resolves the stand-in E_INVALIDARG refusal on console MS-in-AS-slot 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: 689 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, the_stand_in_of_a_console_ms_in_the_as_slot_has_a_mesh_shader: all 5 passed.
  • SKIPPED GPU tests (2, wave32-only adapter): gpu_geometry_wave32_prefix_count_over_a_mask: no wave64, gpu_wave32_program_in_wave64_hardware: no wave64.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants