diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-02-27 18:14:24 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-02-27 19:01:34 +0100 |
commit | 77854d561b66cdb49e8462bb473e706a4241394d (patch) | |
tree | e3069bc073e8ae4af92ce8c3332e8aacc56698b5 /src | |
parent | 1b5d1d074ef1a65634830cbfa7ff412f8a9906bd (diff) | |
download | openttd-77854d561b66cdb49e8462bb473e706a4241394d.tar.xz |
Fix: [OpenGL] Don't use OpenGL on MESA software renderers.
Performance in this case is worse than not using OpenGL, so just let
OTTD fall back to a different video driver.
Diffstat (limited to 'src')
-rw-r--r-- | src/video/opengl.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/video/opengl.cpp b/src/video/opengl.cpp index 4d590facc..ebe4bb8d7 100644 --- a/src/video/opengl.cpp +++ b/src/video/opengl.cpp @@ -15,6 +15,8 @@ // #define NO_GL_BUFFER_SYNC /* Define to enable persistent buffer mapping on AMD GPUs. */ // #define GL_MAP_PERSISTENT_AMD +/* Define to allow software rendering backends. */ +// #define GL_ALLOW_SOFTWARE_RENDERER #if defined(_WIN32) # include <windows.h> @@ -536,6 +538,12 @@ const char *OpenGLBackend::Init() DEBUG(driver, 1, "OpenGL driver: %s - %s (%s)", vend, renderer, ver); +#ifndef GL_ALLOW_SOFTWARE_RENDERER + /* Don't use MESA software rendering backends as they are slower than + * just using a non-OpenGL video driver. */ + if (strncmp(renderer, "llvmpipe", 8) == 0 || strncmp(renderer, "softpipe", 8) == 0) return "Software renderer detected, not using OpenGL"; +#endif + const char *minor = strchr(ver, '.'); _gl_major_ver = atoi(ver); _gl_minor_ver = minor != nullptr ? atoi(minor + 1) : 0; |