Expand description
EGL bootstrap for the GPU rendering path.
Initialises an EGLDisplay from the Wayland connection, or the default
display on Android, picks an EGLConfig, and creates an EGLContext.
Tries GLES 3 first and falls back to GLES 2 if the driver does not
advertise it. On success returns an EglContext holding a
glow::Context already pointed at the resolved GL functions; on failure
returns Err( reason ) so the caller can fall back to the software path.
Per-surface, EglSurface wraps an EGLSurface on the platform’s
window: on Wayland a wl_egl_window it owns, which EglSurface::resize
must follow the surface’s size; on Android an ANativeWindow the backend
holds, whose buffers follow ANativeWindow_setBuffersGeometry.
Both need a backend feature, wayland, android or windows; EglOffscreenContext, the runtime-free target of UiSurface, does not.
The bootstrap honours LTK_FORCE_SOFTWARE=1 by failing fast with a
descriptive error. Backend selection is announced exactly once per
process via eprintln!( "[ltk] render backend: {GLES3|GLES2|SOFTWARE (...)}" )
— the GPU branch logs from the constructors of EglContext and
EglOffscreenContext, the SOFTWARE branch from
log_software_fallback (called by each backend’s run).
Structs§
- Process-wide EGL display + GLES context. Cheap to clone because the heavy state (
Arc<EglInstance>,Arc<glow::Context>) is reference-counted; the raw EGL handles are POD. - Runtime-free EGL target for code that wants a GPU
crate::render::Canvaswithout going throughltk::run. - Per-surface EGL window. On Wayland
egl_windowowns thewl_egl_window; it must outlivesurfacebecause EGL keeps a raw pointer into it. On Android the backend holds theANativeWindowfor as long.eglanddisplayare kept so thatDropcan calleglDestroySurfacewithout requiring a&EglContextat the call site.
Functions§
- Log the SOFTWARE fallback once, with the reason. The GPU branch logs from the context’s constructor.