EGL: Ensure the platform extensions exist before using them
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled

The EXT and KHR variants use the same constant values, but the EXT versions are available a bit further back.
This commit is contained in:
Frank Praznik
2026-06-11 13:16:25 -04:00
parent fea9b348c3
commit 819f6ae75b
2 changed files with 13 additions and 4 deletions
+7 -2
View File
@@ -37,10 +37,15 @@
int Wayland_GLES_LoadLibrary(_THIS, const char *path)
{
int ret;
SDL_VideoData *data = (SDL_VideoData *)_this->driverdata;
int ret;
#ifdef EGL_EXT_platform_wayland
const EGLenum platform = EGL_PLATFORM_WAYLAND_EXT;
#else
const EGLenum platform = 0;
#endif
ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display, EGL_PLATFORM_WAYLAND_KHR);
ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display, platform);
Wayland_PumpEvents(_this);
WAYLAND_wl_display_flush(data->display);
+6 -2
View File
@@ -32,6 +32,11 @@
int X11_GLES_LoadLibrary(_THIS, const char *path)
{
SDL_VideoData *data = (SDL_VideoData *)_this->driverdata;
#ifdef EGL_EXT_platform_x11
const EGLenum platform = EGL_PLATFORM_X11_EXT;
#else
const EGLenum platform = 0;
#endif
/* If the profile requested is not GL ES, switch over to X11_GL functions */
if ((_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) &&
@@ -53,8 +58,7 @@ int X11_GLES_LoadLibrary(_THIS, const char *path)
#endif
}
return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display,
EGL_PLATFORM_X11_KHR);
return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display, platform);
}
XVisualInfo *X11_GLES_GetVisual(_THIS, Display *display, int screen)