euv_core/render/gpu/enum.rs
1/// Active mobile presentation channel distinguishing zero-CPU-mirror GPU direct draw from upload and CPU fallbacks.
2#[repr(u8)]
3#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
4pub enum MobilePresentPath {
5 /// Primary direct GPU uber-shader rendering onto native `EGLSurface` or `CAMetalDrawable` (`cpu_mirror_active = false`).
6 #[default]
7 GpuDirect = 0,
8 /// Verified fallback uploading CPU-rendered dirty rectangles to a GLES 3.0 or Metal texture (`cpu_mirror_active = true`).
9 GpuUpload = 1,
10 /// Verified CPU fallback via `ANativeWindow_lock` or `CGImage`/`CALayer` (`cpu_mirror_active = true`).
11 Software = 2,
12}
13
14/// Adaptive pixel/primitive upload strategy selected for the current mobile presentation frame.
15#[repr(u8)]
16#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
17pub enum MobileUploadStrategy {
18 /// Zero full-frame CPU mirror; uploads only packed 64-byte `GpuPrimitiveInstance` streams and dirty atlas updates.
19 #[default]
20 DirectGpu = 0,
21 /// Uploads each disjoint dirty rectangle independently when bounding-box merge would waste bandwidth.
22 MultiRect = 1,
23 /// Uploads a single merged bounding box covering clustered dirty rectangles.
24 MergedBbox = 2,
25 /// Uploads the entire framebuffer texture on resize, first frame, or high dirty coverage.
26 FullFrame = 3,
27 /// Skips upload because the frame has zero damaged pixels.
28 None = 4,
29}
30
31/// Honest provenance classification for mobile frame presentation timestamps.
32#[repr(u8)]
33#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
34pub enum MobilePresentTimingSource {
35 /// Measured directly from OS compositor hooks (`eglPresentationTimeANDROID` / swap or physical-device `MTLDrawable.presentedTime`).
36 CompositorMeasured = 0,
37 /// Submission or VSync callback timing proxy (used when compositor timestamps are unavailable, such as iOS Simulator).
38 SubmissionProxy = 1,
39 /// Presentation timing cannot be observed on the active host or surface.
40 #[default]
41 Unobservable = 2,
42}
43
44/// Mobile graphics context or presentation fault driving immediate failover without waiting for perf comparisons.
45#[repr(u8)]
46#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
47pub enum MobileSurfaceFault {
48 /// EGL context lost (`EGL_CONTEXT_LOST`) or Metal GPU device reset/hang.
49 ContextLost = 0,
50 /// Native window surface lost or `CAMetalLayer` drawable unavailable.
51 SurfaceLost = 1,
52 /// GLES 3.0 or MSL uber-shader compilation or pipeline creation failed.
53 ShaderCompileFailed = 2,
54 /// Frame swap, command buffer commit, or surface post failed.
55 SubmitFailed = 3,
56}
57
58/// Deterministic failover action emitted on mobile graphics faults while guaranteeing zero blank frames.
59#[derive(Clone, Copy, Debug, Eq, PartialEq)]
60pub enum MobileFailoverAction {
61 /// Retains the last valid presented frame while immediately switching to a visually equivalent fallback path.
62 KeepLastFrameAndSwitch(MobilePresentPath),
63 /// Retains the last valid presented frame and retries submission on the next VSync callback.
64 KeepLastFrameAndRetry,
65 /// Halts presentation cleanly until the host attaches a fresh valid native surface.
66 WaitForNewSurface,
67}