- store the last found OpenGL version in the INI so that modern GL related options can be removed when running old hardware with software rendering.

This commit is contained in:
Christoph Oelckers 2017-05-08 19:30:51 +02:00
parent 4a5fe65ce8
commit 762ba13cd9
4 changed files with 15 additions and 1 deletions

View file

@ -132,6 +132,7 @@ extern void M_SetDefaultMode ();
extern void G_NewInit ();
extern void SetupPlayerClasses ();
extern void HUD_InitHud();
void gl_PatchMenu(); // remove modern OpenGL options on old hardware.
void DeinitMenus();
const FIWADInfo *D_FindIWAD(TArray<FString> &wadfiles, const char *iwad, const char *basewad);
@ -2639,6 +2640,7 @@ void D_DoomMain (void)
}
V_Init2();
gl_PatchMenu();
UpdateJoystickMenu(NULL);
v = Args->CheckValue ("-loadgame");

View file

@ -53,6 +53,7 @@
CVAR(Bool, gl_lights_additive, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, gl_legacy_mode, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOSET)
//==========================================================================
//
@ -64,6 +65,7 @@ CVAR(Bool, gl_lights_additive, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
void gl_PatchMenu()
{
// Radial fog and Doom lighting are not available without full shader support.
if (!gl_legacy_mode) return;
FOptionValues **opt = OptionValues.CheckKey("LightingModes");
if (opt != NULL)

View file

@ -42,6 +42,8 @@ void gl_PatchMenu();
static TArray<FString> m_Extensions;
RenderContext gl;
EXTERN_CVAR(Bool, gl_legacy_mode)
//==========================================================================
//
//
@ -311,8 +313,8 @@ void gl_LoadExtensions()
FUDGE_FUNC(glRenderbufferStorage, EXT);
FUDGE_FUNC(glBindRenderbuffer, EXT);
FUDGE_FUNC(glCheckFramebufferStatus, EXT);
gl_PatchMenu();
}
gl_legacy_mode = gl.legacyMode;
}
//==========================================================================

View file

@ -92,6 +92,7 @@ EXTERN_CVAR(Float, Gamma)
EXTERN_CVAR(Bool, vid_vsync)
EXTERN_CVAR(Float, transsouls)
EXTERN_CVAR(Int, vid_refreshrate)
EXTERN_CVAR(Bool, gl_legacy_mode)
CVAR(Int, vid_max_width, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Int, vid_max_height, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
@ -205,6 +206,13 @@ OpenGLSWFrameBuffer::OpenGLSWFrameBuffer(void *hMonitor, int width, int height,
const char *glversion = (const char*)glGetString(GL_VERSION);
bool isGLES = (glversion && strlen(glversion) > 10 && memcmp(glversion, "OpenGL ES ", 10) == 0);
// GL 3.0 is mostly broken on MESA drivers which really are the only relevant case here that doesn't fulfill the requirements based on version number alone.
#ifdef _WIN32
gl_legacy_mode = !ogl_IsVersionGEQ(3, 0);
#else
gl_legacy_mode = !ogl_IsVersionGEQ(3, 1);
#endif
if (!isGLES && ogl_IsVersionGEQ(3, 0) == 0)
{
Printf("OpenGL acceleration requires at least OpenGL 3.0. No Acceleration will be used.\n");