Skip to content

D3D12.X / GameInput: Minecraft no longer crashes at start or loses its controller - #3618

Open
ivall wants to merge 2 commits into
mainfrom
minecraft/msaa-dsv-idle-pad
Open

ivall wants to merge 2 commits into
mainfrom
minecraft/msaa-dsv-idle-pad

Conversation

@ivall

@ivall ivall commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Two regressions that stopped Minecraft Preview (1.18.30.64) on current main, one commit each.

What is in it

  • D3D12.X: a default DSV of a multisampled depth buffer is a multisampled view – crates/xcl/src/hle/d3d12x/real.rs (default_dsv, tests in default_dsv_tests)
  • GameInput: an idle gamepad keeps reporting, its current reading stays recent – crates/xcl/src/hle/gameinput.rs (ReadingHistory::record, test an_idle_gamepad_keeps_reporting)

Tested

  • AMD Radeon RX 9070 (driver 32.0.32029.2010), AMD Ryzen 7 9700X, Windows 11 Home build 26200, Rust 1.96.0; tests in debug, game runs in release.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4 at c4be321: 2899 passed, 8 failed, 51 ignored; SKIPPED: 2 (two_pass_binds_set_the_shared_view_heap, heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows).
  • The 8 failures fail the same way on main f07e426 on this machine (rerun there): gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 and _3, gpu::recomp::heap_window_tests::gpu_smem_flat_descriptor_windows_and_limits, gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu, gpu::recomp::tests::gpu_f32_compares_with_nan, gpu::recomp::tests::gpu_float_compares_random, gpu::recomp::tests::gpu_ps_readfirstlane_loop_on_a_primitive_edge_ends, gpu_two_pass_cache_e2e::two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs.
  • The new tests fail without their fixes: a_multisampled_depth_buffer_gets_a_multisampled_view (view dimension 3 instead of 5), an_idle_gamepad_keeps_reporting.
  • Minecraft Preview 1.18.30.64 (Minecraft.Windows.exe.original), release builds of this diff on f07e426 before it was committed: main ends ~2 s in with 0xC0000409; with the DSV fix alone it runs at 60 fps but shows the controller-disconnected dialog ~13 s in; with both a 30 s run reaches the main menu with no dialog (frame dumps), 60 fps, 0 ERROR lines, exit 0. A longer run was also checked by hand in the menu.

Regression run

  • Not run: no xcl-smoke blocks in this PR.

Not tested

  • scripts/smoke.ps1 regression runs (main and this head).
  • NVIDIA and Intel GPUs; Fortnite, XDefiant, Unicorn Overlord (only Minecraft was run).
  • Titles with GameInput reading callbacks: while one is registered they now also get a reading about every 4 ms with an unchanged state (Minecraft only calls GetCurrentReading).
  • A physical controller against the GameInput change.

AI use

  • Claude Code with Claude Opus 5.5: found both causes (a small debugger for the silent fail-fast; XCL_PROBE and disassembly of the title to trace the dialog; a build of 5c6bbc5 to confirm it was a regression), wrote the code, the tests, the commit messages and this description.

ivall added 2 commits December 1, 2026 22:32
…ed view

A DSV made without a description of a typeless depth buffer gets XCL's
default view (`default_dsv`, since 38b05b7). It was TEXTURE2D for every
2D buffer, also a 4x MSAA one. Minecraft makes such a view of its 1920x1080
4x MSAA R24G8 depth buffer; the AMD driver (RX 9070) then faulted reading
address -1 in ClearDepthStencilView, the device was removed (invalid call)
and Minecraft's crash handler ended the process ~2 s in with 0xC0000409,
which left no trace in XCL's log.

A multisampled buffer now gets TEXTURE2DMS (TEXTURE2DMSARRAY with slices),
as `pc_srv` already does for its default SRV.
… recent

Since f9e6ac5 the virtual gamepad makes a reading only when its state
changes. With nothing pressed, GetCurrentReading kept handing out the
reading from the title's start, its timestamp seconds old. Minecraft takes
that for a pad that is gone: ~13 s in, its menu showed "your controller was
disconnected" (the gamepad_disconnected screen). Before f9e6ac5 every
current reading was a new one.

The pad now also reports its unchanged state once per poll interval (4 ms),
as a connected device does; a change still makes its reading at once, and
the retained history and its next / previous readings work as before.
@github-actions github-actions Bot added area:d3d12 D3D12.X runtime, command lists, resources, sparse memory area:hle kernelx, XGameRuntime, XAudio2, VFS, PE loader, TLS, EH gpu:amd Code is specific to AMD / RDNA / wave64 GPUs (scope tag; see needs:amd-test) labels Dec 1, 2026

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Capy found 1 potential issue (1 medium).

View 2 other findings in Capy.

Open in Capy

Comment thread crates/xcl/src/hle/gameinput.rs Resolved
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Tested on NVIDIA: the crash is fixed there too, but the menus have texture glitches that the Nov 23 build doesn't have.

Setup: RTX 5070 Ti (driver 32.0.16.2114), Ryzen 7 7800X3D, Windows 11 Pro build 26300, release builds. Same title and version as in the PR description.

Crash

  • main f07e426: device removed (0x887a0001) ~6.6 s in, right after the 4x MSAA depth buffer, then an AV in nvwgf2umx.dll. Same on 5b3c9a4 (Nov 29). f5999e4 (Nov 23) runs fine.
  • This PR (c4be321): fixed. 60 s smoke run, 3001 frames, 0 device removals, 0 crashes, 0 ERROR lines.
xcl-smoke blocks (same title, 60 s)
xcl-smoke v1
commit: f07e426dade72aa7112cf6bfe08ca6f6ff5a9d5c
gpu: NVIDIA GeForce RTX 5070 Ti
title: b4519f03
seconds: 60
exit: 0xc0000005
frames shown: none logged (the run did not reach its end)
presents per 2 s (last 3): 0 0 0
device removals: 1
crashes: 2
peak commit: 1559 MB
xcl-smoke v1
commit: c4be321d7ed25f029754ea753d66c3eff5e2cd31
gpu: NVIDIA GeForce RTX 5070 Ti
title: b4519f03
seconds: 60
exit: 0x0
frames shown: 3001 (PresentX 3001)
presents per 2 s (last 3): 120 120 121
device removals: 0
crashes: 0
peak commit: 3645 MB

Glitches
The world, HUD, inventory, world list and title screen render correctly. f5999e4 (Nov 23, before 38b05b7) draws all of the following correctly on the same machine. With this PR:

  • Settings: most of the category icons in the left column are wrong: a solid black block, black stripes, striped garbage with red and green, or what look like world block textures. The toggle switches in the world settings page are missing.
  • Pause menu: a black bar behind the top of the button column, and a white box behind the top of the world panel on the right, where its grey background should be. Same every time.
  • Save and quit: for a frame or two the title background has streaky blue and white garbage over its left part.
  • Also seen by hand, not captured: parts of a menu background turn pink or green and stay that way until the menu is closed and reopened.

It looks like the UI drawing from the wrong texture data. Not bisected. Since it started after f5999e4, it may come from 38b05b7 too, but that's a guess. Not tested: AMD (do you see it on your 9070?), the controller fix (no pad in these runs), the test suite.

Also on this machine: without XCL_PREPARE=0 (default shader preparation), the screen stayed black while the title ran at 60 fps. Separate issue, not investigated.

Claude Code with Claude Opus 5.5 ran the builds, the smoke runs and the screenshots, and wrote this report; checked by Fonias.

@Foniass

Foniass commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Follow-up on the menu glitches from my earlier comment (wrong icons, black and white boxes, magenta / blue / noise backgrounds). They don't come from this PR. Bisected on the same RTX 5070 Ti machine.

First bad commit: 9acc031 "D3D12.X: a submit looks at the textures under its written pages, not at all of them (local test)". It came into main with the nvidia-dev merge, #3203 (765b2c5). Its parent 8ff4b02 is clean in two runs. Every build tested after it shows the glitches.

Method: each build had this PR's DSV fix (caeff35) on top, plus the GameInput commit where it applied. Each run used XCL_PREPARE=0 XCL_NETWORK=0 and the same route: title → world list → world → pause → Settings. Screenshots were compared with a clean build. The glitches vary from run to run, but every bad build showed some on that route.

What in 9acc031 does it (all at 9acc031 + DSV fix):

variant result
as is bad
XCL_WATCH_GAP_MB=4 XCL_WATCH_HOT_MS=5000 (old values) bad
submit selection back to every texture instead of touched_by bad
that + recheck_gpu_view_sources back to every texture bad
title_textures.rs from the parent, kernelx.rs kept clean
walk back to STEP 16 MiB + 5 ms pause clean (2 runs)
walk STEP 16 MiB, pause left at 15 ms bad

So the new texture index looks fine. What breaks it is the write-watch timing, and mostly the walk's longer pause.

Likely mechanism (inferred from the code and these runs, not traced): with hot looks (7c18bc4), a submit only takes written pages from 2 MiB blocks written in the last hot_for. A write to any other block is only found by the walk thread. When a CPU write lands in a cold block shortly before a submit that consumes it, the submit doesn't see it. If the consumer is a GPU copy into a texture, the texture gets stale bytes, and after the GPU write XCL no longer uploads it from CPU memory, so it stays wrong until the UI redraws it. 9acc031 widened that window: blocks go cold after 1.5 s instead of 5 s, and the walk pauses 15 ms instead of 5 ms between passes.

On current main (this PR's head, c4be321):

  • Putting the walk back to 16 MiB / 5 ms is not enough (still bad); later changes widen the window further.
  • XCL_WATCH_HOT=0 (every look walks all watched memory) is clean in 2 runs out of 2. In this title the look then costs 0.14–0.29 ms a submit (the submit cost log lines), and the game stays at 51–60 fps in menus and the world. So XCL_WATCH_HOT=0 is a workaround for now.

A real fix probably needs a submit not to proceed while CPU writes in cold blocks before it are still unseen, rather than relying on the walk's timing. Turning hot looks off by default would fix this title, but the code's own comment measures 4–7 ms a look on a large retail title, so I haven't proposed it as a patch. Not tested: AMD, other titles, the test suite with any of these changes.

Claude Code with Claude Opus 5.5 did the bisect, the experiments and this write-up; posted at Fonias's request without Fonias checking it first.

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:hle kernelx, XGameRuntime, XAudio2, VFS, PE loader, TLS, EH gpu:amd Code is specific to AMD / RDNA / wave64 GPUs (scope tag; see needs:amd-test)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants