Skip to content

Recompiler: the mesh pass-through budget accounts DXC’s vertex chunks - #304

Open
ryosen0 wants to merge 1 commit into
ivall:mainfrom
ryosen0:mesh-split-chunks
Open

ryosen0 wants to merge 1 commit into
ivall:mainfrom
ryosen0:mesh-split-chunks

Conversation

@ryosen0

@ryosen0 ryosen0 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

A retail title's NGG transform programs (128 vertices / 128 primitives, 21 params + SV_ClipDistance0 = 352 B per vertex) all fail ms_6_6 with "vertex plus primitive output size is greater than 32768" - 19 programs on our machine (MS_VS_TransformLit/TransformD/TransformSkin*, all the same shape). The pipelines then run without a translated mesh shader.

Root cause: passthrough_split divides the 32768 B budget by the vertex stride, but DXC accounts whole chunks of 32 vertices even when fewer are declared. verts[78] at 352 B is accounted as 96 vertices (33792 B) and refused; the split it computes (5 groups of 26 triangles) is refused for every one of these programs.

Measured the accounting with dxc 1.8.2502 (Windows SDK 10.0.26100) on synthetic mesh shaders: bisected the max vertex count for 1..26 float4 rows - every boundary agrees with floor(min(256, 32768/stride) / 32) * 32 (e.g. 22 rows: 64 verts OK, 65 refused; 21 rows: 96 OK, 97 refused). Primitive indices do not move the boundary at these sizes.

What is in it

  • passthrough_split: the vertex budget is floored to a multiple of 32 (capped at 256). The wide records now go out in 7 groups of 19 triangles, which DXC accepts.
  • test mesh_split_accounts_vertex_chunks: the wide record (the retail shape) splits into 7 groups and compiles; a 20-row record splits into 4 groups of 96 vertices and compiles; a narrow record stays whole. Fails without the change (5 != 7). No GPU needed, only DXC.

Tested

  • Ryzen 7 9800X3D, RTX 3060 Ti 8 GB (driver 32.0.16.1742), 32 GB, Windows 11, rustc 1.100.0-nightly, release
  • cargo test --workspace -- --test-threads=4: 612 passed, 0 failed, 20 ignored (lib, includes the new test); other suites 13+3+1+3+2+7+1+1+2+1+6 passed, 0 failed, 4+12 ignored
  • SKIPPED on this adapter: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64)
  • xcl shaders <title> --precompile --only ms on our copy of the title: 19 ms_6_6 errors before (3864 compiled / 14681 cached in that pass); after, the same pass compiles the 6 distinct failing sources with 0 errors (18558 cached)

Not tested

  • AMD GPUs, wave64 hardware
  • the retail title past the first menu with these pipelines active (the smoke runs reach the menu; the transform programs are gameplay shaders)
  • the driver's runtime behaviour of the split groups on RDNA (the split path itself is covered by gpu_mesh_mode_two_passes on this NVIDIA adapter)

Regression run
main (9ab7d76):

xcl-smoke v1
commit: 9ab7d763197c7f420bff10cd9bf1310f07e2a9aa
gpu: Meta Virtual Monitor
title: ScarlettGame
seconds: 90
exit: 0x0
frames shown: 2203 (PresentX 2203)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14630 MB

this PR's head (8c7413c, no uncommitted changes):

xcl-smoke v1
commit: 8c7413c27f2ba0f926d60ba104318c5c3fa38822
gpu: Meta Virtual Monitor
title: ScarlettGame
seconds: 90
exit: 0x0
frames shown: 2262 (PresentX 2262)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14706 MB

AI use
GPT-6.2 Astra (API model selector), working as the coding agent in this session: bisected the DXC accounting on this machine, wrote the fix, the test and this description, ran the tests and the smoke runs. The human contributor reviewed the diff and the measurements.

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)
@nullmarsh

Copy link
Copy Markdown

Tested 8c7413c merged onto main 0e946cf (clean merge) on AMD RDNA4: pass, and the new test fails without the fix.

Tested

  • AMD Radeon RX 9060 XT (RDNA4), driver 32.0.32029.2010; Ryzen 7 5800X3D; Windows 11 Pro 26200; Rust 1.100.0; DXC 1.9.2602.17 (SDK 10.0.26100); debug build.
  • .\scripts\test.ps1: 652 passed, 0 failed, 40 ignored; no SKIPPED GPU tests on this adapter.
  • XCL_REQUIRE_GPU=wave64,mesh cargo test -p xcl --lib mesh_: 24 passed, 0 failed, including mesh_split_accounts_vertex_chunks, gpu_mesh_mode_two_passes and gpu_mesh_mode_reads_memory_windows.
  • Negative control: only this PR's tests.rs on main 4017f8f (the emit.rs change left out): mesh_split_accounts_vertex_chunks fails at the first split check (left: 5, right: 7), so the test catches the old budget.

Not tested

  • No XCL_SAMPLE_* set and no retail title, so no smoke.ps1 regression run and nothing on a real NGG program; NVIDIA and GPUs without mesh shaders.

AI use

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

@likecrank-dotcom

Copy link
Copy Markdown

Independent native Windows/NVIDIA validation of #304 at 8c7413c27f2ba0f926d60ba104318c5c3fa38822, using DXC 1.9.2602.17 (rather than the 1.8.2502 compiler in the description).

Tested

  • Ryzen 5 3600, RTX 5060 Ti, NVIDIA 621.14 / 32.0.16.2114, 32 GB RAM; Windows 11 Pro 10.0.26300; Rust 1.100.0 stable MSVC, MSVC 19.44, SDK 10.0.26100.0. Debug builds, isolated target directory.
  • cargo build --workspace: exit 0, existing fetch_update deprecation warning only.
  • cargo test --workspace -- --test-threads=4 --nocapture: exit 0; 652 passed, 0 failed, 40 ignored, across 17 result blocks (lib: 612 passed, 0 failed, 20 ignored).
  • mesh_split_accounts_vertex_chunks passed, including all three DXC compilations (wide 352-byte records, the 320-byte case, and the narrow control).
  • Negative control: only the PR's test-file changes copied onto main@0e946cfc68244edee1fba6e0425371f687a05ccd, runtime unchanged; cargo test -p xcl --lib mesh_split_accounts_vertex_chunks -- --nocapture --test-threads=1 exits 101, 1 failed: left: 5, right: 7. The regression catches the old split count on this DXC version too.

SKIPPED / Not tested
Four explicit skips: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no wave64); test_title_draws_with_a_root_signature_under_the_debug_layer (no d3d12SDKLayers.dll); uploads_start_from_each_subresources_state (no D3D12 debug layer, 0x887A002D). No XCL_SAMPLE variables, retail shaders, title/smoke run, AMD/Wine, or gameplay validation. The synthetic mesh paths were tested; the actual title's transform pipelines were not run here.

AI use
Codex prepared the test-only control, executed the commands, and summarized the actual logs. Exact deployed model identifier is not exposed in this session.

@ryosen0

ryosen0 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Data point from a retail run on our machine (RTX 3060 Ti 8 GB, Ryzen 7 9800X3D, driver 32.0.16.1742): main + this PR is not in the stack, but the same title run with #300 + #294 + #273 (+#208) + #283 (+#252) reached the character loading screen, and its report shows failed_pipelines: 41, all of the form:

mesh pipeline with its MS <hash> in the AS slot - refused

These are the intentional refusals in translated_mesh_stream (real.rs, the minimap pipelines comment), not translation failures - noting it here because the hashes differ from the 19 ms_6_6 output-limit failures this PR fixes, i.e. two separate classes. With this PR the output-limit class is gone on our copy (precompile --only ms: 19 errors -> 0); the AS-slot class remains and is untouched by it.

AI use: GPT-6.2 Astra (API model selector) wrote this comment from our run's report.json; the human contributor observed the run.

@requiemsnkrp

Copy link
Copy Markdown

Tested 8c7413c on NVIDIA GeForce RTX 3060 12 GB (driver 32.0.16.1714 / 617.14, 32-lane waves), Ryzen 5 5600X, Windows 11 Pro 25H2 (26200.9974), Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17 (Windows SDK), debug: pass.

Tested

  • cargo test --workspace -j 4 --no-fail-fast -- --test-threads=4 --skip test_title_runs_and_game_folder_is_untouched --skip test_title_draws_with_a_root_signature_under_the_debug_layer: 650 passed, 0 failed, 40 ignored
  • SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware
  • PR's test: gpu::recomp::tests::mesh_split_accounts_vertex_chunks ... ok (the three pass-through shaders compile as ms_6_6 with DXC 1.9.2602.17; the PR measured with 1.8.2502)
  • main 4017f8f on the same machine, same command: 650 passed, 0 failed, 40 ignored, same 2 SKIPPED. The PR's base is 9ab7d76; main has one more test since, so the same count includes this PR's new test.
  • Tested the head itself; it merges cleanly into main 4017f8f (git merge-tree), the merge result was not tested.
  • Not run here: the two e2e tests that run the test title (test_title_runs_and_game_folder_is_untouched, test_title_draws_with_a_root_signature_under_the_debug_layer): they open the XCL game window and this PC was in use (the 2 "filtered out").

Not tested

  • Retail title regression run (no game copy here).
  • Whether the new test fails without the change (not checked here).

AI use: Claude Code with Claude Opus 5.5 (ran the tests and wrote this report).

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.

4 participants