[KMSDRM] Enable full OpenGL detection (MESA/libglvnd) on both the make and cmake buildsystems.

This commit is contained in:
vanfanel 2021-03-15 12:53:16 +01:00 committed by Sam Lantinga
parent b98b5adcae
commit e213f37a45
3 changed files with 39 additions and 0 deletions

View File

@ -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. # Need to check EGL before checking KMSDRM because KMSDRM depends on it.
CheckEGLKMSDRM() CheckEGLKMSDRM()
CheckKMSDRM() CheckKMSDRM()
CheckOpenGLKMSDRM()
endif() endif()
if(UNIX) if(UNIX)

View File

@ -777,6 +777,22 @@ macro(CheckVivante)
endif(VIDEO_VIVANTE) endif(VIDEO_VIVANTE)
endmacro(CheckVivante) 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: # Requires:
# - nada # - nada
macro(CheckOpenGLX11) macro(CheckOpenGLX11)

View File

@ -2384,6 +2384,27 @@ CheckOpenGLX11()
fi 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 dnl Check to see if OpenGL ES support is desired
AC_ARG_ENABLE(video-opengles, AC_ARG_ENABLE(video-opengles,
[AS_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [default=yes]])], [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. # Need to check for EGL first because KMSDRM depends on it.
CheckEGLKMSDRM CheckEGLKMSDRM
CheckKMSDRM CheckKMSDRM
CheckOpenGLKMSDRM
CheckOpenGLX11 CheckOpenGLX11
CheckOpenGLESX11 CheckOpenGLESX11
CheckVulkan CheckVulkan