feat(util): add BlitterWithLoadOp for compositing use cases#1363
Draft
khayzz13 wants to merge 2 commits intolinebender:mainfrom
Draft
feat(util): add BlitterWithLoadOp for compositing use cases#1363khayzz13 wants to merge 2 commits intolinebender:mainfrom
khayzz13 wants to merge 2 commits intolinebender:mainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
BlitterWithLoadOpto 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::Loadto preserve the existing surface content. Currently,TextureBlitter::copy()usesLoadOp::Clear, making compositing impossible without duplicating the blitter code.Solution
Add a new
BlitterWithLoadOpstruct tovello/src/util.rswith:new(device, format)- creates the blitter pipelinecopy_with_loadop(device, encoder, src, dst, loadop)- blits with configurable LoadOpCompositing workflow:
Changes
vello/src/util.rs: AddBlitterWithLoadOpstruct andblitter_loadopfield toRenderSurfaceBackwards Compatibility
Fully backwards compatible - existing
TextureBlitterandcopy()method unchanged.