Repository navigation
M5.6: with a GPU, a slider drag's preview is drawn in the frame of the drag tick - #1413
Merged
bflatastic merged 1 commit intoOct 13, 2026
Merged
Conversation
…e drag tick A drag tick requested the loupe's draft and the frame ended; the draft, done in 1.5-3 ms on the GPU, was picked up at the start of the next frame, a frame after the slider moved. Now, in a drag, the loupe waits up to 40 % of a frame for its draft when the last loupe render took well under that (not with a render offload, nor zoomed in, where what changes on screen is the window's draft). A CPU render, which would only make the frame late, is not waited for. JobPool::wait waits for the next finished job, which try_recv then hands out; Renderer::poll's collection of finished jobs is split out so the wait can turn the draft into the texture. Co-Authored-By: Claude <noreply@anthropic.com>
Member
|
Landed on main in #1431. Thank you, @dev-null-undefined! Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
During a drag, a frame applies the tick (
develop.set), the loupe asks for a draft, and the frame ends. On the GPU the draft is ready a few milliseconds later.Renderer::pollonly collects it at the start of the next frame, so it reaches the screen one frame later than it could. At 1920×1200 that frame is most of the time from tick to texture: a median of 18.5 ms, while the GPU drafts take a few milliseconds.Changes
Renderer::wait_for_draft. Right after the loupe asks for its draft during a drag, it waits for it, turning finished jobs into textures as they arrive, so the draft is drawn in the same frame. The wait is at most 40 % of a frame (egui'spredicted_dt, clamped to 1/240–1/30 s).JobPool::wait(timeout). Waits for the next finished job and keeps it fortry_recv.Renderer::poll. Its loop over finished jobs moved, unchanged, intocollect, which the wait also calls.Result
main→ this branch. Each value is the median of 3 runs. Second Exposure drag on the raw, 30 ticks at 60 Hz, GPU drafts, driven headlessly through the real app:mainmain), most likely because the 1.7 MP drafts took longer than the 4.4 ms threshold on this machine, so the wait stayed off.mainby thumbnail decodes (1–4 of 30 drafts shown, with or without this change; fixed by M5.6: a slider drag no longer decodes the edited raw again for its filmstrip thumbnail #1412 and helped by M5.6: a view slot renders one job at a time, so a drag's renders don't pile up #1302), which would hide this change.Measured on a Sony ILCE-7RM6 64 MP compressed raw (private photo), an RTX 4070 Ti SUPER (Vulkan) and a Ryzen 7 9800X3D. The app ran under a 4-CPU cgroup quota that other builds kept saturated during every run, so the p90s are noisy.
Verification
render::thumbnail_tests::a_fast_draft_is_drawn_in_the_frame_that_asked_for_it: with a last loupe render slower than the budget, nothing is waited for. With a fast one, the texture is the new render when the wait returns.tests::pool_wait_keeps_the_finished_job_for_try_recv(preview crate).cargo xtask ciwithRUSTFLAGS="-A clippy::chunks_exact_to_as_chunks". That lint, new in rustc 1.98's clippy, fires on untouched code onmain(crates/pipeline/src/spots.rs:250, see Issue #989: clippy 1.99, fill_box reads its buffer with as_chunks::<3>() (item 4) #997). Results:cargo test --workspacepasses exceptcatalog::tests_lock::dropping_the_lock_frees_the_library_while_another_thread_spawns_processes. That test spawns/bin/true, which NixOS doesn't have, so it fails onmaintoo. With it skipped, every test passes (--no-fail-fast).cargo test -p lightcraft-ui-eguion its own also fails the 6tests_model_setuptests, as onmain(see M5.6: a view slot renders one job at a time, so a drag's renders don't pile up #1302 and Help ▸ Debug ▸ Show Frame Rate: a frame-rate display for watching drags and zooms #1313). They pass in the workspace run.)Related
crates/preview/src/tests.rs, where both add tests at the end. Keep both.docs/whats-new.md: both add a 2026-10-13 section, so whichever merges second joins the entries.drag_latencyexample) proposed in M5.7: perf harnesses for slider latency, zoom windows and photo loading (examples only) #1421.