diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d4b9f236..4fef44774 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1197,6 +1197,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS) # Need to check EGL before checking KMSDRM because KMSDRM depends on it. CheckEGLKMSDRM() CheckKMSDRM() + CheckOpenGLKMSDRM() endif() if(UNIX) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index 364cdb3cb..64089c6bd 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -777,6 +777,22 @@ macro(CheckVivante) endif(VIDEO_VIVANTE) endmacro(CheckVivante) +# Requires: +# - libglvnd +macro(CheckOpenGLKMSDRM) + if(VIDEO_OPENGL AND HAVE_VIDEO_KMSDRM) + check_c_source_compiles(" + #include + int main(int argc, char** argv) {}" HAVE_VIDEO_OPENGL) + + if(HAVE_VIDEO_OPENGL) + set(HAVE_VIDEO_OPENGL TRUE) + set(SDL_VIDEO_OPENGL 1) + set(SDL_VIDEO_RENDER_OGL 1) + endif() + endif() +endmacro() + # Requires: # - nada macro(CheckOpenGLX11) diff --git a/configure.ac b/configure.ac index 30d17a1ba..4d0a9802b 100644 --- a/configure.ac +++ b/configure.ac @@ -2384,6 +2384,27 @@ CheckOpenGLX11() fi } +dnl Find KMSDRM OpenGL (GLVND) +CheckOpenGLKMSDRM() +{ + if test x$enable_video = xyes -a x$enable_video_opengl = xyes -a x$enable_video_kmsdrm = xyes; then + AC_MSG_CHECKING(for OpenGL (GLVND) support) + video_opengl=no + AC_TRY_COMPILE([ + #include + ],[ + ],[ + video_opengl=yes + ]) + AC_MSG_RESULT($video_opengl) + if test x$video_opengl = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ]) + SUMMARY_video="${SUMMARY_video} opengl" + fi + fi +} + dnl Check to see if OpenGL ES support is desired AC_ARG_ENABLE(video-opengles, [AS_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [default=yes]])], @@ -3656,6 +3677,7 @@ case "$host" in # Need to check for EGL first because KMSDRM depends on it. CheckEGLKMSDRM CheckKMSDRM + CheckOpenGLKMSDRM CheckOpenGLX11 CheckOpenGLESX11 CheckVulkan