Skip to content

OpenGL2: Ignore GLEW_ERROR_NO_GLX_DISPLAY on Wayland

When glewInit() is called on Unix, its internal context is first initialized via glewContextInit() during the first half of the process, then its binding to GLX is initialized via glxewInit() during the second-half of the process. When GLEW is not compiled with an exclusive EGL backend (which is the case as provided by most system packages) and is running under Wayland, glxewInit() is still invoked during the second-half of the init process and fails with GLEW_ERROR_NO_GLX_DISPLAY, preventing GLEW from working. However, since glewContextInit() has already been called to create the underlying context, GLEW will nevertheless still work on Wayland.

The upstream has not exposed glewContextInit() as a public API via a stable release, thus, as a workaround, we just ignore the failure GLEW_ERROR_NO_GLX_DISPLAY from glewInit() and continue as if the initialization is successful. A warning to the user is also logged when this workaround is applied.

Link: https://github.com/nigels-com/glew/issues/172 Fixes: #19357 Signed-off-by: Yifeng Li tomli@tomli.me

Edited by niconiconi

Merge request reports