Skip to content

Conversation

sagudev
Copy link
Contributor

@sagudev sagudev commented Sep 15, 2025

As discussed in #133 (review) we can also generalize Brush over image data and gradient. This makes BrushRef<'a> = Brush<ImageBrushRef<'a>, &'a Gradient> which allows to share more From impls, most notably various color implementations (even owned version can now support conversion from &color because color is copy anyway).

@sagudev sagudev force-pushed the generic-brush branch 2 times, most recently from 1eba552 to 203b17e Compare September 16, 2025 14:46
@sagudev sagudev marked this pull request as ready for review September 16, 2025 14:50
@sagudev
Copy link
Contributor Author

sagudev commented Sep 25, 2025

@LaurenzV
Copy link

@DJMcNab Is this intended to land before 0.5.0?

@DJMcNab
Copy link
Member

DJMcNab commented Sep 26, 2025

We talked about this in office hours yesterday. My thinking is to not do so - this is something which it only makes sense to think about once we get Vello API working, probably.

If this would be useful for Vello CPU, it could land though. I don't think it has a huge cost.

@sagudev
Copy link
Contributor Author

sagudev commented Sep 26, 2025

This change is backwards compatible, so it can be done in patch release.

If this would be useful for Vello CPU, it could land though. I don't think it has a huge cost.

My idea is to start passing this type down to vello_cpu renderer (instead of own type) and deal with opacity, BGRA and alpha on sampling, but we could always just continue to roll own sparse strips types (and extend them) like we do now.

@LaurenzV
Copy link

LaurenzV commented Sep 27, 2025

Maybe I am missing something obvious, but how is it backwards-compatible? The PR introduces generic parameters to a public enum, which seems like a pretty breaking change to me, no?" 🤔

@sagudev
Copy link
Contributor Author

sagudev commented Sep 27, 2025

Maybe I am missing something obvious, but how is it backwards-compatible? The PR introduces generic parameters to a public enum, which seems like a pretty breaking change to me, no?" 🤔

Generic parameter have default values that are same as before, so they are backwards compatible AFAIK.

@LaurenzV
Copy link

Ahh okay, fair enough, I missed that.

Copy link

@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.

I mean to me, that seems reasonable, but I think it might be a good idea to get a draft PR in vello_cpu up working before we actually merge this, to make sure it works as intended.

@sagudev
Copy link
Contributor Author

sagudev commented Sep 28, 2025

Hm, I just rebased and docs are failing.

Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

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

I think this now blocks #140, because I do suspect this is probably still breaking, but only in niche scenarios.
The changes look fine to me

I'm happy enough keeping this out of the changelog; it's not a functionality I particularly want to advertise, because it's a bit messy for our interstitial state.

f
Signed-off-by: sagudev <[email protected]>
Copy link
Contributor

@nicoburns nicoburns left a comment

Choose a reason for hiding this comment

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

Ah, it hadn't occured to me that this would enable Brush to be used in sparse strips vello. This is now making sense to me.

@sagudev
Copy link
Contributor Author

sagudev commented Sep 29, 2025

Ah, it hadn't occured to me that this would enable Brush to be used in sparse strips vello. This is now making sense to me.

This is my main motivation.

Given that CI passes in linebender/vello#1253 and the amount of support for this I am going to land this (so we can unblock release).

@sagudev sagudev added this pull request to the merge queue Sep 29, 2025
Merged via the queue into linebender:main with commit ac2c789 Sep 29, 2025
15 checks passed
@sagudev sagudev deleted the generic-brush branch September 29, 2025 16:42
github-merge-queue bot pushed a commit that referenced this pull request Sep 30, 2025
A simpler version of #124, to get in before v0.5.0 (which is currently
blocked on #134 anyway).
github-merge-queue bot pushed a commit to linebender/vello that referenced this pull request Oct 2, 2025
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.

4 participants