Expand description
wgpu backend for Ailloli UI: executes [ailloli_ui_runtime::DrawCmd] on the GPU.
Renderer owns a reusable GPU context, an optional native surface
attachment, text/icon caches, and stencil targets. The typical frame path is
render_layered / render_layered_scaled with one LayerPass per scene
layer (clip mode chosen via choose_clip_render_mode).
§Rendering inside an application-owned frame
Custom hosts can create resources with Renderer::device and retain control
of their image, encoder, submission, and presentation. Call
Renderer::record_layered_to_target_scaled with a BorrowedRenderTarget
after ending the host’s render pass. TargetLoadOp::Load composites the UI
over the host image; TargetLoadOp::Clear intentionally replaces it.
Finish and submit the encoder on Renderer::queue before recording another
UI frame. No 3D commands, windowing types, or application policies are added to
the retained scene protocol.
The target must be a single-sampled, full-size D2 color view on the same
device and in the renderer’s pipeline format. Backdrop blur and non-normal
blending additionally need the matching texture with COPY_SRC usage.
Ordinary UI can borrow a view alone. Descriptor checks return
TargetRecordingError; wgpu still validates actual GPU bindings.
Existing managed rendering and capture APIs retain their acquire/submit/present
behavior and their RendererError type. Borrowed recording is an additive
lower-level API, not a replacement for the ordinary ailloli_ui application
builder. See the host_composition example for a host triangle and retained
UI text recorded into the same image and command encoder.
§Modules
| Module | Role |
|---|---|
renderer | Main renderer and layer passes |
pipeline_cache | Device, surface, and pipeline bootstrap |
clip | Scissor / shader / stencil clip selection |
capture | Swapchain readback and PNG helpers |
text | Multi-page glyph atlas |
icons | Lucide, Devicon, and SVG raster cache |
plan | Lightweight per-layer command counts (bench / debug) |
Re-exports§
pub use backdrop_capture::BackdropTable;pub use capture::CaptureParams;pub use capture::CapturedFrame;pub use capture::CapturedFrameFormat;pub use clip::choose_clip_render_mode;pub use clip::resolve_clip_render_plan;pub use clip::ClipRenderMode;pub use clip::RenderClipPlan;pub use error::RendererError;pub use error::TargetRecordingError;pub use frame_plan::ClipBindKind;pub use frame_plan::FramePlanError;pub use frame_plan::FrameRenderPlan;pub use frame_plan::IsolatedPass;pub use frame_plan::PipelineKind;pub use frame_plan::PlannedBatch;pub use frame_plan::PlannedLayer;pub use frame_plan::TextureBindKind;pub use frame_prep::PreparedResources;pub use icons::rasterize_svg;pub use icons::IconKey;pub use isolated_budget::IsolatedBudgetConfig;pub use isolated_budget::IsolatedBudgetPolicy;pub use isolated_budget::IsolatedDowngradeCounts;pub use isolated_budget::IsolatedDowngradeReason;pub use isolated_plan::CompositeParams;pub use isolated_plan::IsolatedEffect;pub use isolated_plan::IsolatedEffectChain;pub use isolated_plan::OffscreenPassId;pub use isolated_plan::PlannedIsolatedPass;pub use pipeline_cache::gpu_debug_enabled;pub use pipeline_cache::ResizeOutcome;pub use pipeline_cache::SurfaceAttachment;pub use pipeline_cache::SurfaceAttachmentState;pub use pipeline_cache::SurfaceBootstrapConfig;pub use pipeline_cache::SurfaceConfigDeferredReason;pub use pipeline_cache::SurfaceContextReuseFailure;pub use pipeline_cache::SurfaceGpuContext;pub use pipeline_cache::SurfaceReattachOutcome;pub use pipeline_cache::WgpuRenderContext;pub use plan::build_render_plan;pub use plan::LayerPlan;pub use plan::RenderPlan;pub use render_target::BorrowedRenderTarget;pub use render_target::PhysicalExtent;pub use render_target::RenderFrame;pub use render_target::RenderTarget;pub use render_target::TargetLoadOp;pub use renderer::IsolatedFrameMetrics;pub use renderer::LayerPass;pub use renderer::Renderer;pub use renderer::RendererOptions;
Modules§
- backdrop_
blur - backdrop filter: backdrop blur pipeline.
backdrop filter: backdrop blur (distinct from content
run_effect_chain). - backdrop_
capture - backdrop filter: backdrop region capture from swapchain. backdrop filter: copy a region from the main framebuffer into an offscreen texture.
- capture
- Frame readback types and PNG encoding helpers. Swapchain readback, row padding, and PNG encoding for visual tests.
- clip
- GPU clip mode selection (not in
ailloli_ui_core). GPU clip rendering mode selection (not part ofailloli_ui_core). - cmd_
bounds - isolated compositor: draw-command bounds for isolated offscreen regions. Device-space bounds for draw commands (isolated compositor).
- composite_
blend - blend modes: Multiply / Screen composite shader. blend modes: shader composite (Multiply / Screen) with dst framebuffer capture.
- effect_
chain - isolated compositor: post-effect chain (blur) for isolated passes. Post-effect chain for isolated offscreen passes (isolated compositor).
- error
- Renderer and surface errors. GPU renderer errors.
- frame_
plan - single-pass compositing: CPU-pure frame render plan (vertex arenas + planned layers/batches). Frame render plan (single-pass compositing): pure CPU.
- frame_
prep - single-pass compositing: GPU-touching frame resource preparation (atlas pin, icon cache). Frame resource preparation (single-pass compositing).
- icons
- Icon rasterization and GPU texture cache. Icon rasterization (Lucide, Devicon, custom SVG) and GPU texture cache.
- isolated_
budget - isolated compositor hardening: isolated offscreen budgets and downgrade policy. isolated compositor hardening: budgets and downgrade policy for isolated offscreen compositing.
- isolated_
plan - isolated compositor: isolated pass planning types. isolated compositor: isolated offscreen pass planning (CPU pure). nested isolated compositor: parent/child DAG for nested isolated passes.
- offscreen_
pool - isolated compositor: offscreen texture pool. Reusable offscreen color / stencil textures (isolated compositor).
- passes
- CPU vertex builders and draw helpers. Render passes and CPU-side primitive builders for rects, text, and images.
- pipeline_
cache - wgpu pipelines and surface bundle. Cached render pipelines, GPU bootstrap policy, and presentation-surface state.
- plan
- Per-layer draw command statistics. Lightweight per-layer draw statistics (bench / debug).
- render_
target - Abstract render target used by host/VR entry points. Host-independent targets for managed presentation or borrowed command recording.
- renderer
- Main GPU renderer. Main GPU renderer, layer descriptions, surface lifecycle, and frame capture.
- resources
- GPU resource policies (see
pipeline_cache::WgpuSurfaceBundle). GPU resource policies (buffers, textures, atlas). Seecrate::pipeline_cache::WgpuSurfaceBundlefor bootstrap. - shaders
- WGSL shader sources. WGSL shader sources (clip + primitives), concatenated at pipeline build time.
- stencil
- Shared depth/stencil for rounded clips.
Shared depth/stencil texture for
crate::clip::ClipRenderMode::Stencilclips. - text
- Glyph atlas upload and caching. Glyph atlas and GPU upload for text rendering.
- vertices
- Vertex formats for rects, textures, and rounded rects. GPU vertex formats for solid rects, textured quads, rounded rects, and borders.