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.
impl Renderer
Single-backend pipeline construction, live mode switching, and frame rendering for Renderer.
Sourcepub fn new(
platform: PlatformKind,
capabilities: PlatformCapabilities,
width: u32,
height: u32,
config: RenderConfig,
) -> Self
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.
Sourcepub fn with_display_hz(
platform: PlatformKind,
capabilities: PlatformCapabilities,
width: u32,
height: u32,
config: RenderConfig,
display_refresh_hz: f32,
) -> Self
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.
Sourcepub fn active_backend_ref(&self) -> &ActiveRenderBackend
pub fn active_backend_ref(&self) -> &ActiveRenderBackend
Sourcepub fn software(&self) -> Option<&SoftwareRenderer>
pub fn software(&self) -> Option<&SoftwareRenderer>
Sourcepub fn hardware(&self) -> Option<&HardwareRenderer>
pub fn hardware(&self) -> Option<&HardwareRenderer>
Sourcepub fn hybrid(&self) -> Option<&HybridRenderer>
pub fn hybrid(&self) -> Option<&HybridRenderer>
Sourcepub fn has_fallback_software(&self) -> bool
pub fn has_fallback_software(&self) -> bool
Sourcepub fn allocated_cpu_framebuffer_bytes(&self) -> usize
pub fn allocated_cpu_framebuffer_bytes(&self) -> usize
Sourcepub fn get_mut_software(&mut self) -> &mut SoftwareRenderer
pub fn get_mut_software(&mut self) -> &mut SoftwareRenderer
Sourcepub fn set_timing_telemetry_enabled(&mut self, enabled: bool)
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-trueto enable per-dispatch microsecond timing instrumentation.
Sourcepub fn set_high_frequency_active(&mut self, active: bool)
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-trueduring active animation or scrolling;falsewhen idle to drop worker spin to0.
Sourcepub fn set_direct_gpu_present(&mut self, enabled: bool)
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-truefor GPU direct-draw (zero CPU RGBA mirror);falseto enable software readback mirror.
Sourcepub fn set_display_refresh_rate_hz(&mut self, display_refresh_hz: f32)
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.
Sourcepub fn adaptive_router_snapshot(&self) -> AdaptiveRouterSnapshot
pub fn adaptive_router_snapshot(&self) -> AdaptiveRouterSnapshot
Sourcepub fn adaptive_switch_mode(&self) -> AdaptiveSwitchMode
pub fn adaptive_switch_mode(&self) -> AdaptiveSwitchMode
Sourcepub fn set_adaptive_switch_mode(&mut self, mode: AdaptiveSwitchMode)
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.
Sourcepub fn adaptive_frame_metrics(&self) -> AdaptiveFrameMetrics
pub fn adaptive_frame_metrics(&self) -> AdaptiveFrameMetrics
Sourcepub fn apply_adaptive_candidate(
&mut self,
platform: PlatformKind,
capabilities: PlatformCapabilities,
candidate: RenderBackendCandidate,
)
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.
Sourcepub fn semantics_contract(&self, scale_factor: f32) -> RenderSemanticsContract
pub fn semantics_contract(&self, scale_factor: f32) -> RenderSemanticsContract
Sourcepub fn capture_reference_framebuffer(
&mut self,
damage: DamageRegion,
) -> &Framebuffer
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.
Sourcepub fn apply_fallback_trigger(
&mut self,
trigger: FallbackTrigger,
now_ms: u64,
) -> FallbackAction
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.
Sourcepub fn resolve_mode_and_backend(
platform: PlatformKind,
capabilities: PlatformCapabilities,
config: RenderConfig,
) -> (RenderMode, GraphicsBackend)
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.
Sourcepub fn switch_mode(
&mut self,
platform: PlatformKind,
capabilities: PlatformCapabilities,
mode: RenderMode,
)
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.
Sourcepub fn render_frame(
&mut self,
tree: &SceneTree,
viewport: Size,
scale_factor: f32,
clear_color: Color,
layout_stats: LayoutStats,
damage: DamageRegion,
) -> Result<FrameStats, PlatformError>
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.
Sourcepub fn render_frame_composite_aware(
&mut self,
tree: &SceneTree,
params: &FrameRenderParams,
composite_only: bool,
) -> Result<FrameStats, PlatformError>
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.
Sourcepub fn render_with(
&mut self,
tree: &SceneTree,
params: &FrameRenderParams,
) -> Result<FrameStats, PlatformError>
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.