Skip to content

Add Wayland EGL-based NSOpenGLContext and PixelFormat backend#2

Open
DMJC wants to merge 1 commit into
masterfrom
codex/create-wayland-equivalent-for-nsopenglcontext-k9tetg
Open

Add Wayland EGL-based NSOpenGLContext and PixelFormat backend#2
DMJC wants to merge 1 commit into
masterfrom
codex/create-wayland-equivalent-for-nsopenglcontext-k9tetg

Conversation

@DMJC
Copy link
Copy Markdown
Owner

@DMJC DMJC commented Apr 16, 2026

Motivation

  • Provide OpenGL support for the Wayland backend by implementing an EGL-based NSOpenGLContext and NSOpenGLPixelFormat to allow apps to create GL-backed views on Wayland.
  • Integrate GL support into the Wayland server window lifecycle so windows can be marked as using OpenGL and avoid Cairo flushes for GL-backed surfaces.
  • Expose the new GL classes to the display server so higher-level code can instantiate GL contexts and pixel formats for Wayland.

Description

  • Add Headers/wayland/WaylandOpenGL.h declaring WaylandGLContext and WaylandGLPixelFormat classes and state needed for EGL and wl_egl_window management.
  • Implement WaylandGLContext in Source/wayland/WaylandGLContext.m providing EGL display/context/surface creation, makeCurrentContext, flushBuffer, setView: binding to Wayland struct window, and lifecycle/resize handling.
  • Implement WaylandGLPixelFormat in Source/wayland/WaylandGLPixelFormat.m to translate NSOpenGLPixelFormatAttribute lists into an EGLConfig via eglChooseConfig.
  • Integrate with server code in Source/wayland/WaylandServer.m by including the new header, returning get_window_with_id from windowDevice:, adding glContextClass and glPixelFormatClass accessors, initializing a usesOpenGL flag on window creation, and skipping Cairo flushes for GL-backed windows.
  • Update Source/wayland/GNUmakefile to compile the new Objective-C sources and add link flags -lEGL -lwayland-egl.

Testing

  • Built the Wayland subproject via the updated GNUmakefile using the normal make flow, and the Wayland backend compiled successfully (no compilation errors reported).
  • Ran a build of the overall project that includes the Wayland backend and confirmed successful link of -lEGL and -lwayland-egl libraries.
  • No automated unit tests were added for GL behavior in this change set.

Codex Task

DMJC pushed a commit that referenced this pull request May 10, 2026
* Fixes to make opal functional

* Fix more usability issues

* Opal backend: font hinting, gradients, blend modes, gray-to-RGB colors, lazy surface creation

* Fix window movement trails: flush backing and X11 contexts in OpalSurface handleExposeRect

* Opal: make X11 surface attachment self-contained

* Remove newline

* convert directly to RGB

* Opal gradient helper (#2)

* Use shared gradient helper

* Restore comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant