feat: native Wayland support with EGL/GLX runtime selection #36

Open
opened 2026-04-05 16:18:13 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @akelmanson on 4/1/2026

Summary

  • Native Wayland 3D viewport — OrcaSlicer runs on Wayland without XWayland, with fully functional 3D viewport (Prepare + Preview)
  • X11 backward compatible — Same binary works on X11 via GLX (PreferGLX) and Wayland via EGL
  • GLEW replaced with libepoxy — Runtime EGL/GLX dispatch instead of GLEW's compile-time lock

Closes #8145
Closes #6433
Closes #10059
Closes #11698

Changes

Build System

  • Enable wxUSE_GLCANVAS_EGL=ON and GLEW_USE_EGL=ON in dependency builds
  • Add libepoxy 1.5.10 as vendored dependency (Meson ExternalProject)
  • Patch OpenCSG to use libepoxy instead of GLEW (17 source files)
  • Remove GLEW from dependency chain
  • Add FindEpoxy.cmake find module

Source

  • Replace GL/glew.h with epoxy/gl.h across 50 source files
  • Migrate GLEW API calls (glewInit, extension checks) to libepoxy equivalents
  • Add wxGLCanvas::PreferGLX() for X11 GLX backend selection
  • Runtime Wayland/X11 detection via WAYLAND_DISPLAY, XDG_SESSION_TYPE, GDK_BACKEND
  • Remove hardcoded GDK_BACKEND=x11 forcing

Bug Fixes

  • Re-enable canvas rendering when GL context not ready at Wayland boot (EGL lazy surface creation)
  • Deferred scene reload for models loaded before GL init
  • Guard activate_gizmo() against empty gizmo vector during deferred init
  • Remove Zink workaround from Linux launch wrapper (conflicts with native EGL)
  • Robust display server detection respecting GDK_BACKEND override

Test plan

  • OrcaSlicer launches on native Wayland (Cosmic DE) with working 3D viewport
  • Models load and display correctly in Prepare tab
  • Slice preview renders in Preview tab
  • OrcaSlicer launches on X11 (via GDK_BACKEND=x11) with working 3D viewport
  • Same binary works on both without recompilation
  • Test on GNOME Wayland
  • Test on KDE Plasma Wayland
  • Test on AMD/Intel GPU

Tested on: Arch Linux, Cosmic DE, NVIDIA nvidia-open 590.48.01, egl-wayland 1.1.21

Known limitations

  • Menus/popups may not work correctly on some Wayland compositors (upstream wxWidgets issues #24174, #23942)
  • Splash screen skipped on Wayland (requires parent window that doesn't exist yet)

🤖 Generated with Claude Code

*Originally created by @akelmanson on 4/1/2026* ## Summary - **Native Wayland 3D viewport** — OrcaSlicer runs on Wayland without XWayland, with fully functional 3D viewport (Prepare + Preview) - **X11 backward compatible** — Same binary works on X11 via GLX (PreferGLX) and Wayland via EGL - **GLEW replaced with libepoxy** — Runtime EGL/GLX dispatch instead of GLEW's compile-time lock Closes #8145 Closes #6433 Closes #10059 Closes #11698 ## Changes ### Build System - Enable `wxUSE_GLCANVAS_EGL=ON` and `GLEW_USE_EGL=ON` in dependency builds - Add libepoxy 1.5.10 as vendored dependency (Meson ExternalProject) - Patch OpenCSG to use libepoxy instead of GLEW (17 source files) - Remove GLEW from dependency chain - Add `FindEpoxy.cmake` find module ### Source - Replace `GL/glew.h` with `epoxy/gl.h` across 50 source files - Migrate GLEW API calls (glewInit, extension checks) to libepoxy equivalents - Add `wxGLCanvas::PreferGLX()` for X11 GLX backend selection - Runtime Wayland/X11 detection via `WAYLAND_DISPLAY`, `XDG_SESSION_TYPE`, `GDK_BACKEND` - Remove hardcoded `GDK_BACKEND=x11` forcing ### Bug Fixes - Re-enable canvas rendering when GL context not ready at Wayland boot (EGL lazy surface creation) - Deferred scene reload for models loaded before GL init - Guard `activate_gizmo()` against empty gizmo vector during deferred init - Remove Zink workaround from Linux launch wrapper (conflicts with native EGL) - Robust display server detection respecting `GDK_BACKEND` override ## Test plan - [x] OrcaSlicer launches on native Wayland (Cosmic DE) with working 3D viewport - [x] Models load and display correctly in Prepare tab - [x] Slice preview renders in Preview tab - [x] OrcaSlicer launches on X11 (via `GDK_BACKEND=x11`) with working 3D viewport - [x] Same binary works on both without recompilation - [ ] Test on GNOME Wayland - [ ] Test on KDE Plasma Wayland - [ ] Test on AMD/Intel GPU **Tested on:** Arch Linux, Cosmic DE, NVIDIA nvidia-open 590.48.01, egl-wayland 1.1.21 ## Known limitations - Menus/popups may not work correctly on some Wayland compositors (upstream wxWidgets issues [#24174](https://github.com/wxWidgets/wxWidgets/issues/24174), [#23942](https://github.com/wxWidgets/wxWidgets/issues/23942)) - Splash screen skipped on Wayland (requires parent window that doesn't exist yet) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/OrcaSlicer#36