Repository navigation
Issue #1937: GPU editing on Windows keeps its device through window resizes, stays within the card's memory, and settles sooner at 1:2 - #1940
Merged
Conversation
…laces the render device
wgpu-core 30's Surface::configure waits for the GPU and, when a render thread submits during the
wait, returns GpuWaitTimeout and drops every map callback it collected unanswered. A readback then
saw "map callback: channel is empty and sending half is closed", took it for a lost device and
replaced the window's healthy device in the middle of a slider drag (2026-11-28 18:33 log). The
mapping itself is done: it is read as usual (uploads and the view readback too); a buffer that is
somehow not mapped fails that render only.
egui's next frame after such a failure still draws at the old size, and wgpu rejects its scissor
rectangle ("not contained in the render target", egui-wgpu's encoder): on the window's device that
is the window's error, logged, not the renderer's. Reproduced on a recent build with window resizes
during slider drags (1 device replacement in 4 min); gone with this change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n the card's memory The views' device stages were budgeted from system RAM alone (a quarter of the memory budget, 4.3 GB here, and the open photo's views up to four times that), and each card's buffer pool could keep a third of the card: with the renders in flight and the window's own memory beside them, the 12 GB editing card ran out (9.9 GB used, a 196 MiB buffer refused, 2026-11-28). Now: - the device stages have their own budget, a fifth of the editing card's memory (lcc_gpu::stage_vram_budget; the idle views' go first, the loupe's last); - the pool keeps at most a fifth of each card while it works (was a third); - after an out-of-memory render and when a device is replaced, the shared original, the Auto Mask strokes and every view's device stages are released (lcc_gpu::take_memory_pressure), so the next render has the room and nothing of a replaced device is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…our noise model A zoomed view renders its window and each tile as jobs of their own, the tiles without a stage cache, and each measured the whole frame's noise for the joint colour NR again on the CPU: 270-450 ms of a 45 MP raw's 700-900 ms render, 13 times after every slider release at 1:2. The model is now kept per photo and frame (FRAME_NOISE, keyed by the source and Plan::frame_lin_key, 16 kept). Measured on three R5 C raws with masks (slider out and back, 10 min): the sharp view after a release at 1:2 settled in 2.0 s median (5.4 s before), 1:1 in 3.9 s (5.9 s). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… default Sharing the window's device failed under the renderer's work on Windows (RTX 5070, Vulkan, 45 MP raws with masks): besides the dropped readbacks and egui's frame after a failed configure (GPU-STABLE-1), a real "Device is lost" on the shared device took the window with it. egui dropped every frame from then on and the screen froze for good, while the renderer had already recovered on a new device. With a device of its own, two 4-minute resize-and-slider stress runs raised no surface error and no device failure, and slider moves were as quick: Fit 386 against 410 ms, the sharp 1:2 view 1.0 against 2.7 s. CHROMAFORGE_GPU_WINDOW=1 shares the window's device as before; other platforms keep sharing it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fixes Manual: none, no user-visible change in the manual's pages (the Windows device default is documented in docs/gpu-pipeline.md). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Fixes #1937
Four fixes for GPU editing on Windows with large raws and masks: the render device survives window resizes, the editing card stays within its memory, and the sharp view at 1:2 comes sooner.
What changed
Surface::configurecan returnGpuWaitTimeoutand drop the map callbacks it collected. A readback whose callback was dropped now checks whether the buffer is mapped anyway (Mapped::{Yes, Dropped, Failed}) and reads it, instead of treating the device as lost. egui's scissor error on the frame after such a failure is logged as the window's error (window_frame_error), not counted against the renderer.stage_vram_budget; idle views give way first, the loupe last). Each card's pool keeps at most a fifth of the card while it works (was a third). After an out-of-memory render, or when a device is replaced, the shared original, the Auto Mask strokes and every view's device stages are released (take_memory_pressure).FRAME_NOISE, keyed by the source andPlan::frame_lin_key, 16 kept), so the tiles stop measuring the whole frame's noise again on the CPU.CHROMAFORGE_GPU_WINDOW=1shares the window's device as before, and=0never shares it on any platform. Documented indocs/gpu-pipeline.md.What staging already has: the typed polls and per-device error recording (REVIEW-F01, F02, T06, P09 to P13) complement these changes; they cover none of the four. F01's stricter poll handling makes the window-frame filter in GPU-STABLE-1 more needed.
Trade-off: on Windows, drafts are no longer drawn straight from textures on the window's device. The settle times below include that cost.
Measured
Release builds, staging (5df5a81) against this branch. 3 Canon R5 C CR3s from a real wedding, each with global edits and subject, linear, radial and brush masks, on an RTX 5070 (Vulkan). The session is 6 minutes of slider drags at fit, 1:2 and 1:1, then 4 minutes of slider drags with window resizes between them, then an export of the three photos.
Exports
Exports are pixel-identical between staging and this branch for the same run outcome. Separately, the same photo can export to two different JPEGs in two runs of the app, on staging as on this branch (photo 1 here, max 37 levels on 2.1 % of pixels, in dark edited areas). That is filed as #1938 with the numbers. This PR doesn't change it.
Checks
cargo xtask ci --quick --base origin/staging: everything this branch touches passes. Three tests fail, from staging's face-prototype work, as on staging itself:tests_face_recognize::a_trained_person_and_an_untrained_one_are_scored_the_same_way,i18n::tests::no_language_has_translation_gaps(34 "Face Prototypes" strings) andtests_i18n_coverage::ui_text_has_no_em_dashes(one What's New line).lcc_gputests pass on both cards (RTX 4070 SUPER and RTX 5070).Manual: none, no user-visible change in the manual's pages.
🤖 Generated with Claude Code