euv-example 0.48.1

Cross-platform native showcase application demonstrating euv fine-grained reactivity, multi-mode rendering, window controls, and euv-ui components.
Documentation
use super::*;

/// Independent stacked HTML `<canvas>` presentation target locked to a single browser context family.
#[derive(Clone, Copy, Data, Debug, Eq, PartialEq)]
pub struct ShowcaseWebCanvasSlot {
    /// Unique monotonic identifier for this `<canvas>` DOM element.
    #[get(type(copy))]
    pub(crate) canvas_id: u64,
    /// Permanently locked context family (`WebGl2` or `Canvas2d`) for this `<canvas>`.
    #[get(type(copy))]
    pub(crate) context_family: ShowcaseWebCanvasContextFamily,
    /// Target presentation path served by this slot.
    #[get(type(copy))]
    pub(crate) path: ShowcaseWebPresentationPath,
    /// Whether this `<canvas>` is currently visible in the foreground stack.
    #[get(type(copy))]
    pub(crate) visible: bool,
    /// CSS stacking `z-index` (`1` active foreground, `0` hidden standby).
    #[get(type(copy))]
    pub(crate) z_index: i32,
    /// Physical canvas width in pixels.
    #[get(type(copy))]
    pub(crate) width: u32,
    /// Physical canvas height in pixels.
    #[get(type(copy))]
    pub(crate) height: u32,
    /// Scene revision rendered into this slot (`0` before first frame).
    #[get(type(copy))]
    pub(crate) scene_version: u64,
    /// Whether the candidate's first frame has completed and is ready for atomic handoff.
    #[get(type(copy))]
    pub(crate) ready: bool,
}

/// Stacked dual-canvas handoff controller guaranteeing independent `<canvas>` targets and honest `SubmissionProxy` telemetry.
#[derive(Clone, Data, Debug, Eq, PartialEq)]
pub struct ShowcaseWebDualCanvasCoordinator {
    /// Foreground visible `<canvas>` currently presenting frames.
    #[get(type(copy))]
    pub(crate) active: ShowcaseWebCanvasSlot,
    /// Optional hidden sibling `<canvas>` pre-warming a candidate backend before atomic frame-boundary swap.
    #[get(skip)]
    pub(crate) standby: Option<ShowcaseWebCanvasSlot>,
    /// Explicit CPU-mirror flag (`false` for `GpuDirect`; `true` for `GpuUpload` and `Canvas2d`).
    #[get(type(copy))]
    pub(crate) cpu_mirror_active: bool,
    /// Truthful timing source (browser rAF always reports `SubmissionProxy`).
    #[get(type(copy))]
    pub(crate) timing_source: ShowcaseWebTimingSource,
    /// Next unique `<canvas>` ID allocator.
    #[get(type(copy))]
    pub(crate) next_canvas_id: u64,
    /// Total atomic frame-boundary handoff swaps committed.
    #[get(type(copy))]
    pub(crate) completed_swaps: u64,
    /// Total aborted candidate handoffs leaving the previous canvas active.
    #[get(type(copy))]
    pub(crate) aborted_swaps: u64,
    /// Total browser rAF ticks recorded strictly as `SubmissionProxy`.
    #[get(type(copy))]
    pub(crate) raf_proxy_ticks: u64,
    /// Exact framebuffer upload bytes reported on the latest frame (`0` on `GpuDirect`).
    #[get(type(copy))]
    pub(crate) last_upload_bytes: u64,
    /// Ordered history of retired `<canvas>` IDs removed only after atomic commit.
    pub(crate) retired_canvas_ids: Vec<u64>,
}