Skip to content

perf(rendering): cheaper blur sampling and overlay capture - #3584

Open
AatmanAJ wants to merge 9 commits into
CapSoftware:mainfrom
AatmanAJ:perf/render-shaders-overlay
Open

AatmanAJ wants to merge 9 commits into
CapSoftware:mainfrom
AatmanAJ:perf/render-shaders-overlay

Conversation

@AatmanAJ

@AatmanAJ AatmanAJ commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Motion blur in composite-video-frame.wgsl uses sample_texture_blur (single textureSample per tap) instead of the sharpened 5-tap downscale path used for the main composite sample.
  • Picker overlay backdrop capture runs less often: stale interval 8s when crop/display size match the last capture, 2s minimum when they changed; still waits for crop settle before retake.
  • Cropped Windows Graphics Capture copies into a pooled texture (TrimPool) per frame so in-flight frames are not overwritten by the next crop copy.

Deferred

  • Windows fragmented M4S / GPU encode path: No safe small change found without a larger Media Foundation muxer or capture-pipeline rework (e.g. deeper staging ring between D3D readback and encoder thread, or zero-copy handoff into HW encoder). The existing CAP_MUXER_BUFFER_SIZE knob (default 240) remains the primary backpressure lever; a dedicated GPU encode staging ring is left for a follow-up.

Test plan

  • Export or preview a clip with directional/zoom motion blur; confirm blur still looks correct and GPU time drops on downscaled sources.
  • Open area/window picker overlay; confirm glass backdrop still updates after crop moves and does not flicker mid-drag.
  • Windows cropped capture (window/display crop): record while encoder is slow; confirm no torn or duplicated crop frames.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with no new actionable issues found.

Summary

The PR reduces motion-blur sampling work, spaces out picker backdrop captures, and pools cropped Windows capture textures.

  • Motion blur taps use a lighter texture sample.
  • Picker backdrops wait longer to refresh when their bounds match.
  • Windows cropped recordings keep each frame's texture in use until encoding finishes.
  • The export check counts GIF frames by reading their actual blocks.

Reviews (7) · Last reviewed commit: "fix(desktop-gpui): tie a backdrop captur..." · 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/scap-direct3d/src/lib.rs Resolved
@AatmanAJ

Copy link
Copy Markdown
Contributor Author

@greptile-apps please re-review. Addressed the open P1/P2 items in the latest push on this branch.

@AatmanAJ
AatmanAJ force-pushed the perf/render-shaders-overlay branch from 6a36f76 to a9a4198 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 8 commits November 4, 2026 17:27
Motion-blur taps use a single texture read instead of sharpened downscale sampling; overlay backdrops refresh less often when crop and display size are stable; cropped D3D capture frames reuse a texture pool so queued frames are not overwritten.
Refactoring for blur sampling moved crop clamping into cropped_sample_uv
but left sample_texture using safe_min/safe_max out of scope.
Hold the scap Direct3D frame until the encoder finishes processing the
texture so pooled crop surfaces are not recycled early.
…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/render-shaders-overlay branch from 0c28d46 to b3c3155 Compare November 4, 2026 17:47
@AatmanAJ

AatmanAJ commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

@greptile-apps review

Comment thread apps/desktop-gpui/src/target_overlay.rs Resolved
…ted with

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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