You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vello Compute Pipeline: Per-Draw Blend Modes (CmdSetBlend)
Depends on:#439 (per-operation blend in SoftwareRenderer)
Currently, the Vello 9-stage compute pipeline (internal/gpu/tilecompute/) only supports blend modes at layer boundaries (BeginClip/EndClip). Individual fill/stroke commands are hardcoded to SrcOver. After #439 enables per-operation blend in the CPU rasterizer, the Vello compute path becomes the remaining gap.
Architecture
A new PTCL command CmdSetBlend (tag=14) will set the blend mode for subsequent color/gradient/image application commands:
CmdFill(...) → coverage (unchanged)
CmdSetBlend(blend) → set blend mode for next apply
CmdColor(rgba) → apply with current blend
Zero overhead for SrcOver — CmdSetBlend is not emitted for default SrcOver draws.
Pipeline Changes (4 stages)
Stage
Change
Scene encoding
New DrawTagColorBlend (scene_size=2: color + blend)
Stage 4 (draw_leaf)
Handle new tag
Stage 7 (coarse)
Read blend, emit CmdSetBlend
Stage 9 (fine)
currentBlend state + blendMixCompose() dispatch
Research
Deep analysis of Rust Vello architecture complete. Key findings:
No per-draw blend proposal exists in linebender/vello — our implementation would be first
Vello #1653: u8 fast path for blend (4-5x NEON speedup) — reference for our impl
blend_mix_compose() in blend.wgsl has SrcOver early-exit → minimal perf impact
PTCL is workgroup-uniform → zero GPU branch divergence
Conflation Artifacts (Known Trade-off)
Per-draw blend without layer isolation produces incorrect results for overlapping geometry with non-SrcOver modes (blend applied twice to overlap). Same limitation as Skia Graphite. For correct results: use PushLayer/PopLayer. Documented trade-off.
Vello Compute Pipeline: Per-Draw Blend Modes (CmdSetBlend)
Depends on: #439 (per-operation blend in SoftwareRenderer)
Currently, the Vello 9-stage compute pipeline (
internal/gpu/tilecompute/) only supports blend modes at layer boundaries (BeginClip/EndClip). Individual fill/stroke commands are hardcoded to SrcOver. After #439 enables per-operation blend in the CPU rasterizer, the Vello compute path becomes the remaining gap.Architecture
A new PTCL command
CmdSetBlend(tag=14) will set the blend mode for subsequent color/gradient/image application commands:Zero overhead for SrcOver —
CmdSetBlendis not emitted for default SrcOver draws.Pipeline Changes (4 stages)
DrawTagColorBlend(scene_size=2: color + blend)currentBlendstate +blendMixCompose()dispatchResearch
Deep analysis of Rust Vello architecture complete. Key findings:
blend_mix_compose()in blend.wgsl has SrcOver early-exit → minimal perf impactConflation Artifacts (Known Trade-off)
Per-draw blend without layer isolation produces incorrect results for overlapping geometry with non-SrcOver modes (blend applied twice to overlap). Same limitation as Skia Graphite. For correct results: use
PushLayer/PopLayer. Documented trade-off.Phases