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}
68
69/// Built-in cross-platform GPU shader pipeline programs registered for ahead-of-time precompilation and PSO caching.
70#[repr(u8)]
71#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
72pub enum ShaderProgramId {
73 /// 64-byte instanced SDF UI uber-shader (`euv_ui_vertex` / `euv_ui_fragment`).
74 #[default]
75 UiUber = 0,
76 /// Dual-Kawase frosted glass `BackdropBlur` downsample/upsample shaders.
77 BackdropBlur = 1,
78 /// UE5-aligned instanced 3D Cook-Torrance GGX PBR + ACES filmic shader (`euv_3d_vertex` / `euv_3d_fragment`).
79 Engine3dPbr = 2,
80 /// Photorealistic ocean Gerstner-wave, Fresnel, GGX sun-glitter & ACES optical shader (`euv_ocean_vertex` / `euv_ocean_fragment`).
81 FluidOceanOptical = 3,
82}
83
84/// Lifecycle compilation status of a precompiled GPU shader pipeline program.
85#[repr(u8)]
86#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
87pub enum ShaderCompileState {
88 /// Shader program has not yet been precompiled.
89 #[default]
90 Pending = 0,
91 /// Shader program is currently being compiled on a background worker thread.
92 Compiling = 1,
93 /// Compiled natively into a resident hardware GPU pipeline state object (`MTLRenderPipelineState` / etc.).
94 CompiledHardware = 2,
95 /// Loaded directly from a persistent disk-backed binary shader archive (`MTLBinaryArchive`), skipping source compilation.
96 LoadedFromBinaryArchive = 3,
97 /// Validated source integrity, FNV-1a cache key, and CPU optical LUT warm-up on headless or non-Apple fallback hosts.
98 ValidatedFallback = 4,
99 /// Hardware shader compilation failed and triggered safe runtime fallback.
100 Failed = 5,
101}