euv-core 0.48.3

Core cross-platform runtime for euv featuring arena-based fine-grained reactivity, deterministic layout, flat scene graph, multi-mode rendering, and direct OS platform adapters.
Documentation
use super::*;

/// Shared font provider, glyph coverage atlas, and text shaping service reused across active and fallback backends.
#[derive(Clone, Data, Debug, Default)]
pub struct FontAtlasService {
    /// Active native OS or deterministic font provider.
    pub(crate) font_provider: NativeSystemFont,
    /// Shared glyph coverage atlas transferred to fallback or switched backends without 3x duplication.
    pub(crate) glyph_atlas: GlyphAtlas,
    /// Shared DPI-independent text shaping and line-break cache.
    pub(crate) text_shaping_cache: TextShapingCache,
}

/// Fluent per-frame parameter bundle for `Renderer::render_with`.
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct FrameRenderParams {
    /// Logical viewport size.
    #[get(type(copy))]
    pub(crate) viewport: Size,
    /// Active physical DPI scale factor.
    #[get(type(copy))]
    pub(crate) scale_factor: f32,
    /// Surface background clear color.
    #[get(type(copy))]
    pub(crate) clear_color: Color,
    /// Layout pass telemetry from the current frame.
    #[get(type(copy))]
    pub(crate) layout_stats: LayoutStats,
    /// Damaged screen region requiring rasterization.
    #[get(type(copy))]
    pub(crate) damage: DamageRegion,
}

/// Unified single-backend rendering facade orchestrating lazy Software, Hardware, and Hybrid execution.
#[derive(Data, Debug)]
pub struct Renderer {
    /// Active render configuration.
    #[get(type(copy))]
    pub(crate) config: RenderConfig,
    /// Resolved active render mode (never `Auto`).
    #[get(type(copy))]
    pub(crate) active_mode: RenderMode,
    /// Resolved active graphics backend.
    #[get(type(copy))]
    pub(crate) active_backend: GraphicsBackend,
    /// Strictly single active rendering backend instantiated for the resolved mode.
    #[get(skip)]
    #[get_mut(skip)]
    #[set(skip)]
    pub(crate) active_backend_impl: ActiveRenderBackend,
    /// Lazily allocated CPU reference software fallback instantiated only on fallback or reference readback.
    #[get(skip)]
    #[get_mut(skip)]
    #[set(skip)]
    pub(crate) fallback_software: Option<Box<SoftwareRenderer>>,
    /// Single shared font provider, glyph atlas, and text shaping service across all render paths.
    pub(crate) font_service: FontAtlasService,
    /// Tracked physical surface width in pixels for lazy backend instantiation.
    #[get(type(copy))]
    #[get_mut(skip)]
    #[set(pub(crate))]
    pub(crate) surface_width: u32,
    /// Tracked physical surface height in pixels for lazy backend instantiation.
    #[get(type(copy))]
    #[get_mut(skip)]
    #[set(pub(crate))]
    pub(crate) surface_height: u32,
    /// Reusable scene-to-display-list compiler handle.
    #[get(skip)]
    #[get_mut(skip)]
    #[set(skip)]
    pub(crate) paint_pass: PaintPass,
    /// Cross-frame retained `DisplayList` and subtree `DrawCommand` fragment cache.
    #[get(pub(crate))]
    #[get_mut(skip)]
    #[set(skip)]
    pub(crate) paint_fragment_cache: PaintFragmentCache,
    /// Reusable frame display list.
    pub(crate) display_list: DisplayList,
    /// Monotonic frame counter.
    #[get(type(copy))]
    pub(crate) frame_index: u64,
    /// Whether to compute full-framebuffer FNV-1a pixel hashes on each frame (enabled for headless parity tests).
    #[get(type(copy))]
    pub(crate) compute_pixel_hash: bool,
    /// Whether per-frame timing instrumentation (`Instant::now`) is active inside software band scheduling.
    #[get(type(copy))]
    pub(crate) telemetry_enabled: bool,
    /// Active render mode of the most recent hashed frame (`None` before first render or after mode switch).
    #[get(skip)]
    #[get_mut(skip)]
    #[set(skip)]
    pub(crate) last_hashed_mode: Option<RenderMode>,
    /// Physical framebuffer dimensions `(phys_w, phys_h)` of the most recent hashed frame.
    #[get(skip)]
    #[get_mut(skip)]
    #[set(skip)]
    pub(crate) last_hashed_dims: (u32, u32),
    /// Telemetry from the most recent frame.
    #[get(type(copy))]
    pub(crate) last_stats: FrameStats,
    /// Non-degrading runtime fallback policy engine (never downgrades shadows, blur, AA, clipping, or resolution).
    pub(crate) fallback_policy: FallbackPolicyEngine,
    /// Cumulative frames executed via the composite-only fast path without relayout or full repaint.
    #[get(type(copy))]
    #[get_mut(skip)]
    #[set(skip)]
    pub(crate) composite_fast_path_frames: u64,
    /// Cumulative frames routed to full CPU reference rasterization by `FallbackPolicyEngine`.
    #[get(type(copy))]
    #[get_mut(skip)]
    #[set(skip)]
    pub(crate) cpu_fallback_frames: u64,
    /// Unified 5-stage adaptive render router governing startup cache, probing, selection, handoff, and faults.
    pub(crate) adaptive_router: AdaptiveRenderRouter,
    /// Truthful per-frame observability snapshot from the most recent rendered or skipped frame.
    #[get(type(copy))]
    pub(crate) last_adaptive_metrics: AdaptiveFrameMetrics,
}