Expand description
EGL bootstrap for the GPU rendering path.
Initialises an EGLDisplay from the Wayland connection, 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 wl_shm path.
Per-surface, EglSurface wraps a wl_egl_window plus an EGLSurface
pinned to the wayland surface. Resizing the wayland surface must call
EglSurface::resize so the underlying buffer follows.
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 EglContext::new, the SOFTWARE branch from
log_software_fallback (called by the integration site in draw.rs).
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-Wayland-surface EGL window.
egl_windowowns thewl_egl_window; it must outlivesurfacebecause EGL keeps a raw pointer into it.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
EglContext::new.