Skip to content

vello_cpu: Support custom atlas size#1658

Open
fundon wants to merge 16 commits into
linebender:mainfrom
fundon:vello_cpu_supports_custom_atlas_size
Open

vello_cpu: Support custom atlas size#1658
fundon wants to merge 16 commits into
linebender:mainfrom
fundon:vello_cpu_supports_custom_atlas_size

Conversation

@fundon

@fundon fundon commented May 18, 2026

Copy link
Copy Markdown
  • Add ImageCache into Resources, so the atlas size can be customized
  • Expose image_cache pixmaps glyph_atlas_mut methods, users can read glyphs
  • Simplify the initialization of GlyphCacheKey

@fundon
fundon force-pushed the vello_cpu_supports_custom_atlas_size branch 2 times, most recently from 324bc59 to 0820789 Compare May 18, 2026 20:19
@LaurenzV

Copy link
Copy Markdown
Collaborator

I can get behind configuring the atlas size, but not why you want to expose before_render/after_render? This is supposed to be abstracted away from the user.

@LaurenzV

LaurenzV commented May 18, 2026

Copy link
Copy Markdown
Collaborator

Oh, I see now this is in parley… I believe this is still using an older version of vello CPU, so the code hasn’t been updated yet. It should be possible to remove all of this.

@fundon

fundon commented May 18, 2026

Copy link
Copy Markdown
Author

Another scenario is that after rendering, we can pass atlas.get(glyph_key), and then we can upload the atlas to our custom GPU texture.

@fundon
fundon force-pushed the vello_cpu_supports_custom_atlas_size branch 2 times, most recently from dd48b07 to 384f82f Compare May 19, 2026 07:29
@fundon

fundon commented May 19, 2026

Copy link
Copy Markdown
Author

It should be possible to remove all of this.

I hope there is a more concise way. After rendering, cache it into GlyphAtlas, and subsequent users can easily obtain data from GlyphAtlas::get.

@fundon
fundon force-pushed the vello_cpu_supports_custom_atlas_size branch 2 times, most recently from 67bc973 to e9bd487 Compare May 19, 2026 09:00

@LaurenzV LaurenzV left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM overall.

Comment thread sparse_strips/vello_cpu/src/render.rs Outdated
@LaurenzV

Copy link
Copy Markdown
Collaborator

By the way, I do want to warn you that the atlas caching API is still experimental and not meant for production use yet. While it seems to work, there are still a number of issues to resolve, especially around performance when zooming.

@fundon
fundon force-pushed the vello_cpu_supports_custom_atlas_size branch from e9bd487 to aa109c3 Compare May 19, 2026 18:40
@fundon

fundon commented May 19, 2026

Copy link
Copy Markdown
Author

By the way, I do want to warn you that the atlas caching API is still experimental and not meant for production use yet. While it seems to work, there are still a number of issues to resolve, especially around performance when zooming.

Ok. I'll give feedback if there are any problems. Thanks.

@LaurenzV
LaurenzV self-requested a review May 21, 2026 07:51
@fundon
fundon marked this pull request as draft May 21, 2026 16:55
@fundon
fundon force-pushed the vello_cpu_supports_custom_atlas_size branch 4 times, most recently from 2256be9 to 16723f9 Compare May 27, 2026 13:38
@fundon
fundon force-pushed the vello_cpu_supports_custom_atlas_size branch from 16723f9 to f18bb11 Compare June 2, 2026 00:51
@fundon
fundon force-pushed the vello_cpu_supports_custom_atlas_size branch 6 times, most recently from 448e213 to 46d3984 Compare June 19, 2026 02:42
@fundon
fundon force-pushed the vello_cpu_supports_custom_atlas_size branch 2 times, most recently from d41b96b to 582652b Compare June 27, 2026 09:49
@fundon
fundon force-pushed the vello_cpu_supports_custom_atlas_size branch from 8001702 to 93ff81c Compare July 11, 2026 08:54
Comment thread glifo/src/atlas/cache.rs
///
/// This is used when `vello_cpu` renders a large amount of text to prevent
/// the new image from overwriting stale content from the previous one.
pub fn clear_tick(&mut self) {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Is there a better way to avoid this situation?

@fundon
fundon marked this pull request as ready for review July 11, 2026 09:09
Comment thread glifo/src/atlas/key.rs
)]
#[inline]
fn quantize_subpixel(frac: f32) -> u8 {
pub fn quantize_subpixel(frac: f32) -> u8 {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Expose this method, so we can create keys freely outside of glifo.

impl Resources {
pub(crate) fn prepare_glyph_cache(&mut self, render_mode: RenderMode) {
/// Prepares the glyph cache.
pub fn prepare_glyph_cache(&mut self, render_mode: RenderMode) {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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