euv-core 0.53.1

Core cross-platform runtime for euv featuring arena-based fine-grained reactivity, deterministic layout, flat scene graph, multi-mode rendering, and direct OS platform adapters.
Documentation
/// Active mobile presentation channel distinguishing zero-CPU-mirror GPU direct draw from upload and CPU fallbacks.
#[repr(u8)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum MobilePresentPath {
    /// Primary direct GPU uber-shader rendering onto native `EGLSurface` or `CAMetalDrawable` (`cpu_mirror_active = false`).
    #[default]
    GpuDirect = 0,
    /// Verified fallback uploading CPU-rendered dirty rectangles to a GLES 3.0 or Metal texture (`cpu_mirror_active = true`).
    GpuUpload = 1,
    /// Verified CPU fallback via `ANativeWindow_lock` or `CGImage`/`CALayer` (`cpu_mirror_active = true`).
    Software = 2,
}

/// Adaptive pixel/primitive upload strategy selected for the current mobile presentation frame.
#[repr(u8)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum MobileUploadStrategy {
    /// Zero full-frame CPU mirror; uploads only packed 64-byte `GpuPrimitiveInstance` streams and dirty atlas updates.
    #[default]
    DirectGpu = 0,
    /// Uploads each disjoint dirty rectangle independently when bounding-box merge would waste bandwidth.
    MultiRect = 1,
    /// Uploads a single merged bounding box covering clustered dirty rectangles.
    MergedBbox = 2,
    /// Uploads the entire framebuffer texture on resize, first frame, or high dirty coverage.
    FullFrame = 3,
    /// Skips upload because the frame has zero damaged pixels.
    None = 4,
}

/// Honest provenance classification for mobile frame presentation timestamps.
#[repr(u8)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum MobilePresentTimingSource {
    /// Measured directly from OS compositor hooks (`eglPresentationTimeANDROID` / swap or physical-device `MTLDrawable.presentedTime`).
    CompositorMeasured = 0,
    /// Submission or VSync callback timing proxy (used when compositor timestamps are unavailable, such as iOS Simulator).
    SubmissionProxy = 1,
    /// Presentation timing cannot be observed on the active host or surface.
    #[default]
    Unobservable = 2,
}

/// Mobile graphics context or presentation fault driving immediate failover without waiting for perf comparisons.
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum MobileSurfaceFault {
    /// EGL context lost (`EGL_CONTEXT_LOST`) or Metal GPU device reset/hang.
    ContextLost = 0,
    /// Native window surface lost or `CAMetalLayer` drawable unavailable.
    SurfaceLost = 1,
    /// GLES 3.0 or MSL uber-shader compilation or pipeline creation failed.
    ShaderCompileFailed = 2,
    /// Frame swap, command buffer commit, or surface post failed.
    SubmitFailed = 3,
}

/// Deterministic failover action emitted on mobile graphics faults while guaranteeing zero blank frames.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum MobileFailoverAction {
    /// Retains the last valid presented frame while immediately switching to a visually equivalent fallback path.
    KeepLastFrameAndSwitch(MobilePresentPath),
    /// Retains the last valid presented frame and retries submission on the next VSync callback.
    KeepLastFrameAndRetry,
    /// Halts presentation cleanly until the host attaches a fresh valid native surface.
    WaitForNewSurface,
}

/// Built-in cross-platform GPU shader pipeline programs registered for ahead-of-time precompilation and PSO caching.
#[repr(u8)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum ShaderProgramId {
    /// 64-byte instanced SDF UI uber-shader (`euv_ui_vertex` / `euv_ui_fragment`).
    #[default]
    UiUber = 0,
    /// Dual-Kawase frosted glass `BackdropBlur` downsample/upsample shaders.
    BackdropBlur = 1,
    /// UE5-aligned instanced 3D Cook-Torrance GGX PBR + ACES filmic shader (`euv_3d_vertex` / `euv_3d_fragment`).
    Engine3dPbr = 2,
    /// Photorealistic ocean Gerstner-wave, Fresnel, GGX sun-glitter & ACES optical shader (`euv_ocean_vertex` / `euv_ocean_fragment`).
    FluidOceanOptical = 3,
}

/// Lifecycle compilation status of a precompiled GPU shader pipeline program.
#[repr(u8)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum ShaderCompileState {
    /// Shader program has not yet been precompiled.
    #[default]
    Pending = 0,
    /// Shader program is currently being compiled on a background worker thread.
    Compiling = 1,
    /// Compiled natively into a resident hardware GPU pipeline state object (`MTLRenderPipelineState` / etc.).
    CompiledHardware = 2,
    /// Loaded directly from a persistent disk-backed binary shader archive (`MTLBinaryArchive`), skipping source compilation.
    LoadedFromBinaryArchive = 3,
    /// Validated source integrity, FNV-1a cache key, and CPU optical LUT warm-up on headless or non-Apple fallback hosts.
    ValidatedFallback = 4,
    /// Hardware shader compilation failed and triggered safe runtime fallback.
    Failed = 5,
}