GameInput: scripted presses stay down until the title has read them #1765
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1765
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1765"
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?
@wondercrash on GitHub · 2026-11-24 20:23 UTC · original
wondercrash:pr/press-latch→main· +260 −43 · 1 files · 2 commits · openA scripted press (
XCL_PRESS_AT/XCL_PRESS_A_AT) is a fixed 200 ms window of host uptime. A title whose reading thread stalls reads its pad less often than that, and the press falls between two reads: in a retail title's run at 4-22 fps (firstGetCurrentReadingat 16.2 s), the presses at 24, 26, 32 and 120 s were never seen. Now a press stays down until the title has read it: at least 200 ms and two readings, then up for 100 ms and two readings before the next press of the same button, so two presses never merge.Related: #609 (
XCL_PRESS_HOLD=s, a longer fixed hold) fixes the same symptom with a hold the user has to pick. In the run below the reads came up to 12.4 s after a press was due, and the same script has presses 2 s apart (11 and 13 s): a hold long enough for the late ones (≥ 12.4 s) holds the early ones together as one press (#609's test: "presses that overlap are held together"). With the latch neither has to be chosen. If #609 lands first, I will rebase and keepXCL_PRESS_HOLDas the minimum hold. #565 (reading history) and #893 (scripted sticks) touch the same file but not scripted presses; #565 changes the poller thread, so one of the two will need a rebase.What is in it
crates/xcl/src/hle/gameinput.rs, two commits:PressLatch(pure over time and reading):advance(t)moves each press Pending → Down → Up → Done;read(t)is a reading the title is handed and counts it.poll()(whatGetCurrentReadingand the readings hand the title) counts a reading; the 250 Hz poller only peeks (poll_peek), and a state it pushes to the reading callbacks counts as two readings (scripted_delivered), since a callback is not skipped by a slow reader.GameInput: scripted press 5 (A at 32 s) seen at 42.73 s.BUTTON_NAMES) for the parser and the log line.slow_readings_still_see_every_press_and_presses_do_not_merge(reads 500 ms apart),a_press_between_two_distant_readings_is_seen_by_the_next_ones(a 15 s stall),fast_readings_hold_a_press_for_200_ms_and_a_second_press_follows_after_a_gap(1 ms reads). Withread()put back tomain's 200 ms window, the first two fail on the buttons down.e79d734, reported by @thehollowedone): the poller counts a pushed state as delivered only when a reading callback was actually called (dispatch_reading_callbacksreturns whether it called one; the step ispush_to_reading_callbacks). Before, a press pushed after the title unregistered its last callback (or while each one was being unregistered) counted as two readings and was let go unseen. Test:a_press_due_after_the_last_reading_callback_is_unregistered_is_down_in_the_next_reading; with the old step it fails (left: 0, right: 4).Tested
cargo build --workspace && cargo test --workspace -- --test-threads=4:e79d734onmain85e3826): 879 passed, 0 failed, 42 ignored;main85e3826: 875 passed, 0 failed, 42 ignored.gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).XCL_PRESS_AT=11:A,13:A,24:A,26:A,32:A,120:A, on our integration branch (main+ other PRs) with this commit: all six presses logged as seen, at 11.03, 13.03, 24.03, 26.03, 42.73 and 132.37 s (the title did not read its pad between 32 and 42.7 s, nor between 120 and 132.4 s). The run before it, same branch and script without this commit: the title first asked for a reading at 16.2 s, and no A was seen at any scripted time (the log's first A is at 73.7 s).Regression run
.\scripts\smoke.ps1 -Game <retail title> -Seconds 60, no input (both runs stay on the start screen),mainfirst, same machine:Not tested
main+ this PR alone, but on our integration branch. The regression pair sends no input, so it does not reach the latch.8cd2f03(first commit); the second commit was checked by the suite and the regression pair only.AI use
main's window, wrote the second commit and its test, ran the suite and wrote this description. The title runs are ours, on the hardware above.@thehollowedone on GitHub · 2026-11-24 21:28 UTC · original
Tested
On
8cd2f03c, a scripted press disappeared after the title unregistered its last reading callback. My fixture registers one GameInput callback, waits for it to receive the scriptedBat 0.05 s, and unregisters it successfully beforeAis due at 0.80 s. The title then makes its firstGetCurrentReadingat 1.15 s. XCL logsAas seen at 0.80 s, with no callback registered, and the API read at 1.15 s returnsAup.In a local variant, I made the callback dispatch report whether it invoked a callback and counted the poller sample only when it did. The 1.15 s read then returned
Adown and logged its first delivery. The three stock latch tests andunregister_reading_callback_waits_for_in_flight_and_prevents_uafalso passed in that local variant.Windows 11 build 26300, Ryzen 7 9800X3D, Rust 1.99.1 MSVC debug.
cargo test --offline --locked -p xcl --lib scratch_scripted_press_survives_after_last_callback_unregisters -- --nocapture --test-threads=1failed 1/1 on the PR with only the fixture added and passed 1/1 with the local change. Zero skips.Not tested
This is synthetic GameInput API coverage. Retail input and concurrent callback/read delivery were outside the test.
AI-assisted. Codex (GPT-6 family, exact variant unavailable) wrote and ran the fixture and local variant and drafted this report.
@futurepro62 on GitHub · 2026-11-24 21:22 UTC · original · edited 2026-11-24 22:20 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
8cd2f03(on its base85e3826).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip pso_measurement_compiles_an_exact_synthetic_record: 876 passed, 0 failed, 42 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.slow_readings_still_see_every_press_and_presses_do_not_merge,a_press_between_two_distant_readings_is_seen_by_the_next_ones,fast_readings_hold_a_press_for_200_ms_and_a_second_press_follows_after_a_gap.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 878 passed, 0 failed, 42 ignored. SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipon NVIDIA. Both fail on main7f7e768too, not because of this PR: underXCL_REQUIRE_GPU=mesh,runner::skip_testturns their skips into failures.heap_window_out_of_memory_falls_back_to_the_switch_formskips whenXCL_HEAP_WINDOWSis unset (#1651), andshaders::tests::pso_measurement_compiles_an_exact_synthetic_recordskipped because Developer Mode was off. Developer Mode was turned on before the AMD run, and therepso_measurement_compiles_an_exact_synthetic_recordran and passed.Not tested
AI use
@DavidM1911 on GitHub · 2026-11-24 23:14 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
@JJAutoCompare on GitHub · 2026-11-25 03:32 UTC · original
PR #1765 GameInput verification
Tested clean detached head
8cd2f03cef50471556c97398fae289ead61a7980on STOR-WINLAB.Environment
Windows 11 Enterprise Evaluation build 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB with driver 32.0.101.9175. Wave range 8–32,
DoublePrecisionFloatShaderOps=0, and nod3d12SDKLayers.dll. Rust 1.100.0 (0ef1bc386), DXC/DXIL 1.9.2609.5, and unoptimized builds with debug info disabled.Tested
cargo build --workspaceandcargo test --workspace --no-runsucceeded.cargo test -p xcl gameinput -- --nocapturereported 12 passed, 0 failed, 0 ignored, and 0 explicit skips. All three new latch tests passed. They cover presses read 500 ms apart, a press during a 15-second polling stall, and fast polling through the 200 ms hold and 100 ms release gap. The latch requires two down readings before release and two up readings before a repeat of the same button.cargo test --workspace --no-fail-fast -- --test-threads=4ran once under the shared Arc lock and exited 101. Across 20 test summaries, Cargo reported 860 passed, 18 failed, 42 ignored. All 12 GameInput tests passed again. The 860 includes 4 tests that loggedSKIPPEDand returned successfully. Those 4 provide no coverage.Failures and skips
CreateComputePipelineStatewith0x80070057. The other four were result mismatches in FMA, texture sample LOD, packed f16, and pixel-shader wave reduction.RSSetDepthBiasXdynamic depth-bias probe read blue where it expected green.0x887A002D).Not tested
Retail-title input, scripted press delivery through title callbacks, a paired smoke run against main, or other GPU vendors and drivers. The test title skipped audio voices because no audio device was available. The workspace failures have no main baseline from this run.
AI use
T3 Code / Codex (
gpt-6.2-sol,reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity,gemini-4-neon) verified counts againstpr1765-suite.logand published this report.@wondercrash on GitHub · 2026-11-25 05:38 UTC · original · edited 2026-11-25 08:41 UTC
@thehollowedone thanks, that is a real bug, and your reading of it is right.
At
8cd2f03the poller thread (start_poller,gameinput.rs:925-944) callsscripted_delivered()after everydispatch_reading_callbacks(s), whether or not a callback was called. The poller keeps running after the title unregisters its last reading callback (it is started once), and a callback that is being unregistered is skipped too (try_enter,gameinput.rs:913). In both cases a press is counted as two readings that no callback received, so the latch lets it go before the title's nextGetCurrentReading.Pushed
e79d734with the fix you tried:dispatch_reading_callbacksnow returns whether it called a callback, and the poller counts the press as delivered (and logs first presses) only then. The poller's step is nowpush_to_reading_callbacks, so a test can call it directly. The new testa_press_due_after_the_last_reading_callback_is_unregistered_is_down_in_the_next_readingfollows your fixture without wall-clock waits. It registers a callback, sees it take a pushed state, and unregisters it. Then it pushes a press that is due and past its 200 ms hold, and checks that the next counted reading still has it down.Tested
cargo test -p xcl --lib gameinput -- --test-threads=4: 13 passed, 0 failed, 0 ignored. The same run with only the fix taken out (the test kept): 12 passed, 1 failed. The new test fails withleft: 0, right: 4(the reading hasAup).cargo check -p xcl --all-targets: no warnings.Regression run: the smoke pair for
e79d734againstmain85e3826is in the PR description (0 removals, 0 crashes on both sides).Not tested
gameinput.rsis still there; I'll rebase if a maintainer asks.AI use: omp with Claude Opus 5.5 wrote the fix and the test, ran them, and wrote this reply.
@DavidM1911 on GitHub · 2026-11-26 06:17 UTC · original
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.@luckyteagirl on GitHub · 2026-11-26 09:23 UTC · original · reviewed
On
e79d734,push_to_reading_callbackssampless, invokes the title callback, thenscripted_delivered()reacquiresPRESS_LATCHand credits every currently down/up press. It does not tie the acknowledgment to the presses actually present ins. For example, deliver a B-only callback at t=0.5 and block it; a title thread'sGetCurrentReadingat t=1.05 activates a newly due A and reads it once; then let the old B callback return. Its acknowledgment adds two reads to A, although that callback never saw A. At t=1.25, after A's hold interval, the next direct read can see A already up instead of its promised second reading.Could the callback sample carry press identity/phase generation and credit only phases still matching that sample? A gated callback fixture with synthetic time can deliver B, activate/read A while B is blocked, release B, then assert A remains down for the second direct read. This is separate from the fixed zero-callback case. Exact-head source review only; I did not run that interleaving or a title.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.