Add CheckGLVersion to warn about software GL
Performance with a software GL implementation is not great. Check the GL_VERSION string and warn about possible performance problems if we find "Mesa", suggesting hardware acceleration is not available. Additional LDFLAGS are needed for OS X when using SDL_opengl.h, adjust configure.ac accordingly. Fixes #741.
This commit is contained in:
parent
f90f95af26
commit
e82b4c186c
2 changed files with 29 additions and 0 deletions
|
|
@ -39,6 +39,13 @@ PKG_CHECK_MODULES(SDLMIXER, [SDL2_mixer >= 2.0.0])
|
|||
PKG_CHECK_MODULES(SDLNET, [SDL2_net >= 2.0.0])
|
||||
PKG_CHECK_MODULES(SDLIMAGE, [SDL2_image >= 2.0.0])
|
||||
|
||||
# Additional LDFLAGS for OS X are required for OpenGL
|
||||
case "$host" in
|
||||
*-darwin*)
|
||||
LDFLAGS="$LDFLAGS -framework OpenGL"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check for libsamplerate.
|
||||
AC_ARG_WITH([libsamplerate],
|
||||
AS_HELP_STRING([--without-libsamplerate],
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "SDL.h"
|
||||
#include "SDL_image.h"
|
||||
#include "SDL_opengl.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
|
@ -1147,6 +1148,23 @@ static void SetVideoMode(void)
|
|||
CreateUpscaledTexture();
|
||||
}
|
||||
|
||||
static const char *hw_emu_warning =
|
||||
"===========================================================================\n"
|
||||
"WARNING: it looks like you are using a software GL implementation.\n"
|
||||
"To improve performance, try setting force_software_renderer in your\n"
|
||||
"configuration file.\n"
|
||||
"===========================================================================\n";
|
||||
|
||||
static void CheckGLVersion(void)
|
||||
{
|
||||
const GLubyte* version = glGetString(GL_VERSION);
|
||||
|
||||
if (version && strstr((const char *)version, "Mesa"))
|
||||
{
|
||||
printf("%s", hw_emu_warning);
|
||||
}
|
||||
}
|
||||
|
||||
void I_InitGraphics(void)
|
||||
{
|
||||
SDL_Event dummy;
|
||||
|
|
@ -1189,6 +1207,10 @@ void I_InitGraphics(void)
|
|||
AdjustWindowSize();
|
||||
SetVideoMode();
|
||||
|
||||
// We might have poor performance if we are using an emulated
|
||||
// HW accelerator. Check for Mesa and warn if we're using it.
|
||||
CheckGLVersion();
|
||||
|
||||
// Start with a clear black screen
|
||||
// (screen will be flipped after we set the palette)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue