Skip to main content

Renderer

Struct Renderer 

Source
pub struct Renderer { /* private fields */ }
Expand description

Unified single-backend rendering facade orchestrating lazy Software, Hardware, and Hybrid execution.

Implementations§

Source§

impl Renderer

Single-backend pipeline construction, live mode switching, and frame rendering for Renderer.

Source

pub fn new( platform: PlatformKind, capabilities: PlatformCapabilities, width: u32, height: u32, config: RenderConfig, ) -> Self

Creates a Renderer instantiating strictly ONE active backend for platform and config.

§Arguments
  • PlatformKind - Active execution platform.
  • PlatformCapabilities - Hardware capabilities reported by the platform backend.
  • u32 - Initial physical width.
  • u32 - Initial physical height.
  • RenderConfig - Requested rendering configuration.
§Returns
  • Self - Initialized single-backend renderer facade with zero eager fallback allocation.
Source

pub fn with_display_hz( platform: PlatformKind, capabilities: PlatformCapabilities, width: u32, height: u32, config: RenderConfig, display_refresh_hz: f32, ) -> Self

Creates a Renderer bound to live display_refresh_hz and instantiating strictly ONE active backend.

§Arguments
  • PlatformKind - Active execution platform.
  • PlatformCapabilities - Hardware capabilities reported by the platform backend.
  • u32 - Initial physical width.
  • u32 - Initial physical height.
  • RenderConfig - Requested rendering configuration.
  • f32 - Live native display refresh rate in Hertz.
§Returns
  • Self - Initialized single-backend renderer facade.
Source

pub fn active_backend_ref(&self) -> &ActiveRenderBackend

Returns an immutable reference to the single active rendering backend enum.

§Arguments
  • &Self - Renderer reference.
§Returns
  • &ActiveRenderBackend - Active backend variant.
Source

pub fn software(&self) -> Option<&SoftwareRenderer>

Returns a reference to the active or lazily-instantiated SoftwareRenderer, if one exists.

§Arguments
  • &Self - Renderer reference.
§Returns
  • Option<&SoftwareRenderer> - Software renderer reference when active or lazily allocated.
Source

pub fn hardware(&self) -> Option<&HardwareRenderer>

Returns a reference to the active HardwareRenderer when hardware mode is active.

§Arguments
  • &Self - Renderer reference.
§Returns
  • Option<&HardwareRenderer> - Active hardware renderer, or None when inactive.
Source

pub fn hybrid(&self) -> Option<&HybridRenderer>

Returns a reference to the active HybridRenderer when hybrid mode is active.

§Arguments
  • &Self - Renderer reference.
§Returns
  • Option<&HybridRenderer> - Active hybrid renderer, or None when inactive.
Source

pub fn has_fallback_software(&self) -> bool

Returns true when the lazy CPU fallback SoftwareRenderer has been instantiated.

§Arguments
  • &Self - Renderer reference.
§Returns
  • bool - Whether fallback_software is currently allocated.
Source

pub fn allocated_cpu_framebuffer_bytes(&self) -> usize

Returns total CPU RGBA8 framebuffer bytes currently allocated across active and fallback renderers (0 in GPU direct-draw mode).

§Arguments
  • &Self - Renderer reference.
§Returns
  • usize - Total allocated CPU framebuffer pixel bytes.
Source

pub fn get_mut_software(&mut self) -> &mut SoftwareRenderer

Returns a mutable reference to the active software renderer, lazily instantiating fallback_software only when in hardware mode.

§Arguments
  • &Self - Mutable renderer.
§Returns
  • &mut SoftwareRenderer - Mutable software renderer reference.
Source

pub fn set_timing_telemetry_enabled(&mut self, enabled: bool)

Updates whether timing instrumentation (Instant::now) is active inside software band scheduling.

§Arguments
  • &Self - Mutable renderer.
  • bool - true to enable per-dispatch microsecond timing instrumentation.
Source

pub fn set_high_frequency_active(&mut self, active: bool)

Updates adaptive worker-pool spin behavior for active animation/scroll vs idle periods.

§Arguments
  • &Self - Mutable renderer.
  • bool - true during active animation or scrolling; false when idle to drop worker spin to 0.
Source

pub fn set_direct_gpu_present(&mut self, enabled: bool)

Enables or disables direct GPU rendering without steady-state CPU RGBA readback mirroring.

§Arguments
  • &Self - Mutable renderer.
  • bool - true for GPU direct-draw (zero CPU RGBA mirror); false to enable software readback mirror.
Source

pub fn set_display_refresh_rate_hz(&mut self, display_refresh_hz: f32)

Synchronizes the fallback policy engine with the active native display refresh rate in Hertz.

§Arguments
  • &Self - Mutable renderer.
  • f32 - Active display refresh rate in Hertz.
Source

pub fn adaptive_router_snapshot(&self) -> AdaptiveRouterSnapshot

Returns a compact serializable telemetry snapshot of the active AdaptiveRenderRouter.

§Arguments
  • &Self - Renderer reference.
§Returns
  • AdaptiveRouterSnapshot - Current adaptive router and handoff snapshot.
Source

pub fn adaptive_switch_mode(&self) -> AdaptiveSwitchMode

Returns the active rollout switch mode (RecommendOnly vs AutoSwitch) on AdaptiveRenderRouter.

§Arguments
  • &Self - Renderer reference.
§Returns
  • AdaptiveSwitchMode - Active rollout switch policy.
Source

pub fn set_adaptive_switch_mode(&mut self, mode: AdaptiveSwitchMode)

Updates the rollout switch mode (RecommendOnly vs AutoSwitch) on both RenderConfig and the live AdaptiveRenderRouter.

§Arguments
  • &Self - Mutable renderer reference.
  • AdaptiveSwitchMode - Requested rollout switch policy.
Source

pub fn adaptive_frame_metrics(&self) -> AdaptiveFrameMetrics

Returns the most recent truthful AdaptiveFrameMetrics snapshot synchronized with the live router state.

§Arguments
  • &Self - Renderer reference.
§Returns
  • AdaptiveFrameMetrics - Truthful per-frame adaptive observability snapshot.
Source

pub fn apply_adaptive_candidate( &mut self, platform: PlatformKind, capabilities: PlatformCapabilities, candidate: RenderBackendCandidate, )

Applies an adaptive candidate selection to the active pipeline, aligning direct_gpu_present strictly with GPU-first selection.

§Arguments
  • &Self - Mutable renderer reference.
  • PlatformKind - Active platform kind.
  • PlatformCapabilities - Host hardware capabilities.
  • RenderBackendCandidate - Candidate backend to activate.
Source

pub fn semantics_contract(&self, scale_factor: f32) -> RenderSemanticsContract

Captures the active visual semantics contract verifying zero quality degradation across fallback transitions.

§Arguments
  • &Self - Renderer reference.
  • f32 - Active display scale factor.
§Returns
  • RenderSemanticsContract - Immutable visual fidelity snapshot.
Source

pub fn capture_reference_framebuffer( &mut self, damage: DamageRegion, ) -> &Framebuffer

Captures an on-demand CPU reference framebuffer for pixel-parity verification even while direct GPU draw is enabled.

§Arguments
  • &Self - Mutable renderer.
  • DamageRegion - Damage region to rasterize into the reference framebuffer.
§Returns
  • &Framebuffer - Rendered full-fidelity CPU reference RGBA8 framebuffer.
Source

pub fn apply_fallback_trigger( &mut self, trigger: FallbackTrigger, now_ms: u64, ) -> FallbackAction

Evaluates trigger through FallbackPolicyEngine and applies strictly non-degrading cache trimming or CPU reference switching.

§Arguments
  • &Self - Mutable renderer.
  • FallbackTrigger - Runtime pressure, frame overrun, or GPU fault trigger.
  • u64 - Monotonic clock timestamp in milliseconds.
§Returns
  • FallbackAction - Strictly non-degrading action applied.
Source

pub fn resolve_mode_and_backend( platform: PlatformKind, capabilities: PlatformCapabilities, config: RenderConfig, ) -> (RenderMode, GraphicsBackend)

Resolves (RenderMode, GraphicsBackend) deterministically from platform capabilities and user preference.

§Arguments
  • PlatformKind - Target platform.
  • PlatformCapabilities - Hardware support flags.
  • RenderConfig - User configuration.
§Returns
  • (RenderMode, GraphicsBackend) - Concrete resolved mode and backend.
Source

pub fn switch_mode( &mut self, platform: PlatformKind, capabilities: PlatformCapabilities, mode: RenderMode, )

Dynamically switches the active rendering mode at runtime, instantiating only the target backend and transferring the shared glyph atlas.

§Arguments
  • &Self - Mutable renderer.
  • PlatformKind - Active platform kind.
  • PlatformCapabilities - Platform hardware capabilities.
  • RenderMode - Target render mode.
Source

pub fn render_frame( &mut self, tree: &SceneTree, viewport: Size, scale_factor: f32, clear_color: Color, layout_stats: LayoutStats, damage: DamageRegion, ) -> Result<FrameStats, PlatformError>

Compiles tree into a DisplayList, executes the active render backend, and returns FrameStats.

§Arguments
  • &Self - Mutable renderer.
  • &SceneTree - Laid-out scene tree.
  • Size - Logical viewport dimensions.
  • f32 - Active DPI scale factor.
  • Color - Surface clear color.
  • LayoutStats - Telemetry from the layout pass.
  • DamageRegion - Damaged screen region.
§Returns
  • Result<FrameStats, PlatformError> - Frame performance and pixel-hash telemetry.
Source

pub fn render_frame_composite_aware( &mut self, tree: &SceneTree, params: &FrameRenderParams, composite_only: bool, ) -> Result<FrameStats, PlatformError>

Compiles tree into a DisplayList, honoring composite-only fast paths and non-degrading CPU reference fallback on unsupported GPU effects.

§Arguments
  • &Self - Mutable renderer.
  • &SceneTree - Laid-out scene tree.
  • &FrameRenderParams - Viewport, DPI, clear color, layout stats, and damage bundle.
  • bool - Whether only composite/scroll properties changed with zero layout or paint mutations.
§Returns
  • Result<FrameStats, PlatformError> - Frame performance, direct-draw, fallback, and pixel-hash telemetry.
Source

pub fn render_with( &mut self, tree: &SceneTree, params: &FrameRenderParams, ) -> Result<FrameStats, PlatformError>

Renders tree using a compact FrameRenderParams descriptor and returns FrameStats.

§Arguments
  • &Self - Mutable renderer.
  • &SceneTree - Laid-out scene tree.
  • &FrameRenderParams - Viewport, DPI, clear color, layout stats, and damage bundle.
§Returns
  • Result<FrameStats, PlatformError> - Frame performance and pixel-hash telemetry.
Source

pub fn record_skipped_frame(&mut self) -> FrameStats

Advances the frame counter for an undamaged idle frame without rasterizing or hashing pixels and drops worker spin to 0.

§Arguments
  • &Self - Mutable renderer.
§Returns
  • FrameStats - Lightweight telemetry preserving the last rendered frame_hash with zero shaded pixels.
Source

pub fn paint_fragment_cache_stats(&self) -> (u64, u64, u64, u64)

Returns cumulative cross-frame PaintFragmentCache telemetry (whole_list_hits, fragment_hits, fragment_misses, fragment_evictions).

§Arguments
  • &Self - Renderer reference.
§Returns
  • (u64, u64, u64, u64) - Tuple of whole-list hits, fragment hits, misses, and evictions.
Source

pub fn framebuffer(&self) -> Option<&Framebuffer>

Returns a reference to the latest CPU-accessible Framebuffer for software/hybrid/readback presentation (None when GPU direct-draw is active with 0 CPU FB bytes).

§Arguments
  • &Self - Renderer reference.
§Returns
  • Option<&Framebuffer> - Active RGBA8 framebuffer if resident in host memory.
Source§

impl Renderer

Source

pub fn get_config(&self) -> RenderConfig

Source

pub fn get_mut_config(&mut self) -> &mut RenderConfig

Source

pub fn set_config(&mut self, val: RenderConfig) -> &mut Self

Source

pub fn get_active_mode(&self) -> RenderMode

Source

pub fn get_mut_active_mode(&mut self) -> &mut RenderMode

Source

pub fn set_active_mode(&mut self, val: RenderMode) -> &mut Self

Source

pub fn get_active_backend(&self) -> GraphicsBackend

Source

pub fn get_mut_active_backend(&mut self) -> &mut GraphicsBackend

Source

pub fn set_active_backend(&mut self, val: GraphicsBackend) -> &mut Self

Source

pub fn get_font_service(&self) -> &FontAtlasService

Source

pub fn get_mut_font_service(&mut self) -> &mut FontAtlasService

Source

pub fn set_font_service(&mut self, val: FontAtlasService) -> &mut Self

Source

pub fn get_surface_width(&self) -> u32

Source

pub fn get_surface_height(&self) -> u32

Source

pub fn get_display_list(&self) -> &DisplayList

Source

pub fn get_mut_display_list(&mut self) -> &mut DisplayList

Source

pub fn set_display_list(&mut self, val: DisplayList) -> &mut Self

Source

pub fn get_frame_index(&self) -> u64

Source

pub fn get_mut_frame_index(&mut self) -> &mut u64

Source

pub fn set_frame_index(&mut self, val: u64) -> &mut Self

Source

pub fn get_compute_pixel_hash(&self) -> bool

Source

pub fn get_mut_compute_pixel_hash(&mut self) -> &mut bool

Source

pub fn set_compute_pixel_hash(&mut self, val: bool) -> &mut Self

Source

pub fn get_telemetry_enabled(&self) -> bool

Source

pub fn get_mut_telemetry_enabled(&mut self) -> &mut bool

Source

pub fn set_telemetry_enabled(&mut self, val: bool) -> &mut Self

Source

pub fn get_last_stats(&self) -> FrameStats

Source

pub fn get_mut_last_stats(&mut self) -> &mut FrameStats

Source

pub fn set_last_stats(&mut self, val: FrameStats) -> &mut Self

Source

pub fn get_fallback_policy(&self) -> &FallbackPolicyEngine

Source

pub fn get_mut_fallback_policy(&mut self) -> &mut FallbackPolicyEngine

Source

pub fn set_fallback_policy(&mut self, val: FallbackPolicyEngine) -> &mut Self

Source

pub fn get_composite_fast_path_frames(&self) -> u64

Source

pub fn get_cpu_fallback_frames(&self) -> u64

Source

pub fn get_adaptive_router(&self) -> &AdaptiveRenderRouter

Source

pub fn get_mut_adaptive_router(&mut self) -> &mut AdaptiveRenderRouter

Source

pub fn set_adaptive_router(&mut self, val: AdaptiveRenderRouter) -> &mut Self

Source

pub fn get_last_adaptive_metrics(&self) -> AdaptiveFrameMetrics

Source

pub fn get_mut_last_adaptive_metrics(&mut self) -> &mut AdaptiveFrameMetrics

Source

pub fn set_last_adaptive_metrics( &mut self, val: AdaptiveFrameMetrics, ) -> &mut Self

Trait Implementations§

Source§

impl Debug for Renderer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Renderer

§

impl Freeze for Renderer

§

impl Move for Renderer

§

impl RefUnwindSafe for Renderer

§

impl Send for Renderer
where BoxRaw<SoftwareRenderer>: Send, BoxRaw<HardwareRenderer>: Send, BoxRaw<HybridRenderer>: Send, RawVecInner: Send, Arc<[u8]>: Send, Arc<Vec<u8>>: Send, RawTable<(WinnerCacheKey, WinnerCacheEntry)>: Send, &'static str: Send,

§

impl Sync for Renderer
where BoxRaw<SoftwareRenderer>: Sync, BoxRaw<HardwareRenderer>: Sync, BoxRaw<HybridRenderer>: Sync, RawVecInner: Sync, Arc<[u8]>: Sync, Arc<Vec<u8>>: Sync, RawTable<(WinnerCacheKey, WinnerCacheEntry)>: Sync,

§

impl Unpin for Renderer

§

impl UnsafeUnpin for Renderer

§

impl UnwindSafe for Renderer

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.