Skip to content

vello_hybrid: Optimize rendering of opaque full-tile images#1461

Open
grebmeg wants to merge 1 commit intomainfrom
gemberg/vh-opaque-image-perf-impr
Open

vello_hybrid: Optimize rendering of opaque full-tile images#1461
grebmeg wants to merge 1 commit intomainfrom
gemberg/vh-opaque-image-perf-impr

Conversation

@grebmeg
Copy link
Collaborator

@grebmeg grebmeg commented Feb 20, 2026

Skip prior draw commands when a wide tile is fully covered by an opaque fill (opaque image). This avoids unnecessary compositing work for tiles that would be entirely overwritten.

I also added additional examples that allocate more and more images when pressing “a”, so I could run a very rough benchmark. It shows roughly a 1.65x improvement in the image randomized positioning scenario.

I am not entirely happy with the approach of carrying may_have_opacities inside ImageSource, but I have not come up with a better solution yet. I would really welcome any ideas if you have suggestions.

before after
before.mp4
after.mp4

Copy link
Collaborator

@LaurenzV LaurenzV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we rename this to Custom instead of OpaqueId? Maybe it should also be a typed struct?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(second one is up to you though, but the first one would be nice I think)

/// Pixmap pixels were registered earlier; this is just a handle.
OpaqueId(ImageId),
///
/// The `bool` indicates whether the image may contain non-opaque pixels.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// The `bool` indicates whether the image may contain non-opaque pixels.
/// The `bool` indicates whether the image may contain non-opaque pixels. If unsure, set this to `true`.

Comment on lines +77 to +78
let [a, b, c, d, e, f] = root_transform.as_coeffs();
let snapped_root = Affine::new([a, b, c, d, e.round(), f.round()]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be replaced with transform.with_translation()

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

Comments