Skip to content

Commit

Permalink
[KMSDRM] Enable full OpenGL detection (MESA/libglvnd) on both the mak…
Browse files Browse the repository at this point in the history
…e and cmake buildsystems.
  • Loading branch information
vanfanel authored and slouken committed Mar 16, 2021
1 parent b98b5ad commit e213f37
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -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)
Expand Down
16 changes: 16 additions & 0 deletions cmake/sdlchecks.cmake
Expand Up @@ -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 <GL/gl.h>
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)
Expand Down
22 changes: 22 additions & 0 deletions configure.ac
Expand Up @@ -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 <GL/gl.h>
],[
],[
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]])],
Expand Down Expand Up @@ -3656,6 +3677,7 @@ case "$host" in
# Need to check for EGL first because KMSDRM depends on it.
CheckEGLKMSDRM
CheckKMSDRM
CheckOpenGLKMSDRM
CheckOpenGLX11
CheckOpenGLESX11
CheckVulkan
Expand Down

0 comments on commit e213f37

Please sign in to comment.