Add opt-in glyph caching to vello_cpu and vello_hybrid backends - #116
Merged
Merged
Conversation
Adds a `glyph_caching` cargo feature (sets the default) and runtime setters to enable Vello's experimental glyph atlas cache. Runs with a skewed, rotated, mirrored or non-uniformly scaled transform always bypass the cache: glifo 0.4 only validates the transform when inserting into the atlas, not when looking up, so such runs would otherwise be drawn from upright cache entries.
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exposes Vello's (experimental) glyph atlas cache in
anyrender_vello_hybridandanyrender_vello_cpu. Off by default.VelloHybridRendererOptions::glyph_caching(bool)(+ public field),VelloHybridScenePainter::with_glyph_caching(bool),WebGlScenePainter::with_glyph_caching(bool)VelloCpuScenePainter::set_glyph_caching(bool),VelloCpuImageRenderer::set_glyph_caching(bool).VelloCpuWindowRendereris a generic softbuffer/pixels wrapper with no options hook, so caching can't be enabled there..atlas_cache(enabled)on theglyph_runbuilder, plus a guard (below).Note:
VelloHybridRendererOptionsgains a public field, which is breaking for anyone building it with a struct literal.Skewed/rotated runs bypass the cache
glifo0.4 only validates the transform when inserting a glyph into the atlas (supports_atlas_caching), not on lookup, and the cache key doesn't include skew/rotation. So once an upright glyph is cached, a skewed run (e.g. synthetic italics) with the same font/size is drawn from the upright entry.supports_glyph_cachingtherefore disables the atlas for any run whosetransform * glyph_transformisn't a positive uniform scale + translation.tests/glyph_caching.rs(vello_cpu) covers this: it fails (2525 px differing by >64) with the guard removed.Performance
Blitz
paint_benchon https://en.wikipedia.org/wiki/Barack_Obama, 1366x768 @2x, 100 frames per run, 3 interleaved runs per cell. Times are the median µs/frame. "scroll 40" moves the viewport 40 CSS px every frame.macOS, Metal (macOS 26.5.2 VM, "Apple M4 Pro (Virtual)", 12 cores, wgpu adapter
Apple Paravirtual device). This is a GPU-backed Metal device but paravirtualised, not bare metal. Values are run1 / run2 / run3.paint_scene)Linux, no GPU (8 cores; "hybrid" runs on Mesa software Vulkan, so its rasterize column is CPU-emulated and not representative). Values are min–max over the 3 runs.
paint_scene)Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/9fbb960ba27249bca490d138236e0bd1
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/9fbb960ba27249bca490d138236e0bd1?variant=devin-insiders
Requested by: @nicoburns