Repository navigation
feat(mask): implement blur scissor logic and optimise rendering pipeline - #2490
Conversation
|
Please address Greptile’s remaining feedback and get this to 5/5 before we merge. Add a rendered pixel comparison against the original fullscreen blur path, covering fractional bounds, edge-clipped and overlapping masks. The rectangle tests alone do not verify that blur-edge pixels stay unchanged. Please also include the reproducible benchmark harness/command for the timings in the description. |
yes sir on it |
|
@greptileai review |
|
@viralcodex is attempting to deploy a commit to the Cap Software Inc Team on Vercel. A member of the Team first needs to authorize it. |
|
added, please check :) |
|
Thanks for the PR. Greptile's 5/5 was for 6a23daf, and new commits have landed since, so the current head hasn't been scored. We only merge once the current head is 5/5. Please comment |
|
@greptileai review |
hey @richiemcilroy, everything is green with 5/5 review |
Problem
Every privacy-mask blur draws two fullscreen triangles per frame. Even a small mask processes the entire output in both passes, wasting GPU time during playback and export.
The shader already limits expensive blur sampling, but fragments outside the mask still run.
flowchart LR subgraph Before B1["Fullscreen horizontal pass"] --> B2["Fullscreen vertical pass"] end subgraph After A1["Mask bounds + blur support"] --> A2["Mask bounds"] endSolution
mask.rsapplies conservative scissor rectangles. The horizontal pass includes vertical blur support and sampling guards; the vertical pass covers the mask.Benchmark
The reproducible harness and its dependency lockfile are prepared locally and pending push under
scripts/bench-mask-scissor/. It imports the production mask layer and shader without the FFmpeg dependency. Exact inputs and methodology are documented inscripts/bench-mask-scissor/README.md.Apple M4 Pro, Metal, 3840x2160, release build, blur radius 12. Medians of 21 alternating samples per variant after three warmup pairs. Each sample batches eight mask sequences; timings below are milliseconds per sequence, not per batch.
These are submission-to-GPU-completion timings, not GPU-only timestamps. They include submission and synchronization, exclude resource creation and CPU command encoding, and replace the previous timing table. Metal timestamp queries produced zero or misleading stage values, so the harness does not use them. These are mask-layer timings, not end-to-end playback/export timings.
Run from the repository root after the harness is pushed:
CARGO_TARGET_DIR=target/mask-scissor-bench cargo test --manifest-path scripts/bench-mask-scissor/Cargo.toml --release --lib mask::benchmark::blur_scissor_benchmark -- --exact --ignored --nocapture --test-threads=1Pixel validation
The rendered comparison checks every output byte against the original fullscreen draw for fractional, edge-clipped, and sequential overlapping masks. Both variants share the shader, sampler, clears, blending, and varying-color/alpha input. Each case must change pixels to reject inert renders.
To run only the bounds and pixel checks:
CARGO_TARGET_DIR=target/mask-scissor-bench cargo test \ --manifest-path scripts/bench-mask-scissor/Cargo.toml --release --lib \ blur_scissor -- --include-ignored --skip blur_scissor_benchmark \ --nocapture --test-threads=1
Confidence Score: 5/5
The PR appears safe to merge; no actionable issues remain.Summary
Limits blur drawing to conservative mask bounds while keeping the existing clears, sampling, and blending.
Reviews (3) · Last reviewed commit: "Add initial implementation for mask scis..." · Reviewed by Greptile