Skip to content

feat(util): add BlitterWithLoadOp for compositing use cases#1363

Draft
khayzz13 wants to merge 2 commits intolinebender:mainfrom
khayzz13:main
Draft

feat(util): add BlitterWithLoadOp for compositing use cases#1363
khayzz13 wants to merge 2 commits intolinebender:mainfrom
khayzz13:main

Conversation

@khayzz13
Copy link

Summary

Add BlitterWithLoadOp to enable compositing Vello content over existing GPU-rendered content.

Motivation

When integrating Vello into applications that render other GPU content first (e.g., compute shader heatmaps, external renderers like Silk.NET), the final blit needs LoadOp::Load to preserve the existing surface content. Currently, TextureBlitter::copy() uses LoadOp::Clear, making compositing impossible without duplicating the blitter code.

Solution

Add a new BlitterWithLoadOp struct to vello/src/util.rs with:

  • new(device, format) - creates the blitter pipeline
  • copy_with_loadop(device, encoder, src, dst, loadop) - blits with configurable LoadOp

Compositing workflow:

  1. External renderer → Surface (LoadOp::Clear)
  2. Vello compute shaders → Intermediate texture
  3. BlitterWithLoadOp → Surface (LoadOp::Load, preserves step 1)
  4. Present

Changes

  • vello/src/util.rs: Add BlitterWithLoadOp struct and blitter_loadop field to RenderSurface

Backwards Compatibility

Fully backwards compatible - existing TextureBlitter and copy() method unchanged.

When rendering Vello content on top of existing GPU-rendered content
(e.g., compute shader heatmaps, Silk.NET graphics), the standard blit
uses LoadOp::Clear which destroys the existing content.

This adds BlitterWithLoadOp which allows using LoadOp::Load to preserve
the background, enabling proper compositing workflows:

1. External renderer → Surface (LoadOp::Clear)
2. Vello compute shaders → Intermediate texture
3. BlitterWithLoadOp → Surface (LoadOp::Load, preserves step 1)
4. Present

API:
- BlitterWithLoadOp::new(device, format) - create blitter
- BlitterWithLoadOp::copy_with_loadop(device, encoder, src, dst, loadop)

The existing TextureBlitter and its copy() method remain unchanged.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@khayzz13 khayzz13 marked this pull request as draft January 15, 2026 05:31
@khayzz13 khayzz13 closed this Jan 15, 2026
@khayzz13 khayzz13 reopened this Jan 15, 2026
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.

1 participant

Comments