Skip to content

Commit 3bfd5dd

Browse files
Set EGL_PLATFORM before loading SDL GL library
Should fix nvidia driver specific crashes reported by linux users
1 parent c57abbe commit 3bfd5dd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/BizHawk.Bizware.Graphics/OpenGL/SDL2OpenGLContext.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ static SDL2OpenGLContext()
3131
// GLX is the old API, and is the more or less "deprecated" at this point, and potentially more buggy with some drivers
3232
// we do need to a bit more work, in case EGL is not actually available or potentially doesn't have desktop GL support
3333
SDL_SetHint(SDL_HINT_VIDEO_X11_FORCE_EGL, "1");
34+
// set EGL_PLATFORM, many users have reported crashes with SDL_GL_LoadLibrary
35+
// this is from EGL_PLATFORM being set to wayland by users to workaround wonky autodetection with nvidia drivers
36+
// this is made worse with SDL as it uses eglGetDisplay rather than eglGetPlatformDisplay
37+
// as such EGL assumes the display is a wayland display and proceeds to crash with that assumption
38+
Environment.SetEnvironmentVariable("EGL_PLATFORM", "x11");
3439
}
3540

3641
// init SDL video

0 commit comments

Comments
 (0)