fix(vk): a camera cut starts every temporal history again, with no motion (RX_VK_DLSS_CUT) #2930
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2930
Loading…
Reference in a new issue
No description provided.
Delete branch "pmwork-personal/Longshot:feat/motion-cut-reset"
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?
Summary
At a hard cut in a cutscene (the next shot), the temporal chain kept the last shot's history and gave every user its
motion, as if the camera had moved there. The chain started a new history only after a gap of frames or a camera it
could not reproject (
dlss_math::reprojectionfails only on non-finite or singular matrices). So the first frames ofeach shot could carry a ghost of the last one under DLSS, DLAA, FSR 4, XeSS and FSR 3.1. DLSS 5 keeps a long history
(no jitter), so a missed cut stays longest there. The frames that DLSS Frame Generation and FSR 3.1's frame
interpolation made between the two shots mixed and warped both shots.
This adds one camera-cut test, and every user of the motion now starts again on the same frame:
dlss_math::camera_cut(gpu/vk/dlss_math.h): 75 points across the screen, at 2, 8 and 32 units from the camera(metres in this game), are taken back to the frame before through this frame's reprojection. A point counts as seen
when it was on that screen and at about the same distance (within 1.25 times). If fewer than 15 are seen (a fifth),
it is a cut. The limit comes from the game: a cutscene's or a talk's next shot left 0 to 5 points seen, and the
camera's quick swing behind Link 25 to 36 a frame (Testing). Cuts: a cutscene's next shot, a turn of more than about
65 degrees in one frame, a jump of about 8 m along the view. Not cuts: a walk, a sideways step, the hookshot's pull
(0.6 and 1.2 m a frame), a turn of 45 degrees in one frame, the swing behind Link (an orbit of up to 60 degrees a
frame).
temporal_camera_cut(gpu/vk/vk_temporal.cpp): the test behind the kill switchRX_VK_DLSS_CUT, with a log lineonce a frame (
vk: upscaler: a camera cut at frame N).draw_engine: the engines and DLSS 5 (f.reset), DLSS Frame Generation through NGX (f.reset), and DLSS FrameGeneration through Streamline. Streamline learns a reset only from the motion (
dlssg_inputs:c.reset = !motion_ok), which is why the cut also clears the motion.fg_inputs: the chain's motion for FSR 3.1's frame interpolation when no engine draws.vk_fsr3_inputs.cppprepare), which keep their own reset.The thresholds come from the game's camera (near 0.1, far 1000.5, 45 degrees high, from the log's
the scene's cameraline).
This is the first piece of #1449 (motion vectors for what moves without bones). shitpost wrote the plan, and this PR
follows its order.
Read first:
gpu/vk/dlss_math.hcamera_cut, thentests/temporal_history_test.cpp(the cut cases at the end).See #1449.
Testing
Tested: Windows 11, RTX 5090, driver 621.40. Branch built as a pack over main e6a71a1d's base, 5120x2160, DLAA
before the bloom, Frame generation Fixed by DLSS FG (NGX; this build had no Streamline files), DLSS 5 off (#2807),
the repository's
kokiri-startsave, played by hand for about 5 minutes (walk, run, camera turns, talks, cutscenes).Run A, with the first limit (fewer than half seen): 20
a camera cutlines in two groups. 10 were single frameswith 0 or 5 of 75 points seen: the first frame of play, and the hard cuts of talks and cutscenes. 10 were 25 to 36
seen, mostly in runs of 3 or 4 frames: the camera's quick swing behind Link, which then started every history again
for several frames. The limit is now 15, between the groups (second commit).
Run B, with the limit at 15, the same play for about 3 minutes, the camera swung behind Link several times: 12
a camera cutlines, each a single frame with 0 or 5 of 75 points seen (the first frame of play, talks,cutscenes); none from the swings. No device loss or GPU fault in either run.
Rebased onto main
05fe90f6after the runs; the same two changes, built again over the base (dev.py pack, 0failed). Then onto main
018dd2ef: its three new commits touch none of these files but other rows ofswitches.def;test_temporal_history,test_dlss_mathandtest_switch_tablewere run again there, with thesame results.
Checks:
tests/test_temporal_history.pyfails on main's reset code with the new header (8 failures: the reverseshot and another place, for DLSS, FSR 4, XeSS and FSR 3.1's inputs) and passes here (8519 checks).
tests/test_dlss_math.pypasses, with the cut cases above. The whole suite (tests/run_all.py, Windows, llvm-mingw)on main
05fe90f6: 811 passed, 56 failed, 54 skipped; on this branch: 813 passed, 54 failed, 54 skipped. Every checkthat fails here fails on main too (test_switch_table for
LONGSHOT_LAUNCHER_STARTUP, main's own; the others aslisted below); two failed on main's run only (test_capture_spare_reuse, test_present_probe), none of which reads a
file this changes.
The 54 checks that fail on main
05fe90f6and here (this PC)test_auto_handheld, test_blocks_at_start, test_bug_report, test_builder_channel, test_control_picture,
test_coverage_run, test_crash_record, test_crt_options, test_dev_ab, test_dev_build, test_dev_migrate,
test_dev_update, test_draw_stream_visibility, test_float_add_subgroup, test_framegen_resources,
test_fsr_uniform_ownership, test_game_boundary, test_game_menu_mouse_buttons, test_image_reaper_threads,
test_image_view_retry, test_input_background, test_input_movie, test_keyboard_menu_option, test_keyboard_option,
test_linux_pressure, test_loaded_modules_drop, test_log_batch, test_log_levels, test_longshot_ctl, test_menu_keys,
test_oot_menu_mouse, test_option_ids, test_parity_gates, test_perf_send, test_present_source_crop,
test_profile_symbols, test_program_cache_cleanup, test_program_cache_one_variant, test_readback_timeout_reuse,
test_recording_admission, test_run_all_mingw, test_screensaver, test_switch_table, test_target_retention,
test_tex_desc_memo, test_text_keyboard_policy, test_upscaler_round_trip, test_vcore_video_acquire,
test_video_catchup, test_video_hold_early, test_video_input_limit, test_vram_compact,
test_windows_display_startup, test_windows_on_linux
Still to test:
expecting one
a camera cutline at each hard cut and Streamline's own reset there (this PC's build had noStreamline files) (@Beanstalk)
a camera cutline at each hard cut and none in play (@Beanstalk)Measurements
Verdict:
RX_VK_DLSS_CUTships on. The histories start again at each hard cut and not at the camera's swing behindLink, and the test costs under a microsecond a frame on the CPU, nothing on the GPU.
Setup: Windows 11, RTX 5090, driver 621.40, Ryzen 7 9800X3D; Kokiri Forest with the settings in Testing, about 3 to 5
minutes of play by hand per run, counted from the log's
a camera cutlines (the runs were on the same two changes overmain
e6a71a1d); the test's CPU time outside the game, three runs of 200,000 calls, -O2.018dd2eff492df16Risks
A very fast turn (more than about 65 degrees in one frame) or a camera jump of about 8 m counts as a cut and starts
the history again: one frame with no history, as after a loading screen. A mild cut (a next shot that shares more than
a fifth of the picture) is not caught, and keeps today's behaviour. With DLSS Frame Generation through Streamline,
a reset makes no frame for that present, so the pacing is uneven once at each cut (#2456's own note). Cuts are rare
outside cutscenes.
RX_VK_DLSS_CUT=0turns the test off. Nothing changes for a player after updating (no saves,options or caches).
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.gpu/vk/switches.def.tests/that reads changed source is updated, not weakened. (temporal_history_test.cpp'ssynthetic frame before is now the same perspective camera moved, not the identity, which is no camera.)
docs/dev/reference/upscalers.md, Temporal history).Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.Credit: shitpost (the #1449 plan and its order).
Co-Authored-By: Claude Opus 5.5 [email protected]
🤖 Generated with Claude Code
Tested in game: Windows 11, RTX 5090, driver 621.40, 5120x2160, DLAA before the bloom, Frame generation Fixed by DLSS FG (NGX), DLSS 5 off; Kokiri Forest from the kokiri-start save, played by hand (walk, run, camera turns, the swing behind Link, talks, cutscenes). Run A (first limit, fewer than half seen): 20 'a camera cut' lines, 10 single frames at 0 or 5 of 75 seen (the first frame of play, talks, cutscenes) and 10 at 25 to 36 seen from the camera's swing behind Link. Run B (the limit at 15, this PR): 12 lines, all single frames at 0 or 5 seen, none from the swings. No device loss or GPU fault in either run.
@Beanstalk two runs, each into play for a minute. A start puts a camera cut on the first frames of play, which this PR logs, so each run shows the test working without a cutscene:
vk: upscaler: a camera cut at frame Nlines at the first frames of play, each with 0 to 5 of 75 points seen, and none while the camera only follows Link; in playDLSS Frame Gen (NGX): of the last 600 presents ... made by DLSS-G; no device loss. Report the frame rate againstmain.a camera cutline(s) at the first frames of play and none after, FSR 3.1's frame interpolation making frames in play, and no device loss. Report the frame rate againstmain.If a run can turn the camera (the right stick) or start a talk, also report each
a camera cutline with its "of 75" count: a turn or the camera's swing behind Link must give none, a talk's hard cut one.DLSS FG through Streamline is not asked here: the plan cannot select Streamline's runtime (as on #2926), so it stays a hand test.
Beanstalk test farm · an earlier run: commit
f492df1(the newer results are in a comment below)Commit
f492df1· approved by pmwork-personal (reviewed) · dashboard⚠️ Note: Linux RADV frame interpolation needs a window, which the farm currently supports only on Windows; the DLSS SDK build also cannot serve the AMD target.
⚠️ Note: The aggregate log checks cannot establish exactly when a cut occurred or prove that generated frames reset correctly; the plan does not exercise a camera turn or talk.
⚠️ Note: Streamline, visual artifacts at hard cuts, and the claimed sub-microsecond CPU cost are not measured.
Started.
Estimate: done in about 50 min, from the queue and the testers online now; some jobs can't start yet.
windows+nvidia+window+dlss+gpu-rtx-40xx(GPU "rtx 40xx")What was tested
What will be tested · AI plan (
gpt-6.1-terra)Two runs per build will start from the Kokiri Forest save and spend one minute in play on Windows with an RTX 40-series GPU, DLSS and fixed 2x DLSS frame generation. The plan records frame rate against main and checks the camera-cut and DLSS-G logs. A crash, device loss, missing expected log, more than two cut logs, or a logged cut with more than five points seen fails the PR. The requested Linux RADV frame-generation test is left out because the farm cannot run a Linux window scenario.
kokiri-start(settings dlss=1, vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, frame_generation=2, frame_generation_by=0; switchesHOS_OUTPUT_RES=1280x720,RX_VK_AUTO_TUNE=0; in a hidden window (the present path runs)), then measure play for 60 s (after 0 s warm-up); 2 runs on each side.@review
Recommendation: Approve. The code is ready: only testing is left. The cut heuristic resets the synthetic histories and logged the tested cuts, but the reported run does not show whether it removes the visible artifacts or preserves frame pacing. The affected AMD and Streamline paths also still need game runs. Recommend approval; not approved on the forge.
The change detects large camera discontinuities and resets temporal upscalers and frame generation instead of carrying motion across them. It adds a small per-frame CPU test and intentionally drops generated frames on detected cuts; the visual benefit and in-game pacing cost remain to be verified.
Nits (1): optional.
docs/dev/reference/upscalers.md:195: The reference implies every detected cut is logged, but logging stops after the first 20 except for every hundredth cut. (more on the line) Do: Document the first-20 and every-hundredth logging limit alongside the log message.Testing before merging (3) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_temporal.cpp:1783: The run counts cut decisions but does not show the player-visible fix or its frame-pacing cost. (more on the line) Do: Compare the same hard-cut sequence on the base and this head on Windows with NGX, including captured output and repeated frame-time or present-interval measurements; include ordinary play and a camera swing.gpu/vk/vk_fsr3_inputs.cpp:319: FSR interpolation and its independently maintained camera history have not been exercised in the reported game run. (more on the line) Do: Run a hard-cut sequence and ordinary camera motion on Linux AMD with FSR 3.1 interpolation and FSR 3.1 or FSR 4; compare the base and head output and present intervals.gpu/vk/vk_temporal.cpp:1783: The Streamline reset path has not been tested with its runtime. (more on the line) Do: Run the same hard-cut sequence on Windows with Streamline frame generation, comparing output and present intervals against the base, and check camera swings for unwanted resets.@fixcan do L4.Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven. On an RTX 5090, the author reports 12 cut log lines in one play session and none during the tested camera swings; synthetic tests also pass. Those observations show decisions being made, but do not compare the visible ghosting or generated frames against the base. The reported 0.13–0.23 µs is an isolated CPU measurement, not an in-game frame-time comparison.
Other systems: The decision affects DLSS, DLAA, DLSS 5, FSR 4, XeSS, FSR 3.1, NGX and Streamline frame generation, including the no-upscaler FSR interpolation path. The submitted game run covers Windows, RTX 5090, DLAA and NGX; AMD/Linux, Streamline, Steam Deck and other engine combinations have no reported game results. Saves, audio and input are not changed by the diff.
Switches: RX_VK_DLSS_CUT is added as an on-by-default kill switch, with a switches.def row; 0 restores the previous behavior. Its default is supported by the limited camera observations, but its behavior and pacing have not yet been established across the affected paths.
Reviewed:
f492df16e4against018dd2ef40: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the complete diff and commit messages; inspected the changed math, temporal and FSR input paths, reset consumers, and test fixtures. Skimmed the remaining portions of the large temporal implementation, switch table and upscaler reference. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review).Checked and fine:
Testing: No code or tests were run during this read-only review. The author reports passing targeted tests and a Windows RTX 5090 game run; CI was still running.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -188,0 +192,4 @@about 65 degrees or a jump of about 8 metres along the view is. That frame has no motion either, so every user ofthe motion starts again together: the engines and DLSS 5 (`f.reset`), DLSS Frame Generation through NGX (`f.reset`)and through Streamline (the motion), and FSR 3.1's frame interpolation, whose own inputs (`vk_fsr3_inputs.cpp`) askthe same test. The log says `vk: upscaler: a camera cut at frame N`; `RX_VK_DLSS_CUT=0` turns the test off for anL4 (nit): The reference implies every detected cut is logged, but logging stops after the first 20 except for every hundredth cut.
When: After 20 cuts, a developer checking a later cut finds no log line even when the heuristic reset the history.
Do: Document the first-20 and every-hundredth logging limit alongside the log message.
@ -316,2 +317,3 @@dlss_math::unjitter(previous, s.last_jitter);const bool motion = !reset && dlss_math::reprojection(cam.current, previous, pc.reproject);// (nor across a camera cut: the chain's test, so frame interpolation starts again with every other user of the motion)const bool motion = !reset && dlss_math::reprojection(cam.current, previous, pc.reproject) &&L2 (should fix): FSR interpolation and its independently maintained camera history have not been exercised in the reported game run.
When: On Linux with AMD frame interpolation, a hard cut now resets the FSR inputs and suppresses interpolation for that present; the submitted results do not show the resulting image or pacing.
Do: Run a hard-cut sequence and ordinary camera motion on Linux AMD with FSR 3.1 interpolation and FSR 3.1 or FSR 4; compare the base and head output and present intervals.
@ -1763,1 +1781,3 @@const bool motion = seen && now - seen <= 2 && dlss_math::reprojection(cam.current, previous, pc.reproject);// (across a camera cut, temporal_camera_cut, the frame before's picture is another shot: no motion either, so DLSS Frame// Generation through Streamline, which learns a reset from the motion alone, starts again with the engines and NGX's)const bool motion = seen && now - seen <= 2 && dlss_math::reprojection(cam.current, previous, pc.reproject) &&L1 (should fix): The run counts cut decisions but does not show the player-visible fix or its frame-pacing cost.
When: During a hard cut with DLAA and NGX frame generation, the log confirms a reset, but it does not show whether the ghost or warped intermediate frame disappeared, or how the reset affects presentation timing.
Do: Compare the same hard-cut sequence on the base and this head on Windows with NGX, including captured output and repeated frame-time or present-interval measurements; include ordinary play and a camera swing.
L3 (should fix): The Streamline reset path has not been tested with its runtime.
When: At a detected cut, motion becomes false and Streamline receives a reset, which suppresses a generated frame; its visible result and pacing were not observed in the NGX-only run.
Do: Run the same hard-cut sequence on Windows with Streamline frame generation, comparing output and present intervals against the base, and check camera swings for unwanted resets.
Beanstalk test farm
Commit
288a7b1· approved by nobody yet · dashboardA member of
BigBeanscan review this commit and comment@Beanstalkto test it.@fix
fd702f3a5a288a7b1b28Recommendation: Approve. The code is ready: only testing is left. The cut detector and reset wiring remain in place, but the reported runs do not yet show the visible result or pacing at cuts, or exercise FSR interpolation and Streamline resets. Recommend approval; not approved on the forge.
What
@fixchangedI changed this pull request: the new head is
288a7b1b28. I rebased it ontomain(4908cc6dad).Nothing was built or run: the checks run again on the new head.
The change starts temporal histories again and clears camera motion at detected hard cuts, reducing the chance of carrying the previous shot into the new one. It adds a small CPU test and may cause a reset on very fast camera movement.
Testing before merging (3) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_temporal.cpp:1783: The run counts cut decisions but does not show the player-visible fix or its frame-pacing cost. When: During a hard cut with DLAA and NGX frame generation, the log confirms a reset, but it does not show whether the ghost or warped intermediate frame disappeared, or how the reset affects presentation timing. Do: Compare the same hard-cut sequence on the base and this head on Windows with NGX, including captured output and repeated frame-time or present-interval measurements; include ordinary play and a camera swing.gpu/vk/vk_fsr3_inputs.cpp:319: FSR interpolation and its independently maintained camera history have not been exercised in the reported game run. When: On Linux with AMD frame interpolation, a hard cut now resets the FSR inputs and suppresses interpolation for that present; the submitted results do not show the resulting image or pacing. Do: Run a hard-cut sequence and ordinary camera motion on Linux AMD with FSR 3.1 interpolation and FSR 3.1 or FSR 4; compare the base and head output and present intervals.gpu/vk/vk_temporal.cpp:1783: The Streamline reset path has not been tested with its runtime. When: At a detected cut, motion becomes false and Streamline receives a reset, which suppresses a generated frame; its visible result and pacing were not observed in the NGX-only run. Do: Run the same hard-cut sequence on Windows with Streamline frame generation, comparing output and present intervals against the base, and check camera swings for unwanted resets.Checks: they run again on this head; a failure shows on the pull request.
More: does it help, other systems, switches, what was read
Does it help: Unproven: the Windows RTX 5090 run reports 12 cut detections and no swing detections, but does not report the visible before-and-after result or frame pacing. The detector's standalone CPU time was reported as 0.13–0.23 µs per call.
Other systems: The reset paths affect DLSS, DLAA, DLSS 5, FSR 4, XeSS and frame generation. The reported game run used Windows and NVIDIA NGX; Linux AMD FSR interpolation and NVIDIA Streamline runtime runs remain outstanding.
Switches: RX_VK_DLSS_CUT is added as an on-by-default kill switch; setting it to 0 restores the previous behavior. The detection counts support the chosen threshold in the reported scene, but visible results and other affected paths remain unverified.
Reviewed:
288a7b1b28against4908cc6dad: Read AGENTS.md, CONTRIBUTING.md, the pull request template and the rebased pull request diff; inspected the changed camera-cut and reset code and test diffs. The full changed code files and their callers were not read in full; recorded runs were reviewed from the supplied description and comments. No review-checklist file was present.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run the project were executed. The author reports a Windows RTX 5090 game run and passing targeted tests; the three ledger runs remain outstanding.
Overlaps and merge order: Not checked; network access is unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
L3 (DLSS Frame Generation through Streamline): tested. Windows 11, RTX 5090, driver 621.40, 5120x2160, DLAA before the bloom, Frame generation Fixed 3x through NVIDIA Streamline 2.14.16 (
scripts/fetch.py streamline), DLSS 5 off. This PR's three commits built as a pack over maine6a71a1d(the same code as the head; the rebase changed none of it). Kokiri Forest fromkokiri-start, played by hand for about 5 minutes: talks with the Kokiri, the camera's swing behind Link, walking.vk: upscaler: a camera cutlines, each a single frame with 0, 5 or 8 of 75 points seen: the first frames of play and the talks' hard cuts. None at the swings.no inputs for 60 frames, on a stretch with no scene;the Insert menu is open) and on again after each. At the exit:Streamline shut down for the exit (result 0). No device loss.Unable to find 'common' constants, no depth or motion tag). The DLSS FG through branch's run (#2926) without this change logged the same. Its warnings (the back buffer's extent, flip metering) are in main's Streamline runs too.L1 (NGX, main against this PR on the same input): not done yet. A recorded route left the recording after its second load, so
dev.py ab --routerefused the run. Next: the same talk on main and on this PR, with captured video of the hard cuts.L2 (Linux AMD, FSR 3.1 frame interpolation): needs a Linux tester by hand; the farm has no windowed Linux run.
L1 (NGX DLSS FG, main against this PR, the same play): tested. Windows 11, RTX 5090, driver 621.40, 5120x2160, DLAA before the bloom, Frame generation Fixed 3x through NGX (
RX_VK_DLSSG=0), DLSS 5 off; maine6a71a1dand this PR's three commits as a pack over it. Kokiri Forest fromkokiri-start, played by hand on each build: a talk with the same Kokiri (its hard cuts), the camera's swing behind Link, walking; each recorded as a 120 fps clip.camera cutline at each (0 or 5 of 75 points seen).dev.py ab --routeleft the recording after its second load, and the A/B refused it.