pub struct PreparedResources {
pub glyphs: HashMap<GlyphKey, (u8, Glyph)>,
pub icons: HashSet<IconKey>,
}Expand description
Resources pinned / allocated for the upcoming frame.
glyphs: every glyph requested by anyDrawCmd::Textin the frame’s layers, looked up (or rasterized + uploaded) and pinned in the text atlas for the duration of the frame.icons: every icon requested by anyDrawCmd::Image, materialized in the icon cache (bind group + texture).
build_cpu later reads these maps to emit PlannedBatches with the
correct TextureBindKind.
§Examples
use ailloli_ui_render_wgpu::PreparedResources;
let prepared = PreparedResources::default();
assert!(prepared.glyphs.is_empty() && prepared.icons.is_empty());Fields§
§glyphs: HashMap<GlyphKey, (u8, Glyph)>Pinned glyphs keyed by face, glyph, physical size, and DPR bucket.
Each value is (atlas_page, glyph_metrics).
icons: HashSet<IconKey>Exact icon keys uploaded or found in the persistent icon cache.
Implementations§
Source§impl PreparedResources
impl PreparedResources
Sourcepub fn prepare(
layers: &[LayerPass<'_>],
scale: Scale,
atlas: &mut TextAtlas,
icon_cache: &mut IconCache,
device: &Device,
queue: &Queue,
texture_bind_group_layout: &BindGroupLayout,
face_blobs: &HashMap<u64, Arc<[u8]>>,
) -> Self
pub fn prepare( layers: &[LayerPass<'_>], scale: Scale, atlas: &mut TextAtlas, icon_cache: &mut IconCache, device: &Device, queue: &Queue, texture_bind_group_layout: &BindGroupLayout, face_blobs: &HashMap<u64, Arc<[u8]>>, ) -> Self
Walks layers and prepares atlas glyphs + icon cache entries.
Touches device, queue, atlas and icon_cache. Callers must have
already called atlas.start_frame() (Renderer keeps this contract).
Physical glyph sizes are rounded and clamped to 8..=128; icon sizes to
8..=256; the DPR bucket is round(dpr * 100) clamped to
1..=u16::MAX. Missing face blobs increment atlas diagnostics and omit
that glyph rather than panicking.
§Examples
use std::{collections::HashMap, sync::Arc};
use ailloli_ui_core::math::Scale;
use ailloli_ui_render_wgpu::{frame_prep::PreparedResources,
icons::IconCache, text::TextAtlas};
fn prepare(atlas: &mut TextAtlas, icons: &mut IconCache,
device: &wgpu::Device, queue: &wgpu::Queue,
layout: &wgpu::BindGroupLayout) -> PreparedResources {
atlas.start_frame();
let faces: HashMap<u64, Arc<[u8]>> = HashMap::new();
PreparedResources::prepare(&[], Scale::new(1.0), atlas, icons,
device, queue, layout, &faces)
}Trait Implementations§
Source§impl Debug for PreparedResources
impl Debug for PreparedResources
Source§impl Default for PreparedResources
impl Default for PreparedResources
Source§fn default() -> PreparedResources
fn default() -> PreparedResources
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PreparedResources
impl RefUnwindSafe for PreparedResources
impl Send for PreparedResources
impl Sync for PreparedResources
impl Unpin for PreparedResources
impl UnwindSafe for PreparedResources
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().