kbm: calculate mouse velocity over real dt to prevent camera whip (#963) #1066
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!1066
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1066"
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?
@mahfuzinam0045-spec on GitHub · 2026-11-24 11:09 UTC · original
mahfuzinam0045-spec:fix/kbm-camera-whip-dt→main· +19 −1 · 1 files · 1 commits · openWhen a title paused polling the gamepad for over 100 ms (such as during loading screens, level transitions, or hitching), mouse counts continued gathering in
DXandDY. InVelocity::update,dtwas clamped to0.1before dividing (dx as f32 / dt), which artificially multiplied the apparent mouse rate by up to 20x. This caused the stick deflection to peg at 100% and violently whip the camera around upon returning to gameplay.Fixes #963.
What is in it
crates/xcl/src/hle/kbm.rs: compute the mouse velocity rate over the realdt(withdt.max(0.001)to avoid division by zero). The smoothing factor(1 - exp(-dt / SMOOTHING))naturally bounds the exponential decay in[0, 1).crates/xcl/src/hle/kbm.rs: addframe_hitch_does_not_artificially_accelerate_velocityunit test covering 300 ms and 2 s hitch scenarios, asserting that stick deflection remains moderate.Tested
Velocity::updateandstick_from_mouseunder 300 ms and 2 s pauses; confirms deflection stays proportional (< 0.5) instead of pegging at 1.0.Regression run
test-onlylabel or community smoke run.Not tested
AI use
github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@futurepro62 on GitHub · 2026-11-24 14:25 UTC · original
Full-suite run, since this PR has no test report yet. Tested exact head
53cd523(on its base67a3735).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 736 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.frame_hitch_does_not_artificially_accelerate_velocity.Not tested
AI use
@throny on GitHub · 2026-11-25 00:51 UTC · original
Two contributors checked independently and found that #1059 #1522 solves the same problem (for #963) in a different way: #1607, group D66. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
@JJAutoCompare on GitHub · 2026-11-25 01:39 UTC · original
PR #1066 empirical test report
The KBM velocity calculation now uses the elapsed frame time for hitches longer than 100 ms. The added regression test checks 300 ms and two-second hitches. Fixes #963.
What is in it
crates/xcl/src/hle/kbm.rsupdates mouse velocity and addsframe_hitch_does_not_artificially_accelerate_velocity.Tested
53cd523c3ac1fec39b8aa209b284251987668ffefetched withgit fetch origin main refs/pull/1066/headand checked out detached from the PR entry inFETCH_HEAD. Fetchedorigin/mainwas2bdf0477f84377d1b08e29424100c9bace4e530f.git merge-tree --write-tree origin/main HEADexited 0 and produced tree1076aace942dfd209083dd6fbfc1c666ecdf10c3. The same check against the two pinned SHAs produced the same tree.32.0.101.9175, AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation build26200.9974. Adapter wave range 8–32 andDoublePrecisionFloatShaderOps=0. DXC/DXIL1.9.2609.5(DXC revision01b62ad4) from%LOCALAPPDATA%\XclTooling\dxc-1.9.2609\bin\x64.rustc -Vreturnedrustc 1.100.0 (0ef1bc386 2026-11-09).CARGO_INCREMENTAL=0,CARGO_PROFILE_DEV_DEBUG=0,CARGO_PROFILE_TEST_DEBUG=0, andXCL_ADAPTER=A770.cargo test --workspace --no-runcompiled successfully outside the GPU lock.cargo test -p xcl --lib hle::kbm::tests:: -- --show-outputran outside the GPU lock. 7 passed, 0 failed, 0 ignored, including the new frame-hitch test.& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output }ran once under the shared GPU lock. Cargo exited 101. Across 18 test binaries and one doctest target, libtest reported 720 passed, 16 failed, 41 ignored. Five of the 720 reported passes emittedSKIPPEDand are excluded from coverage. The other 715 reported passes had noSKIPPEDmarker, including tests gated on sample-data environment variables.cargo test --workspace --no-run.cargo build --workspacesucceeded and produced both artifacts.& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { cargo test -p xcl --test e2e -- test_title_runs_and_game_folder_is_untouched --exact --show-output }reran only that test under the GPU lock. Cargo exited 101 with 0 passed, 1 failed, 0 ignored. The title launched and failed its dynamic depth-bias check. The log also recorded XAudio2 CreateMasteringVoice error 0x80070490.GPU skips (5)
Not tested
scripts/smoke.ps1regression run on main and the PR head.XCL_SAMPLE_*variables, D3D12 debug-layer coverage, and tiled tier 2 coverage.AI use
Verbatim failure output from the full suite and focused retry
Full logs are in
L:\XclTooling\neon-slot-2\tmp\pr1066-suite.logandL:\XclTooling\neon-slot-2\tmp\pr1066-e2e.log.@Toons29 on GitHub · 2026-11-25 03:10 UTC · original
Regression run of
53cd523con the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon4178e888, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 100 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; I checked the blocks before posting.@DavidM1911 on GitHub · 2026-11-25 08:51 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
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.