Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update wgpu, Peniko, and Vello #741

Merged
merged 6 commits into from
Jan 23, 2025

Conversation

waywardmonkeys
Copy link
Contributor

@waywardmonkeys waywardmonkeys commented Jan 22, 2025

Update to Vello 0.4, Peniko 0.3.1, and wgpu 23.0.1. This brings with it the new color crate that Vello and Peniko use.

This currently disables interpolation of gradients.

@waywardmonkeys waywardmonkeys force-pushed the update-wgpu-peniko-vello branch from 724660e to 680a9e9 Compare January 22, 2025 06:40
@waywardmonkeys
Copy link
Contributor Author

This is a draft and not fully working yet (doesn't compile). The actual update of Vello isn't here yet until I finish up the changes for brush and gradient interpolation to at least get them to compile.

Copy link
Contributor Author

@waywardmonkeys waywardmonkeys left a comment

Choose a reason for hiding this comment

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

The bulk of the changes are quite dull.

  • Color constants are referenced from color::palette::css rather than named constants on the Color type.
  • Use with_alpha rather than multiply_alpha since we're just using this to set the alpha.
  • Use Color::from_rgb8 and Color::from_rgba8 rather than Color::rgb8 and Color::rgba8.

@@ -16,5 +16,5 @@ wgpu = { workspace = true }
futures = "0.3.26"
anyhow = "1.0.69"
swash = "0.1.8"
floem-vger-rs = { version = "0.3.1", package = "floem-vger" }
floem-vger-rs = { git = "https://github.com/lapce/vger-rs.git", rev = "b2441cc85b1d555a3c74e2cdced08382460759df", version = "0.3.1", package = "floem-vger" }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will need a release before this can land.

#[allow(clippy::type_complexity)]
glyph_cache: HashMap<(CacheKey, Color), (CacheColor, Option<Rc<Glyph>>)>,
glyph_cache: HashMap<(CacheKey, u32), (CacheColor, Option<Rc<Glyph>>)>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

With color, the Color (really AlphaColor<Srgb>) is using f32, so it isn't Hash or Eq. We have a way to work around this with a wrapper type, but since here we're just dropping down to u8 colors anyway, I thought this might be okay here. I'm not sure though.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like a good solution here.

src/style.rs Outdated Show resolved Hide resolved
@waywardmonkeys waywardmonkeys force-pushed the update-wgpu-peniko-vello branch from 680a9e9 to 59d7daa Compare January 22, 2025 08:21
Copy link
Collaborator

@jrmoulton jrmoulton left a comment

Choose a reason for hiding this comment

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

to this point all of these changes look good and I think it's fine to leave the gradient interpolation commented out

@waywardmonkeys waywardmonkeys changed the title Update wgpu peniko vello Update wgpu, Peniko, and Vello Jan 23, 2025
@waywardmonkeys waywardmonkeys marked this pull request as ready for review January 23, 2025 14:30
@waywardmonkeys waywardmonkeys force-pushed the update-wgpu-peniko-vello branch from 59d7daa to 9583f31 Compare January 23, 2025 14:47
@waywardmonkeys waywardmonkeys force-pushed the update-wgpu-peniko-vello branch from 9583f31 to bc0b489 Compare January 23, 2025 14:49
@jrmoulton
Copy link
Collaborator

Thanks for doing this! It is very appreciated

@jrmoulton jrmoulton merged commit ce05b99 into lapce:main Jan 23, 2025
7 checks passed
@waywardmonkeys waywardmonkeys deleted the update-wgpu-peniko-vello branch January 23, 2025 19:18
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