Skip to main content

euv_core/render/config/
struct.rs

1use super::*;
2
3/// Complete rendering pipeline configuration shared across all 7 platforms.
4#[derive(Clone, Copy, Data, Debug, Eq, Hash, PartialEq)]
5pub struct RenderConfig {
6    /// Requested rendering mode (`Auto`, `Software`, `Hardware`, `Hybrid`).
7    #[get(type(copy))]
8    pub(crate) mode: RenderMode,
9    /// Optional explicit graphics backend override.
10    #[get(skip)]
11    pub(crate) preferred_backend: Option<GraphicsBackend>,
12    /// Swapchain synchronization mode.
13    #[get(type(copy))]
14    pub(crate) present_mode: PresentMode,
15    /// Anti-aliasing mode.
16    #[get(type(copy))]
17    pub(crate) antialiasing: AntialiasingMode,
18    /// Target color space.
19    #[get(type(copy))]
20    pub(crate) color_space: ColorSpace,
21    /// Enables damage-region dirty-rect clipping to skip clean pixels.
22    #[get(type(copy))]
23    pub(crate) dirty_rect_optimization: bool,
24    /// Tile edge size in pixels for CPU tile rasterization.
25    #[get(type(copy))]
26    pub(crate) tile_size: u32,
27    /// Target maximum frame rate cap (`0` = uncapped, matching hardware VSync).
28    #[get(type(copy))]
29    pub(crate) max_fps: u32,
30    /// Maximum bounded in-flight frames queued to the swapchain (`1` minimizes input-to-photon latency).
31    #[get(type(copy))]
32    pub(crate) max_frames_in_flight: u32,
33    /// Whether high dynamic range presentation is requested when supported.
34    #[get(type(copy))]
35    pub(crate) hdr: bool,
36    /// When `true` on `Hardware` mode, skips steady-state CPU RGBA readback mirroring and draws directly via GPU commands.
37    #[get(type(copy))]
38    pub(crate) direct_gpu_present: bool,
39}
40
41/// Per-frame performance and rendering telemetry snapshot.
42#[derive(Clone, Copy, Data, Debug, Default, Eq, Hash, PartialEq)]
43pub struct FrameStats {
44    /// Monotonic rendered frame counter.
45    #[get(type(copy))]
46    pub(crate) frame_index: u64,
47    /// Active resolved render mode.
48    #[get(type(copy))]
49    pub(crate) active_mode: RenderMode,
50    /// Active resolved graphics backend.
51    #[get(type(copy))]
52    pub(crate) active_backend: GraphicsBackend,
53    /// Number of scene nodes laid out this frame.
54    #[get(type(copy))]
55    pub(crate) layout_nodes: usize,
56    /// Number of clean subtrees skipped during layout.
57    #[get(type(copy))]
58    pub(crate) layout_skipped: usize,
59    /// Number of display-list commands emitted.
60    #[get(type(copy))]
61    pub(crate) draw_commands: usize,
62    /// Number of GPU instanced draw batches submitted (or software dirty tiles rasterized).
63    #[get(type(copy))]
64    pub(crate) draw_batches: usize,
65    /// Total pixels updated in the framebuffer this frame.
66    #[get(type(copy))]
67    pub(crate) pixels_shaded: usize,
68    /// Deterministic 64-bit FNV-1a hash of the rendered framebuffer (when software/readback active).
69    #[get(type(copy))]
70    pub(crate) frame_hash: u64,
71    /// True when the frame took the composite-only fast path (scroll/transform/opacity with zero relayout/repaint).
72    #[get(type(copy))]
73    pub(crate) composite_only: bool,
74    /// True when the frame executed on the GPU direct-draw path with zero CPU RGBA mirror generation.
75    #[get(type(copy))]
76    pub(crate) gpu_direct_draw: bool,
77    /// Total full-frame CPU RGBA bytes generated/uploaded on this frame (`0` on steady-state GPU direct-draw).
78    #[get(type(copy))]
79    pub(crate) cpu_rgba_upload_bytes: usize,
80    /// Explicit submission outcome separating idle skip, successful submit, and retryable submit failure.
81    #[get(type(copy))]
82    pub(crate) submit_outcome: FrameSubmitOutcome,
83    /// True when the tick was deferred by bounded in-flight pipelining (`PresentOutcome::WaitInFlight`).
84    #[get(type(copy))]
85    pub(crate) wait_in_flight: bool,
86}