Repository navigation
Conversation
Overlap GPU BGRA readback with rendering during realtime playback, use GPU BGRA on capable adapters, and stream preview frames into a reused texture on Windows/Linux to avoid per-frame CPU swizzle and atlas uploads.
|
Someone is attempting to deploy a commit to the Cap Software Inc Team on Vercel. A member of the Team first needs to authorize it. |
| let previous = readback.take_pending(); | ||
| let pending = readback.submit( | ||
| device, | ||
| queue, | ||
| encoder, | ||
| session.current_texture(), | ||
| uniforms.frame_number, | ||
| uniforms.frame_rate, | ||
| )?; |
There was a problem hiding this comment.
Playback reuses a mapped buffer
RgbaToBgraReadback keeps one buffer at a fixed size. The next frame submits a copy and calls map_async before the previous frame is read and unmapped. The second realtime frame therefore reuses a buffer whose map is still active, violating wgpu’s buffer-use rules and breaking the default hardware preview path. Alternate between at least two readback buffers.
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/rendering/src/frame_pipeline.rs
Line: 2700-2708
Comment:
**Playback reuses a mapped buffer**
`RgbaToBgraReadback` keeps one buffer at a fixed size. The next frame submits a copy and calls `map_async` before the previous frame is read and unmapped. The second realtime frame therefore reuses a buffer whose map is still active, violating wgpu’s buffer-use rules and breaking the default hardware preview path. Alternate between at least two readback buffers.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| } else { | ||
| frame_renderer | ||
| .render_immediate_with_timings( | ||
| input.segment_frames, | ||
| input.uniforms, | ||
| &input.cursor, | ||
| true, | ||
| &mut layers, | ||
| ) | ||
| .await |
There was a problem hiding this comment.
A seek after playback can return the previous playback frame instead of the requested frame. Realtime rendering now leaves a readback pending, but the immediate helpers return that older frame when they receive Some(frame). A lone seek has drained_count == 0, so nothing clears it first. The paused preview accepts the reply and stops retrying, leaving the requested frame pending. Drain the old readback before an immediate request, then return the newly requested frame.
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/editor/src/editor.rs
Line: 485-494
Comment:
**Seeking shows an older frame**
A seek after playback can return the previous playback frame instead of the requested frame. Realtime rendering now leaves a readback pending, but the immediate helpers return that older frame when they receive `Some(frame)`. A lone seek has `drained_count == 0`, so nothing clears it first. The paused preview accepts the reply and stops retrying, leaving the requested frame pending. Drain the old readback before an immediate request, then return the newly requested frame.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| .map(|(frame, timings)| { | ||
| frame.map(|frame| { | ||
| ( | ||
| EditorFrameOutput::Rgba(frame), | ||
| PlaybackRenderOutputFormat::Rgba, | ||
| timings, | ||
| ) | ||
| }) |
There was a problem hiding this comment.
Realtime rendering now returns the previous frame, but frame_layout still comes from the current request. During a live crop, size, or camera-layout edit, the callback pairs old pixels with the new layout. GPUI uses that layout for preview size and edit positions, so they can briefly disagree with the image. Keep each pending frame’s layout with its readback and deliver them together.
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/editor/src/editor.rs
Line: 476-483
Comment:
**Pixels and layout disagree**
Realtime rendering now returns the previous frame, but `frame_layout` still comes from the current request. During a live crop, size, or camera-layout edit, the callback pairs old pixels with the new layout. GPUI uses that layout for preview size and edit positions, so they can briefly disagree with the image. Keep each pending frame’s layout with its readback and deliver them together.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| if realtime { | ||
| frame_renderer | ||
| .render_with_timings( | ||
| input.segment_frames, | ||
| input.uniforms, | ||
| &input.cursor, | ||
| true, | ||
| &mut layers, | ||
| ) | ||
| .await |
There was a problem hiding this comment.
Playback misses its final frame
Each realtime call now returns the previous frame and leaves the current one pending. When playback ends, the stop path neither reads that last frame nor requests a final redraw. The preview can therefore stop one submitted frame behind. Add a final drain that delivers the pending frame and its layout when playback stops.
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/editor/src/editor.rs
Line: 466-475
Comment:
**Playback misses its final frame**
Each realtime call now returns the previous frame and leaves the current one pending. When playback ends, the stop path neither reads that last frame nor requests a final redraw. The preview can therefore stop one submitted frame behind. Add a final drain that delivers the pending frame and its layout when playback stops.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Comments Outside DiffThese findings could not be posted inline.
|
Double-buffer BGRA GPU readbacks, wait for map callbacks reliably, and flush pipelined frames before seek/immediate renders.
34abbf8 to
a11789f
Compare
Summary
StreamingImageon Windows/Linux by default to reuse one texture per stream and skip per-frame atlas uploads (disable withCAP_GPUI_STREAMING_IMAGE=0).Test plan
CAP_GPUI_STREAMING_IMAGE=0: preview falls back toRenderImageconversion path.Do not merge until consecutive BGRA frames use separate buffers, seeks return their requested frame, and readbacks wait for late callbacks.
Findings
Fix with agent prompt
Summary
Adds pipelined preview readback and GPU conversion to tightly packed BGRA.
Reviews (1) · Last reviewed commit: "perf(editor): pipeline Windows/Linux pre..." · Reviewed by Greptile