Skip to content

vello_hybrid: Add render_to_atlas and write_to_atlas APIs for glyph caching#1458

Open
grebmeg wants to merge 1 commit intomainfrom
gemberg/glyph-cache-hybrid-support
Open

vello_hybrid: Add render_to_atlas and write_to_atlas APIs for glyph caching#1458
grebmeg wants to merge 1 commit intomainfrom
gemberg/glyph-cache-hybrid-support

Conversation

@grebmeg
Copy link
Collaborator

@grebmeg grebmeg commented Feb 19, 2026

Adds public APIs to both the wgpu and webgl renderers for rendering Scene content directly into atlas layers and writing pixel data to pre-allocated atlas regions. This enables a glyph caching workflow where vector glyphs are rasterized into the atlas once and reused as cached images in subsequent passes.

The key additions are render_to_atlas, which runs the scheduler targeting a specific atlas layer (using a placeholder dummy texture to avoid read-write hazards), and write_to_atlas, extracted from upload_image, which writes pixel data to an already-allocated region.

@grebmeg grebmeg force-pushed the gemberg/glyph-cache-hybrid-support branch from ddb4221 to 1ece907 Compare February 19, 2026 06:30
@LaurenzV
Copy link
Collaborator

Hmm... What I did is to change add an OutputTarget that either refers to the final view or an intermediate texture (

/// The output target for the final composite draw in a round.
///
/// This distinguishes between rendering to the user-visible surface and
/// rendering to an intermediate texture for a filter layer.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum OutputTarget {
/// Render to the final output view/surface.
FinalView,
/// Render to an intermediate texture for a layer with filter effects.
IntermediateTexture(LayerId),
}
/// Specifies the target for a render pass.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum RenderTarget {
/// Render to the final output or an intermediate texture.
Output(OutputTarget),
/// Render to one of the slot textures used for clipping/blending.
SlotTexture(u8),
}
), and then the selection can happen at runtime instead of having to duplicate the whole render method, would that work for you? Otherwise, seems fine at a glance, but it might be worth extracting all of the setup stuff (e.g. for encoded paints) into a wrapper function that does setup/teardown and takes a closure for the "main action". What do you think?

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

Comments