Skip to content

vello_common: Replace external guillotiere with built-in no_std-compatible port#1481

Merged
grebmeg merged 3 commits into
mainfrom
gemberg/glyph-cache-rect-allocator
Mar 4, 2026
Merged

vello_common: Replace external guillotiere with built-in no_std-compatible port#1481
grebmeg merged 3 commits into
mainfrom
gemberg/glyph-cache-rect-allocator

Conversation

@grebmeg
Copy link
Copy Markdown
Collaborator

@grebmeg grebmeg commented Feb 25, 2026

The glyph rendering path in parley_draw I've been working on depends on multi_atlas and image_cache for atlas allocation. Since guillotiere requires std (via euclid/num-traits), these modules were gated behind cfg(feature = "std"), which would force the entire glyph rendering pipeline to be std-gated as well. Porting the allocator to no_std removes this constraint and keeps the glyph rendering path available in no_std builds.

This PR imports and modifies guillotiere's tree-based guillotine algorithm directly into allocator.rs, replacing euclid types with local Size/Point/Rect equivalents and swapping std imports for core/alloc.

We discussed in one of the recent office hours that it would be fine to add the simpler shelf allocator under vello_common/. However, since my glyph caching is already based on the ability to deallocate, I thought there was no harm in continuing to use the current algorithm. I have not added this to upstream because I am not aware of the plan there or the current review capacity, but I am happy to do so if we decide that is the right approach.

@LaurenzV LaurenzV self-requested a review February 25, 2026 07:40
Base automatically changed from gemberg/glyp-cache-fixes to main February 25, 2026 23:44
@grebmeg grebmeg force-pushed the gemberg/glyph-cache-rect-allocator branch 3 times, most recently from b7d424b to 8e7f4af Compare March 3, 2026 04:51
@grebmeg
Copy link
Copy Markdown
Collaborator Author

grebmeg commented Mar 3, 2026

Hey @LaurenzV, I think I’d prefer to merge this for now, and then once servo/euclid#543 is merged and guillotiere is updated, we can switch the current usage to the official repo.

Copy link
Copy Markdown
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.

LGTM, double-checked by copy-pasting the code snippets from guillotiere and wasn't able to find any relevant discrepancies.

@grebmeg grebmeg force-pushed the gemberg/glyph-cache-rect-allocator branch from 8e7f4af to 1b9560c Compare March 4, 2026 02:14
@grebmeg grebmeg enabled auto-merge March 4, 2026 02:18
@grebmeg grebmeg added this pull request to the merge queue Mar 4, 2026
Merged via the queue into main with commit 190f5a2 Mar 4, 2026
17 checks passed
@grebmeg grebmeg deleted the gemberg/glyph-cache-rect-allocator branch March 4, 2026 02:34
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