Fix EGLRenderer when SDL isn't built with X11 or Wayland backends

This commit is contained in:
Cameron Gutman 2020-05-15 20:01:22 -07:00
commit 1fcd306879

View file

@ -15,6 +15,14 @@
#include <SDL_render.h> #include <SDL_render.h>
#include <SDL_syswm.h> #include <SDL_syswm.h>
// These are EGL extensions, so some platform headers may not provide them
#ifndef EGL_PLATFORM_WAYLAND_KHR
#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
#endif
#ifndef EGL_PLATFORM_X11_KHR
#define EGL_PLATFORM_X11_KHR 0x31D5
#endif
/* TODO: /* TODO:
* - handle more pixel formats * - handle more pixel formats
* - handle software decoding * - handle software decoding
@ -235,14 +243,18 @@ bool EGLRenderer::initialize(PDECODER_PARAMETERS params)
return false; return false;
} }
switch (info.subsystem) { switch (info.subsystem) {
#ifdef SDL_VIDEO_DRIVER_WAYLAND
case SDL_SYSWM_WAYLAND: case SDL_SYSWM_WAYLAND:
m_EGLDisplay = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR, m_EGLDisplay = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR,
info.info.wl.display, nullptr); info.info.wl.display, nullptr);
break; break;
#endif
#ifdef SDL_VIDEO_DRIVER_X11
case SDL_SYSWM_X11: case SDL_SYSWM_X11:
m_EGLDisplay = eglGetPlatformDisplay(EGL_PLATFORM_X11_KHR, m_EGLDisplay = eglGetPlatformDisplay(EGL_PLATFORM_X11_KHR,
info.info.x11.display, nullptr); info.info.x11.display, nullptr);
break; break;
#endif
default: default:
EGL_LOG(Error, "not compatible with SYSWM"); EGL_LOG(Error, "not compatible with SYSWM");
return false; return false;