Skip to content

Less stutter while the camera turns: wait 2 ms for new pipelines, not 8 (#29, #54) - #140

Open
RootChad wants to merge 1 commit into
mainfrom
stutter-camera-turn
Open

RootChad wants to merge 1 commit into
mainfrom
stutter-camera-turn

Conversation

@RootChad

Copy link
Copy Markdown
Collaborator

Reduces the stutter while the camera turns (#29, #54). This reduces it but does not remove it, so both issues stay open.

Change

One value in gpu/vk/vk_draw.cpp. The default of RX_VK_PIPE_WAIT_MS drops from 8 to 2. It is the per-frame time a frame waits for graphics pipelines that are not built yet.

Pipelines are built at their first draw in every run. Turning the camera meets new ones every frame, so each of those frames spent its full 8 ms waiting and then left the draws out anyway. With 2 ms, the same draws are left out, just for a frame or two longer. Nearly all of them belong to a 128×128 pass; the 1024×576 scene was hit only twice across three runs.

RX_VK_PIPE_WAIT_MS=8 restores the old behaviour without a rebuild.

Measurements

  • Hardware and settings: RX 6600 XT, Windows, fast sync on, AMD FSR at 67 %, Kokiri Forest save.
  • Input: a scripted controller (HOS_INPUT_LIVE) turns the camera for 3 s into a view not seen yet, then for 3 s back over it.
  • Timing: frame times come from HOS_PRESENT_LOG.
  • Runs: 5 at 8 ms, 4 at 2 ms.
8 ms (before) 2 ms (after)
New view: time lost in frames over 25 ms 1057 ms 859 ms (−19 %)
New view: fps 27–38 39–41
Seen view: frames over 25 ms 36 18.8 (−48 %)
Standing still: time lost 31 ms 28 ms
Pipeline wait per frame 4.6–5.6 ms 1.6–1.7 ms
Exposure steps (RX_VK_EXPOSURE_LOG=2) 0 0

The fast sync from 0.7.9.2 was also checked on AMD: 0 exposure steps across roughly 50k frames.

Levers tried and rejected

Lever Result
RX_VK_PARALLEL_MIN=200 worse
RX_VK_IMPORT_CHUNK_MB=64 clearly worse (new view 1385 ms lost, seen view 1192 ms)

What remains

Not tested

NVIDIA and Steam Deck. A check from someone with those would help.

🤖 Generated with Claude Code

…ines, not 8 (issues 29, 54)

The graphics pipelines are made at their first draw in every run (lean pipelines). Turning the camera meets new ones
nearly every frame, and a draw into a target that already holds the frame before's picture waited for its pipeline until
the frame had spent RX_VK_PIPE_WAIT_MS on such waits, then was left out anyway (drawn from the frame its pipeline is
ready in). At 8 ms that budget was spent in almost every frame of a turn: 4.6-5.6 ms of waits a frame on an RX 6600 XT.
2 ms keeps the frames short and leaves out the same draws a frame or two longer. Passes without a depth target
(post-processing, the HUD, blits) still wait without bound, as before. RX_VK_PIPE_WAIT_MS=8 brings the old budget back.

Measured on an RX 6600 XT (Windows, 0.7.9.2's fast sync on), the Kokiri Forest save at 67 % with AMD FSR, driven by
HOS_INPUT_LIVE: 5 s still, the camera turned 3 s into a view not seen yet, then 3 s back over it; frame times from
HOS_PRESENT_LOG, 5 runs at 8 ms against 4 at 2:
- into the new view: time lost in frames over 25 ms 1057 -> 859 ms, its rate 27-38 -> 39-41 fps
- back over the view seen: frames over 25 ms 36 -> 18.8 (408 -> 352 ms lost; one run of the four had a 300 ms texture
  lookup right after an image defragmentation pass, as one reference run did)
- standing still: unchanged (31 / 28 ms lost)
- the waits: 4.6-5.6 -> 1.6-1.7 ms a frame
- exposure steps (RX_VK_EXPOSURE_LOG=2, a frame 5 % off both neighbours that agree): 0 in every run, either way
- draws left out: the same ones as at 8 ms (a 128x128 pass of two targets nearly all; the 1024x576 scene twice in 3 runs)

Also measured and not kept: RX_VK_PARALLEL_MIN=200 (more segments in parallel: worse, 592 ms lost back over the seen
view against 418) and RX_VK_IMPORT_CHUNK_MB=64 (fewer, larger pool imports: worse, 1385 / 1192 ms). What still costs
in a turn, from an all-thread sample (HOS_SAMPLE_ALL) and the log: the pipelines' builds themselves, pool imports of
15-22 ms each in AMD's driver on the render thread (2 to 15 a turn), and descriptors and texture lookups for the newly
seen textures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant