D3D12.X / GameInput: Minecraft no longer crashes at start or loses its controller #3618
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3618"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by ivall on 2026-12-01T21:39:11Z.
Two regressions that stopped Minecraft Preview (1.18.30.64) on current main, one commit each.
default_dsv, since38b05b7b) asTEXTURE2D. The AMD driver faulted inClearDepthStencilView(a read at -1), the device was removed (invalid call) and the title ended ~2 s in with 0xC0000409, with nothing in XCL's log (its own crash handler fail-fasts). The default DSV of a multisampled buffer is nowTEXTURE2DMS/TEXTURE2DMSARRAY, aspc_srvalready does for SRVs. This part overlaps #3280 and #1087 (both conflict with main; #3280 also changes 1D views and UNKNOWN formats).f9e6ac5f) the virtual gamepad makes a GameInput reading only when its state changes, so with nothing pressedGetCurrentReadingkept returning the reading from the title's start. ~13 s in, Minecraft's menu showed "your controller was disconnected" (itsgamepad_disconnectedscreen). Before #565 every current reading was a new one. The pad now also reports its unchanged state once per poll interval (4 ms); a change still makes its reading at once, and the retained history works as before.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 indefault_dsv_tests)GameInput: an idle gamepad keeps reporting, its current reading stays recent–crates/xcl/src/hle/gameinput.rs(ReadingHistory::record, testan_idle_gamepad_keeps_reporting)Tested
cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4atc4be321d: 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).f07e426don this machine (rerun there):gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1and_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.a_multisampled_depth_buffer_gets_a_multisampled_view(view dimension 3 instead of 5),an_idle_gamepad_keeps_reporting.Minecraft.Windows.exe.original), release builds of this diff onf07e426dbefore 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
xcl-smokeblocks in this PR.Not tested
scripts/smoke.ps1regression runs (main and this head).GetCurrentReading).AI use
XCL_PROBEand disassembly of the title to trace the dialog; a build of5c6bbc52to confirm it was a regression), wrote the code, the tests, the commit messages and this description.Imported from ivall/xcl. Originally posted by capy-ai[bot] on 2026-12-01T21:40:42Z.
Code review location:
crates/xcl/src/hle/gameinput.rs; line 599Runtime changes lack required smoke regression evidence
Medium Severity
CONTRIBUTING.md requires runtime changes to include scripts/smoke.ps1 runs on main and the committed PR head, with both generated xcl-smoke blocks under Regression run. This PR changes descriptor creation and gamepad reporting but explicitly reports that those runs were not performed; the described manual game runs do not supply the required frame, memory, and crash comparison. Run the required comparison against this head and attach its generated evidence before merging.
Imported from ivall/xcl. Originally posted by capy-ai[bot] on 2026-12-01T21:40:42Z.
Review: COMMENTED
Capy found 1 potential issue (1 medium).
View 2 other findings in Capy.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T22:02:47Z.
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
mainf07e426d: device removed (0x887a0001) ~6.6 s in, right after the 4x MSAA depth buffer, then an AV innvwgf2umx.dll. Same on5b3c9a4f(Nov 29).f5999e43(Nov 23) runs fine.c4be321d): fixed. 60 s smoke run, 3001 frames, 0 device removals, 0 crashes, 0 ERROR lines.xcl-smoke blocks (same title, 60 s)
Glitches
The world, HUD, inventory, world list and title screen render correctly.
f5999e43(Nov 23, before38b05b7b) draws all of the following correctly on the same machine. With this PR:It looks like the UI drawing from the wrong texture data. Not bisected. Since it started after
f5999e43, it may come from38b05b7btoo, 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.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T00:07:57Z.
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:
9acc0314"D3D12.X: a submit looks at the textures under its written pages, not at all of them (local test)". It came intomainwith the nvidia-dev merge, #3203 (765b2c5b). Its parent8ff4b02eis clean in two runs. Every build tested after it shows the glitches.Method: each build had this PR's DSV fix (
caeff359) on top, plus the GameInput commit where it applied. Each run usedXCL_PREPARE=0 XCL_NETWORK=0and 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.38b05b7bclean,379725ae/44eb541c/5d2ea8f8/bb9a6b4b/5b711248clean;765b2c5b(#3203) and everything after it bad.f0e8fdd5and nvidia-dev tip54225f58bad; on nvidia-dev's first-parent line,8ff4b02eclean (2 runs),9acc0314and later bad.What in
9acc0314does it (all at9acc0314+ DSV fix):XCL_WATCH_GAP_MB=4 XCL_WATCH_HOT_MS=5000(old values)touched_byrecheck_gpu_view_sourcesback to every texturetitle_textures.rsfrom the parent,kernelx.rskeptSTEP16 MiB + 5 ms pauseSTEP16 MiB, pause left at 15 msSo 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 (
7c18bc41), a submit only takes written pages from 2 MiB blocks written in the lasthot_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.9acc0314widened 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,
c4be321d):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 (thesubmit costlog lines), and the game stays at 51–60 fps in menus and the world. SoXCL_WATCH_HOT=0is 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.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:10:28Z.
Code review location:
crates/xcl/src/hle/gameinput.rs; line 599High: REPORT_US (4 ms) equals the poll interval, and the poller sleeps 4 ms between polls, so
record()now makes a new reading on every poll. Every registered reading callback fires ~250 times a second with an unchanged state, and the sequence number advances constantly. Thestate != statetest is effectively dead and the analog threshold argument is ignored. A title that uses RegisterReadingCallback, or watches GetCurrentReading's sequence/timestamp, to detect input activity (an AFK/idle timer, attract-mode timeout, last-used-device prompt switching, UI auto-repeat) sees a new gamepad reading every 4 ms with nobody touching the pad, so idle timeouts never fire. A REPORT_US much larger than the poll interval (e.g. 100 ms-1 s) would keep the current reading fresh for Minecraft while staying close to change-only.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:10:28Z.
Review: COMMENTED
Review of
c4be321d: 4 finding(s) (3 high, 1 medium), most severe first.crates/xcl/src/hle/gameinput.rs:599: REPORT_US (4 ms) equals the poll interval, and the poller sleeps 4 ms between polls, sorecord()now makes a new reading on every poll. (inline)crates/xcl/src/hle/gameinput.rs:600: With a reading every 4 ms, the callback dispatcher delivers every one in order, so a guest callback that takes more than ~4 ms falls permanently behind. (inline)crates/xcl/src/hle/gameinput.rs:601: Idle readings now fill the history to HISTORY_CAPACITY and rotate it every 4 ms, so a reading a title holds expires after 500 ms even when nothing happened, which breaks the "tap after idle" recovery #565 added the history for. (inline)crates/xcl/src/hle/d3d12x/real.rs:3180:default_dsvpicks the view dimension from SampleDesc.Count and DepthOrArraySize only and never checksd.Dimension, so a typeless 1D depth resource gets a TEXTURE2D or TEXTURE2DARRAY DSV, the same class of wrong default view this PR f.... (inline)These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:10:29Z.
Code review location:
crates/xcl/src/hle/gameinput.rs; line 600High: With a reading every 4 ms, the callback dispatcher delivers every one in order, so a guest callback that takes more than ~4 ms falls permanently behind. If a title's reading callback does ~5 ms of work (logging, a game mutex, posting to the main thread), the backlog grows until prune drops readings, and from then on each callback gets a reading ~500 ms stale with overrun=true, so a button press reaches the title about half a second late. Before, only state changes were dispatched and there was no backlog.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:10:29Z.
Code review location:
crates/xcl/src/hle/gameinput.rs; line 601High: Idle readings now fill the history to HISTORY_CAPACITY and rotate it every 4 ms, so a reading a title holds expires after 500 ms even when nothing happened, which breaks the "tap after idle" recovery #565 added the history for. If a title keeps its last processed reading R and later calls GetNextReading(R), with an idle pad R used to stay the newest retained reading indefinitely, so the call returned the press. Now, after more than 500 ms (a loading screen, a pause, a slow frame), R and its successor are pruned, the call returns GAMEINPUT_E_REFERENCE_READING_TOO_OLD, and the title resyncs to the current reading and loses the tap. Refreshing only the reading GetCurrentReading returns (record a fresh one at query time if the newest is old) would fix Minecraft without changing history or callbacks.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:10:29Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 3180Medium:
default_dsvpicks the view dimension from SampleDesc.Count and DepthOrArraySize only and never checksd.Dimension, so a typeless 1D depth resource gets a TEXTURE2D or TEXTURE2DARRAY DSV, the same class of wrong default view this PR fixes for MSAA. A title that makes a TEXTURE1D (or 1D array) depth buffer in R32_TYPELESS or R24G8_TYPELESS and calls CreateDepthStencilView with a null desc gets ViewDimension TEXTURE2D(ARRAY) for a 1D resource, which is invalid and can remove the device like the original Minecraft crash. Mapping to TEXTURE1D/TEXTURE1DARRAY, asresource_dim_to_viewdoes, would fix it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:10:35Z.
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.