Skip to content

Commit

Permalink
Renderer: Support running under Wayland or KMS
Browse files Browse the repository at this point in the history
Ignore an error from GLEW in order to run natively under Wayland
(instead of going through XWayland) on Linux, or to run directly on top
of KMS/DRM.

Pioneer can be forced to run with Wayland like this:
SDL_VIDEODRIVER=wayland ./pioneer

Pioneer can be forced to run with KMS/DRM like this:
SDL_VIDEODRIVER=KMSDRM ./pioneer

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
  • Loading branch information
pcercuei authored and Web-eWorks committed Apr 27, 2024
1 parent 5807c21 commit 12f93ca
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/graphics/opengl/RendererGL.cpp
Expand Up @@ -173,8 +173,19 @@ namespace Graphics {
{
PROFILE_SCOPED()
glewExperimental = true;
GLenum glew_err;
if ((glew_err = glewInit()) != GLEW_OK)

const char *sdl_driver = SDL_GetCurrentVideoDriver();
Log::Info("SDL video driver used: {}", sdl_driver);

GLenum glew_err = glewInit();
#ifdef GLEW_ERROR_NO_GLX_DISPLAY
if (glew_err == GLEW_ERROR_NO_GLX_DISPLAY
&& (!strcmp(sdl_driver, "wayland") || !strcmp(sdl_driver, "KMSDRM"))) {
Log::Info("Ignoring GLEW_ERROR_NO_GLX_DISPLAY as the video backend does not support GLX.");
glew_err = GLEW_OK;
}
#endif
if (glew_err != GLEW_OK)
Error("GLEW initialisation failed: %s", glstr_to_str(glewGetErrorString(glew_err)));

// pump this once as glewExperimental is necessary but spews a single error
Expand Down

0 comments on commit 12f93ca

Please sign in to comment.