Skip to content

perf(editor): pipeline Windows/Linux preview readback - #3585

Open
AatmanAJ wants to merge 7 commits into
CapSoftware:mainfrom
AatmanAJ:perf/editor-preview-pipeline
Open

AatmanAJ wants to merge 7 commits into
CapSoftware:mainfrom
AatmanAJ:perf/editor-preview-pipeline

Conversation

@AatmanAJ

@AatmanAJ AatmanAJ commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Pipeline realtime editor preview readback (RGBA and BGRA) so frame N−1 is read back while frame N renders; seeks and paused redraws still use immediate readback.
  • On capable Windows/Linux adapters, preview frames are read back as tight BGRA on the GPU instead of padded RGBA plus CPU channel swap.
  • GPUI preview uses StreamingImage on Windows/Linux by default to reuse one texture per stream and skip per-frame atlas uploads (disable with CAP_GPUI_STREAMING_IMAGE=0).

Test plan

  • Open a studio recording on Windows or Linux (hardware GPU): playback preview stays smooth and edits while playing remain responsive.
  • Scrub while paused: preview shows the exact seeked frame.
  • Software adapter / WARP path: preview still works via RGBA fallback (no BGRA readback).
  • CAP_GPUI_STREAMING_IMAGE=0: preview falls back to RenderImage conversion path.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issue was found.

Summary

The PR pipelines editor preview readback and enables reusable preview textures on Windows and Linux.

  • Realtime playback renders the next frame while the previous one is read back.
  • Capable adapters return tight BGRA frames for editor previews.
  • Windows and Linux previews paint frames through reusable GPUI image streams.
  • The Linux export harness counts GIF image frames and their delays.
  • The codec verification test uses a higher bitrate for its small output sample.

Static review found no new actionable issues. No build, native playback test, or visual capture was run.

Reviews (5) · Last reviewed commit: "fix(ci): walk GIF blocks when measuring ..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

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.

Comment thread crates/rendering/src/frame_pipeline.rs Resolved
Comment thread crates/editor/src/editor.rs Resolved
Comment thread crates/editor/src/editor.rs Resolved
Comment thread crates/editor/src/editor.rs Resolved
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Comments Outside Diff

These findings could not be posted inline.

  • P1 Successful readbacks can fail crates/rendering/src/frame_pipeline.rs:1756 ▶

    Replacing mapped_result with try_recv brings back the shared-device callback race. Another thread can collect the map callback while this thread’s submission wait finishes, but send its result slightly later. The new code treats that temporarily empty receiver as BufferMapWaitingFailed, causing needless render retries or failed readbacks. Keep the bounded receiver wait for both RGBA and NV12.

@AatmanAJ
AatmanAJ force-pushed the perf/editor-preview-pipeline branch from 34abbf8 to a11789f Compare October 30, 2026 00:26
@AatmanAJ

Copy link
Copy Markdown
Contributor Author

@greptile-apps review

2 similar comments
@AatmanAJ

Copy link
Copy Markdown
Contributor Author

@greptile-apps review

@AatmanAJ

Copy link
Copy Markdown
Contributor Author

@greptile-apps review

@richiemcilroy

Copy link
Copy Markdown
Member

Thanks! Can you rebase on main to clear the conflicts and resolve the open review threads? Then we'll take a look.

Aatman Jain added 7 commits November 4, 2026 17:28
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.
Double-buffer BGRA GPU readbacks, wait for map callbacks reliably, and flush pipelined frames before seek/immediate renders.
The PR deleted mapped_result but PendingReadback::map still called it, so cap-rendering did not compile. Restore it, its test, and its use in the NV12 readback so a callback another renderer is about to run on a shared device is still waited for.
Pipelined submits must alternate buffers: with a single slot wgpu rejects the second copy with 'Buffer is still mapped'. The new tests drive eight pipelined frames and a discarded pending readback through the two-slot ring and compare every pixel.
…nd drain the last one

- pair each delivered frame with the layout it was rendered with instead of the current request's
- stop discarding the pending frame when a newer request replaces it, which starved the preview under sustained backlog
- discard the pending frame before seeks, paused redraws and thumbnails so they get their own frame
- deliver the pending frame when playback ends
- keep BGRA transition renders pipelined like RGBA ones and add an immediate variant
- cover the new Bgra output in the imported-music benchmark
…set bitrate

At 80 kbps the paravirtualised VideoToolbox HEVC encoder on the CI macOS
VMs occasionally left a blurred camera code cell at margin 0.17, below the
reader's 0.18 threshold. 138,240 bps is the Web export preset (0.08 bpp),
still below the Social preset the verify exports use.
@AatmanAJ
AatmanAJ force-pushed the perf/editor-preview-pipeline branch from 247ed79 to bfcdd9b Compare November 4, 2026 17:51
@AatmanAJ

AatmanAJ commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

@greptile-apps review

This branch has not been deployed

No deployments
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.

2 participants