Skip to content

D3D12.X: XCL_MESH_EI_YZ1 runs mesh indirect records with Y or Z of 0 - #3623

Draft
KDenKC wants to merge 1 commit into
xcl-dev:mainfrom
KDenKC:pr/mesh-ei-yz1
Draft

KDenKC wants to merge 1 commit into
xcl-dev:mainfrom
KDenKC:pr/mesh-ei-yz1

Conversation

@KDenKC

@KDenKC KDenKC commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Part of #3011. D3D12 runs nothing for an indirect mesh record with a 0 in any dimension, and the two-pass argument rewrite (SCALE_ARGS_HLSL) gives such a command no groups in either pass. A hypothesis under test, not confirmed here: the console runs a record (X, 0, 0) as X groups. The evidence is another implementation's report that the title's terrain tessellation writes such records and that its missing ground draws when they run as X groups; no packet description in this tree says how the console reads them, and our own runs have not yet counted such records. So this is a switch, off by default, to test it in the world:

  • XCL_MESH_EI_YZ1=1: a record with Y or Z = 0 runs its X groups with Y = Z = 1, in both passes; other records are unchanged.
  • XCL_MESH_EI_YZ1=2: every record runs its X groups with Y = Z = 1 (the stronger form of the hypothesis: X alone is read).
  • An X of 0 runs nothing in both modes.

Off, the argument shader's source is byte for byte as before, so its compiled form and cache key do not change. The mode is read once and logged when set.

Overlaps #3056 (the same shader: it stops commands with groups D3D12 forbids) and #3317 (the same pipeline function): no shared lines with either, but each lands on the other's text. On #3327's native mesh path the same argument pass serves the indirect draws, so the switch reaches it there too.

What is in it

  • crates/xcl/src/hle/d3d12x/bind.rs: mesh_ei_yz1() (the mode), scale_args_source(mode) (the shader text for it, used by scale_indirect_pipeline), tests gpu_indirect_two_pass_x_alone_with_yz1 ((7,0,0) and (7,3,0) run 7 groups and 14 mesh groups at split 2, (0,0,0) none, (5,2,1) 10; off, the zero records run nothing) and gpu_indirect_two_pass_x_alone_whatever_y_and_z (mode 2).
  • README.md: the switch.

Tested

  • Head e7c63d85 (differs from 8562c998 only in the doc comment and the commit message), RTX 3090 VM (NVIDIA 621.24, Intel Core i7-10700T, Windows 11 build 26300.9974, Rust 1.99.1, debug), against main 1c8b5514 on the same machine: cargo test --workspace --no-fail-fast -- --test-threads=4: 2903 passed, 5 failed, 51 ignored (main: 2901 passed, 5 failed, 51 ignored; the 2 more are this PR's tests). The same 5 failures on both, main's own on this machine: title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels, the 3 stream_recheck_* tests, e2e test_title_runs_and_game_folder_is_untouched. SKIPPED: 28 (22 no wave64, 2 no heap windows, 4 no debug layer). The run leaves out the 3 uma_driver coherent-window remake tests that kill the lib binary on this driver.
  • RTX 5090 32 GB, driver 621.40, Ryzen 7 9800X3D, Windows 11 Pro build 26200.9974, Rust 1.99.1, debug, head 8562c998 on main 1c8b5514:
  • cargo build --workspace: ok.
  • cargo test -p xcl --lib -- gpu_indirect_two_pass --test-threads=4: 5 passed, 0 failed.
  • cargo test -p xcl --lib -- hle::d3d12x::bind --test-threads=4: 118 passed, 0 failed (SKIPPED: two_pass_binds_set_the_shared_view_heap, no heap windows).
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 2911 passed, 0 failed, 51 ignored. SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 driver cache cannot be disabled).

Regression run

  • To follow: a scripts/smoke.ps1 pair (main and this head) on the RTX 5090, with the switch unset.

Not tested

  • In the world: whether the terrain's ground draws with =1 or =2. A run on the RTX 5090 and one on an RTX 4080 are in progress.
  • AMD and Intel GPUs.

AI use

  • Claude Code (Claude Opus 5.5, Claude Sonnet 5.5), Codex (GPT-6.2-Sol), Antigravity (Gemini 4 Neon, Gemini 4 Hydrogen): an agent swarm wrote, tested, reviewed and described this change.

🤖 Generated with Claude Code

@github-actions github-actions Bot added area:d3d12 D3D12.X runtime, command lists, resources, sparse memory area:docs-ci Documentation, scripts, workflows, repo governance gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) labels Dec 1, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Review (head 8562c99, diff read, not a merge-check; draft, checks red):

  • The doc comment states an unconfirmed reading as fact. The comment on mesh_ei_yz1 (bind.rs ~3160) says "the console reads such a record as X groups", while the description and the commit body say this is not confirmed and the switch exists to find out. It should say it is a hypothesis under test.
  • Regression run missing. Regression run says "To follow"; that is why PR description is red.

Fine: opt-in; with it unset scale_args_source(0) returns SCALE_ARGS_HLSL unchanged, so the shader and its cache key stay the same; both the immediate and the deferred mesh ExecuteIndirect paths go through prepare_scaled_args; the feedback raw_n is computed after the substitution; the GPU tests cover modes 0, 1 and 2, X = 0, and that the substituted text is present. #3317 edits the same compile_cached(SCALE_ARGS_HLSL, ...) line, so whichever lands second conflicts.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

D3D12 runs nothing for an indirect mesh record with a 0 in any dimension,
and the two-pass argument rewrite (SCALE_ARGS_HLSL) gives such a command
no groups in either pass. A hypothesis under test, not confirmed here:
the console runs a record (X, 0, 0) as X groups. The evidence is another
implementation's report that the title's terrain tessellation writes such
records and that its missing ground draws when they run as X groups; no
packet description in this tree says how the console reads them, and our
own runs have not yet counted such records. So this is a switch, off by
default, to test it in the world:

- XCL_MESH_EI_YZ1=1: a record with Y or Z = 0 runs its X groups with
  Y = Z = 1, in both passes; other records are unchanged.
- XCL_MESH_EI_YZ1=2: every record runs its X groups with Y = Z = 1 (the
  stronger form of the hypothesis: X alone is read).
- An X of 0 runs nothing in both modes.

Off, the argument shader's source is byte for byte as before, so its
compiled form and cache key do not change. The mode is read once.

Tests: gpu_indirect_two_pass_x_alone_with_yz1 ((7,0,0) and (7,3,0) run 7
groups and 14 mesh groups at split 2, (0,0,0) none, (5,2,1) 10; with
the switch off the zero records run nothing) and
gpu_indirect_two_pass_x_alone_whatever_y_and_z (mode 2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Follow-up review (head e7c63d8, since 8562c99, diff read, not a merge-check; draft, checks red):

  • The doc comment states an unconfirmed reading as fact: fixed. The comment on mesh_ei_yz1 (bind.rs ~3160-3166) now calls it a hypothesis under test and says where the evidence comes from.
  • Regression run missing: still open ("To follow").

New: none; only the comment changed since 8562c998.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

@KDenKC

KDenKC commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

@Foniass Thanks. Head now e7c63d85 (the comment and the commit message only):

  • The doc comment: it now says this is a hypothesis under test: D3D12 runs nothing for a record with a 0 in any dimension, and whether the console runs (X, 0, 0) as X groups is not confirmed here. The evidence is another implementation's report that the title's terrain writes such records and that its missing ground draws when they run as X groups; no packet description in this tree says how the console reads them, and our own runs have not counted such records yet. The commit message and the description say the same.
  • Regression run: still to follow, on the RTX 5090 when it is free, with the switch unset.

AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 4 Hydrogen.

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

Labels

area:d3d12 D3D12.X runtime, command lists, resources, sparse memory area:docs-ci Documentation, scripts, workflows, repo governance gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants