Skip to content

vello_hybrid: Add support for setting a transparency hint for external textures - #1812

Merged
LaurenzV merged 4 commits into
mainfrom
laurenz/opaque_external_textures
Aug 12, 2026
Merged

vello_hybrid: Add support for setting a transparency hint for external textures#1812
LaurenzV merged 4 commits into
mainfrom
laurenz/opaque_external_textures

Conversation

@LaurenzV

Copy link
Copy Markdown
Collaborator

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.

@LaurenzV
LaurenzV requested a review from grebmeg August 11, 2026 12:15
Comment thread sparse_strips/vello_hybrid/src/sampling.rs
@LaurenzV
LaurenzV enabled auto-merge August 12, 2026 10:12
@LaurenzV
LaurenzV added this pull request to the merge queue Aug 12, 2026
Merged via the queue into main with commit 3e6bb96 Aug 12, 2026
20 checks passed
@LaurenzV
LaurenzV deleted the laurenz/opaque_external_textures branch August 12, 2026 10:50
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.
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.

2 participants