vello_hybrid: Add support for setting a transparency hint for external textures - #1812
Merged
Conversation
grebmeg
approved these changes
Aug 12, 2026
LaurenzV
enabled auto-merge
August 12, 2026 10:12
pull Bot
pushed a commit
to PupilTong/vello
that referenced
this pull request
Aug 13, 2026
…nder#1813) Based on linebender#1812. # Context The main reason for opening this PR is that currently, the external texture rect API has no way of supporting other extend modes. This PR proposes tweaking the existing API for drawing external texture rects such that this use case can be accommodated. # Implementation It took me a while to figure out what the best way of implementing this is. Ultimately, I arrived at the conclusion that we should change the existing `draw_texture_rects` API to instead have a single `draw_texture_rect` API. I presume the original motivation for having the ability to submit multiple texture rectangles at once is performance. However, if you look at the actual implementation, the bulk of the work happens inside of the loop that iterates over each rectangles. Only very little work is lifted outside of the loop, so I don’t see any performance benefit in having a batched method for this. On the other hand, by making the API only take a single texture rect, we can make it more consistent with how other methods work and more easily add support for the missing features. For example, the `Scene::paint_transform` field now actually serves a purpose for external textures. In order to get what we need, I also changed the API to taking two different rectangles: A source and a destination rectangle. The source rectangle defines what the area is we want to sample, and the destination (as well as path/paint transform) how it’s mapped into the actual scene. Any pixel that would fall outside of the source region but still be visible in the destination region is sampled according to the extend mode. This PR was done with assistance of GPT 5.6 Sol. Also CC @tomcur since he designed the original API.
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.
As per description. This requires making the opaque pass aware of external textures. An unfortunate consequence of this is that opaque external images that are not aligned to integer coordinates will need to be drawn twice: Once during the opaque pass, and another time for the fractional edges during the alpha pass. But at least they can now be drawn with depth occlusion, which should be a huge win.
This PR was done with assistance of GPT 5.6 Sol.