diff --git a/src/d_main.cpp b/src/d_main.cpp index bed80387b..12acc62f5 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -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 &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"); diff --git a/src/gl/compatibility/gl_20.cpp b/src/gl/compatibility/gl_20.cpp index d29823b75..d714d3e46 100644 --- a/src/gl/compatibility/gl_20.cpp +++ b/src/gl/compatibility/gl_20.cpp @@ -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) diff --git a/src/gl/system/gl_interface.cpp b/src/gl/system/gl_interface.cpp index 1a3f4b1ae..308d741bb 100644 --- a/src/gl/system/gl_interface.cpp +++ b/src/gl/system/gl_interface.cpp @@ -42,6 +42,8 @@ void gl_PatchMenu(); static TArray 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; } //========================================================================== diff --git a/src/gl/system/gl_swframebuffer.cpp b/src/gl/system/gl_swframebuffer.cpp index 44d3b6d8b..fd0bb395e 100644 --- a/src/gl/system/gl_swframebuffer.cpp +++ b/src/gl/system/gl_swframebuffer.cpp @@ -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");