euv_example/app/struct.rs
1use super::*;
2
3/// Independent stacked HTML `<canvas>` presentation target locked to a single browser context family.
4#[derive(Clone, Copy, Data, Debug, Eq, PartialEq)]
5pub struct ShowcaseWebCanvasSlot {
6 /// Unique monotonic identifier for this `<canvas>` DOM element.
7 #[get(type(copy))]
8 pub(crate) canvas_id: u64,
9 /// Permanently locked context family (`WebGl2` or `Canvas2d`) for this `<canvas>`.
10 #[get(type(copy))]
11 pub(crate) context_family: ShowcaseWebCanvasContextFamily,
12 /// Target presentation path served by this slot.
13 #[get(type(copy))]
14 pub(crate) path: ShowcaseWebPresentationPath,
15 /// Whether this `<canvas>` is currently visible in the foreground stack.
16 #[get(type(copy))]
17 pub(crate) visible: bool,
18 /// CSS stacking `z-index` (`1` active foreground, `0` hidden standby).
19 #[get(type(copy))]
20 pub(crate) z_index: i32,
21 /// Physical canvas width in pixels.
22 #[get(type(copy))]
23 pub(crate) width: u32,
24 /// Physical canvas height in pixels.
25 #[get(type(copy))]
26 pub(crate) height: u32,
27 /// Scene revision rendered into this slot (`0` before first frame).
28 #[get(type(copy))]
29 pub(crate) scene_version: u64,
30 /// Whether the candidate's first frame has completed and is ready for atomic handoff.
31 #[get(type(copy))]
32 pub(crate) ready: bool,
33}
34
35/// Stacked dual-canvas handoff controller guaranteeing independent `<canvas>` targets and honest `SubmissionProxy` telemetry.
36#[derive(Clone, Data, Debug, Eq, PartialEq)]
37pub struct ShowcaseWebDualCanvasCoordinator {
38 /// Foreground visible `<canvas>` currently presenting frames.
39 #[get(type(copy))]
40 pub(crate) active: ShowcaseWebCanvasSlot,
41 /// Optional hidden sibling `<canvas>` pre-warming a candidate backend before atomic frame-boundary swap.
42 #[get(skip)]
43 pub(crate) standby: Option<ShowcaseWebCanvasSlot>,
44 /// Explicit CPU-mirror flag (`false` for `GpuDirect`; `true` for `GpuUpload` and `Canvas2d`).
45 #[get(type(copy))]
46 pub(crate) cpu_mirror_active: bool,
47 /// Truthful timing source (browser rAF always reports `SubmissionProxy`).
48 #[get(type(copy))]
49 pub(crate) timing_source: ShowcaseWebTimingSource,
50 /// Next unique `<canvas>` ID allocator.
51 #[get(type(copy))]
52 pub(crate) next_canvas_id: u64,
53 /// Total atomic frame-boundary handoff swaps committed.
54 #[get(type(copy))]
55 pub(crate) completed_swaps: u64,
56 /// Total aborted candidate handoffs leaving the previous canvas active.
57 #[get(type(copy))]
58 pub(crate) aborted_swaps: u64,
59 /// Total browser rAF ticks recorded strictly as `SubmissionProxy`.
60 #[get(type(copy))]
61 pub(crate) raf_proxy_ticks: u64,
62 /// Exact framebuffer upload bytes reported on the latest frame (`0` on `GpuDirect`).
63 #[get(type(copy))]
64 pub(crate) last_upload_bytes: u64,
65 /// Ordered history of retired `<canvas>` IDs removed only after atomic commit.
66 pub(crate) retired_canvas_ids: Vec<u64>,
67}