- Fall back to software mode if the GL renderer cannot start.

This commit is contained in:
drfrag666 2018-06-19 17:08:59 +02:00
parent 09a3d7c9da
commit cafb92c637
2 changed files with 11 additions and 5 deletions

View file

@ -45,6 +45,7 @@ static double realglversion; // this is public so the statistics code can access
EXTERN_CVAR(Bool, gl_legacy_mode)
extern int currentrenderer;
EXTERN_CVAR(Int, vid_renderer);
CVAR(Bool, gl_riskymodernpath, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
//==========================================================================
@ -190,7 +191,8 @@ void gl_LoadExtensions()
// Don't even start if it's lower than 2.0 or no framebuffers are available (The framebuffer extension is needed for glGenerateMipmapsEXT!)
if ((gl_version < 2.0f || !CheckExtension("GL_EXT_framebuffer_object")) && gl_version < 3.0f)
{
I_FatalError("Unsupported OpenGL version.\nAt least OpenGL 2.0 with framebuffer support is required to run " GAMENAME ".\n");
vid_renderer = 0;
I_FatalError("Unsupported OpenGL version.\nAt least OpenGL 2.0 with framebuffer support is required to run " GAMENAME ".\nFalling back to software renderer.\n");
}
gl.es = false;

View file

@ -854,14 +854,16 @@ bool Win32GLVideo::SetupPixelFormat(int multisample)
if (pfd.dwFlags & PFD_GENERIC_FORMAT)
{
I_Error("R_OPENGL: OpenGL driver not accelerated!");
vid_renderer = 0;
I_Error("R_OPENGL: OpenGL driver not accelerated! Falling back to software renderer.\n");
return false;
}
}
if (!::SetPixelFormat(m_hDC, pixelFormat, NULL))
{
I_Error("R_OPENGL: Couldn't set pixel format.\n");
vid_renderer = 0;
I_Error("R_OPENGL: Couldn't set pixel format. Reverting to software mode...\n");
return false;
}
return true;
@ -917,7 +919,8 @@ bool Win32GLVideo::InitHardware (HWND Window, int multisample)
m_hRC = wglCreateContext(m_hDC);
if (m_hRC == NULL)
{
I_Error("R_OPENGL: Unable to create an OpenGL render context.\n");
vid_renderer = 0;
I_Error("R_OPENGL: Unable to create an OpenGL render context. Reverting to software mode...\n");
return false;
}
}
@ -929,7 +932,8 @@ bool Win32GLVideo::InitHardware (HWND Window, int multisample)
}
}
// We get here if the driver doesn't support the modern context creation API which always means an old driver.
I_Error ("R_OPENGL: Unable to create an OpenGL render context. Insufficient driver support for context creation\n");
vid_renderer = 0;
I_Error ("R_OPENGL: Unable to create an OpenGL render context. Insufficient driver support for context creation. Reverting to software mode...\n");
return false;
}